00:01:53 | arkanoid | I never stepped into writing web frontends starting from "low-level" html, but always via high level components and stuff (because I'm lazy, and also because I hated the web scene when it was js only). What's the more ergonomic way to get bi-directional web app with ready-to-use component blocks and stuff like that, with nim? |
00:02:30 | arkanoid | with python I'd use streamlit or stuff like that, that let's me write a single codebase for both parts. Is there anything like this in nim? |
00:10:01 | FromDiscord | <jviega> Or else I'm doing it wrong. |
00:11:06 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix=4DUA |
00:14:35 | FromDiscord | <Elegantbeef> Is redeclaring a destructor a static error or a silent error? |
00:14:43 | FromDiscord | <jviega> It's two different programs |
00:14:54 | FromDiscord | <Elegantbeef> Right but I'm implying Nim declares one |
00:15:03 | FromDiscord | <jviega> No you can declare multiple ones and set priorities |
00:17:43 | FromDiscord | <jviega> `attribute((destructor(101))` sets the priority to 101 (everything has to be over 100, anything lower is reserved) |
00:21:41 | FromDiscord | <jviega> Odd, I don't even see it generated when I disassemble the debug version?? |
00:22:30 | FromDiscord | <Elegantbeef> Nim's dead code elimination |
00:22:50 | FromDiscord | <Elegantbeef> throw `exportc` on there |
00:24:02 | FromDiscord | <jviega> No, cdecl |
00:24:07 | FromDiscord | <jviega> It's the calling convention |
00:24:12 | FromDiscord | <Elegantbeef> What? |
00:24:20 | FromDiscord | <Elegantbeef> It's not the calling convention |
00:24:31 | FromDiscord | <Elegantbeef> Linux is cdecl anyway |
00:24:32 | FromDiscord | <jviega> I don't need exportc, it works fine w/ just cdecl |
00:24:50 | FromDiscord | <Elegantbeef> No it doesnt |
00:25:16 | FromDiscord | <jviega> On my mac it does anyway. Either works. |
00:25:20 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1142252928023928913/image.png |
00:25:24 | FromDiscord | <jviega> I've tried it all 3 ways |
00:25:42 | FromDiscord | <jviega> But no worries, I trust you, exportc it is 🙂 |
00:25:47 | FromDiscord | <Elegantbeef> Just use exportc to skip Nim's dead code elimination 😄 |
00:25:49 | FromDiscord | <jviega> Thanks for the ear |
00:25:58 | FromDiscord | <Elegantbeef> Really though you could make a pragma to make this cleaner |
00:26:08 | FromDiscord | <Elegantbeef> But who needs that many destructors |
00:26:54 | FromDiscord | <jviega> Well, right, it's fine to have it be ugly, but wouldn't be a bad idea to have pragmas in the std library to make it easy for people to do it if they need to |
00:27:20 | FromDiscord | <Elegantbeef> The issue with pragmas is you cannot export them |
00:27:33 | FromDiscord | <Elegantbeef> Actually maybe you can... hmmm |
00:27:57 | FromDiscord | <jviega> If you exportc you automatically get cdecl then? |
00:28:42 | FromDiscord | <Elegantbeef> nah you cannot sadly |
00:28:58 | FromDiscord | <Elegantbeef> You probably should do `exportc, cdecl` |
00:29:05 | FromDiscord | <Elegantbeef> But on Unix `cdecl` is `nimcall` |
00:29:24 | FromDiscord | <jviega> Got it. I assume stdcall on windows? |
00:29:41 | FromDiscord | <Elegantbeef> Fastcall or stdcall, don't recall |
00:29:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DUC |
00:30:44 | FromDiscord | <jviega> I've actually found that if I've got cross-module dependencies that would make the code unclear to split up, I just break the need for a cyclic import with an importc, works pretty well 🙂 |
00:30:55 | FromDiscord | <jviega> Yeah, that's super nice |
00:31:51 | FromDiscord | <Elegantbeef> I dumbly just reach for generics for breaking up cycles |
00:32:05 | FromDiscord | <Elegantbeef> Generics really are a form of dependency injection that allow you to break module cycles |
00:32:40 | FromDiscord | <Elegantbeef> I say I dumbly do that, but I havent actually done that, I've thought about it a tinge |
00:33:28 | FromDiscord | <jviega> Yeah, really in C it's never a problem due to header files, and even if I didn't have a header file, a simple "extern" would do the trick. Maybe I should sugar the thing... 50K lines of code later, I've had to do it a few times |
00:34:07 | FromDiscord | <jviega> Anyway, thanks again, helpful as ever. |
00:34:30 | FromDiscord | <Elegantbeef> No problem, you mostly solved the problem 😛 |
00:37:01 | FromDiscord | <jviega> Yeah, still helpful; if you hadn't given me hope I would have .emit'd the C, found that it worked, and lived with that. |
00:45:48 | FromDiscord | <etra> In reply to @Elegantbeef "They're all added to": I'm confused, because it's spawning them but they shouldn't get any cpu until you await them? and since it awaits them in order how is that not the same as a simple synchronous for loop |
00:45:55 | FromDiscord | <etra> unless there's a background polling thread |
00:46:32 | FromDiscord | <Elegantbeef> Await gives up the CPU to handle any presently pooled futures afaik |
00:52:35 | * | tam joined #nim |
01:08:17 | FromDiscord | <m4ul3r> Is there a way to get the time at compile in nim similar to `TIME` macro in cpp? https://media.discordapp.net/attachments/371759389889003532/1142263735235391510/image.png |
01:08:36 | FromDiscord | <m4ul3r> (edit) "cpp?" => "cpp?↵can't use now because `cannot evaluate at compile time: localInstance`" |
01:12:05 | FromDiscord | <m4ul3r> nvm, i'm just dum https://nim-lang.org/docs/system.html#CompileTime |
01:12:28 | FromDiscord | <m4ul3r> (edit) "nvm, i'm just dum ... https://nim-lang.org/docs/system.html#CompileTime" added ":smooth: " |
01:34:11 | FromDiscord | <System64 ~ Flandre Scarlet> I don't understand why profiling give me irrevelent lines |
01:51:43 | * | jmcantrell left #nim (WeeChat 4.0.3) |
01:57:16 | * | tam quit (Ping timeout: 256 seconds) |
01:58:17 | dithpri | huh I missed the 2.0 release |
01:58:19 | * | tam joined #nim |
01:58:23 | dithpri | s/2.0/2.0.0 |
01:58:31 | * | tam quit (Client Quit) |
01:59:45 | FromDiscord | <heysokam> is there something like `FILE`, and `LINE` from C, but in Nim that gives the same info with correct data from nim introspection? |
02:00:27 | FromDiscord | <heysokam> I figure i could wrap those, but then I would access the C backend information, right? 🤔 |
02:01:49 | FromDiscord | <Elegantbeef> There is the `line` pragma |
02:03:34 | FromDiscord | <juan_carlos> https://nim-lang.github.io/Nim/macros.html#lineInfoObj%2CNimNode |
02:21:25 | FromDiscord | <jos7388> is there a nim implementation of btreemap? |
02:30:01 | FromDiscord | <jos7388> also, after getting `nimble develop` to work, vscode doesn't know how to load up the lib i was doing develop for |
02:30:13 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1142284352034705488/image.png |
02:30:26 | FromDiscord | <jos7388> but the compiler is fine |
02:30:35 | arkanoid | without any index metric in nimble.directory, searching for the best library for the task is hard |
02:32:05 | FromDiscord | <jos7388> are u responding to me? |
02:32:09 | FromDiscord | <Elegantbeef> Close and restart vscode |
02:32:29 | FromDiscord | <jos7388> In reply to @Elegantbeef "Close and restart vscode": i did try that |
02:32:33 | FromDiscord | <jos7388> it doesn't seem to change anything |
02:33:03 | FromDiscord | <jos7388> i'm using the nimseam fork |
02:34:53 | dithpri | what's that |
02:36:16 | FromDiscord | <jos7388> it's the vscode extension i was told to install, after i had problems with another one |
02:36:27 | FromDiscord | <jos7388> the nimsaem one was updated in 2022, other one like 2020 |
02:36:40 | FromDiscord | <Elegantbeef> Odd that it doesnt work |
02:37:16 | FromDiscord | <jos7388> tbh not surprised when you decouple all the configuration like i mentioned |
02:37:19 | FromDiscord | <jos7388> i knew this would happen |
02:37:32 | FromDiscord | <Elegantbeef> Lol |
02:37:43 | FromDiscord | <Elegantbeef> It uses the path in the pkgs |
02:38:11 | FromDiscord | <Elegantbeef> There should be no decoupling issues since it should emit a config like atlas ideally |
02:38:28 | FromDiscord | <jos7388> maybe i should switch to atlas then |
02:38:32 | FromDiscord | <jos7388> nimsuggest should read nim.cfg right |
02:38:39 | FromDiscord | <jos7388> no matter what that should work |
02:38:47 | FromDiscord | <Elegantbeef> Yes |
02:39:45 | FromDiscord | <jos7388> "Upcoming Nim version 2.0 will ship with atlas" |
02:40:06 | FromDiscord | <jos7388> dont think i got it with choosenim |
02:40:16 | FromDiscord | <Elegantbeef> You do it's not linked though |
02:41:02 | FromDiscord | <jos7388> do u happen to know where it's installed? |
02:41:07 | FromDiscord | <Elegantbeef> Choosenim wasnt updated to properly link it cause it's not a nim-lang repo apparently |
02:41:19 | FromDiscord | <Elegantbeef> should be `.choosenim/toolchain/nim-2.0.0/bin` |
02:41:57 | FromDiscord | <jos7388> oh sweet i found it |
02:41:58 | FromDiscord | <jos7388> thanks |
02:42:07 | FromDiscord | <jos7388> u know a lot about nim |
02:43:31 | FromDiscord | <Elegantbeef> What, no! |
03:33:38 | * | lucasta_ joined #nim |
03:33:39 | * | lucasta_ quit (Client Quit) |
03:53:50 | * | xet7 quit (Ping timeout: 245 seconds) |
04:54:48 | FromDiscord | <ShalokShalom (ShalokShalom)> He is our AI |
04:54:54 | FromDiscord | <ShalokShalom (ShalokShalom)> Nim\`s personalized AI with tutoring capabilities |
05:28:59 | * | junaid_ joined #nim |
05:55:43 | * | fallback quit (Ping timeout: 244 seconds) |
06:03:54 | * | fallback joined #nim |
06:07:45 | FromDiscord | <Phil> Okay is testament just buggy when it comes to when statements? |
06:09:35 | FromDiscord | <Phil> Well first things first, how do I get testament to not eat my echo statements, I'd like to debug-log but they're getting swallowed by testament and --verbose is not spitting them back out |
06:09:57 | FromDiscord | <Phil> I'm running ` exec "testament --verbose --print run tests/externalAPI/test_map_validation.nim"` |
06:24:01 | FromDiscord | <Phil> Okay no it's not testament, it's some absolutely weird fucking behaviour around macros |
06:30:21 | FromDiscord | <Phil> What in the...↵Uuuuuuugh it's because of test-paths that testament requires.↵That means when I `import mapster` it's not importing the project, it's importing from `~/.nimble/pkgs2` gnaaaaaa |
06:31:29 | FromDiscord | <Phil> Okay how do I change how a test file under `tests/externalAPI/test_map_validation.nim` imports its own source-code from the project? |
06:34:56 | FromDiscord | <Elegantbeef> `configs.nims` with a `path` |
06:35:40 | FromDiscord | <Phil> Does testament listen to config.nims as well? |
06:35:55 | FromDiscord | <Elegantbeef> It should since it compiles a nim file |
06:36:46 | FromDiscord | <Phil> For context: I currently have a fundamental trust issue because I was under the impression testament on its own would figure out that entire path situation since nothing hinted at that not being the case, so I'm currently assuming testament does everything in weird custom ways |
06:37:32 | FromDiscord | <Phil> Like heck, testaments own flipping docs and functionality demand that you put your tests into subdirectories of the tests directory rather than directly in it, that that breaks the entire path situation is super confusing |
06:38:32 | FromDiscord | <Phil> As for config.nims:↵`switch("path", "$projectDir/../src")`↵This is the default one and that looks like it should always work |
06:44:31 | * | jmdaemon joined #nim |
06:47:20 | FromDiscord | <jos7388> does UFCS not work with generics |
06:47:22 | FromDiscord | <jos7388> im trying to do |
06:47:37 | FromDiscord | <Elegantbeef> `bleh.proc[: T]()` |
06:47:43 | FromDiscord | <jos7388> why |
06:47:59 | FromDiscord | <Elegantbeef> `[T]` is ambiguous for `[](bleh.proc, T)` |
06:49:07 | FromDiscord | <Phil> Okay testament is just straight up broken I have to assume, it correctly encounters the project error'ing out at compile-time due to invalid validation, and the test just still fails because it starts comparing completely unrelated files to one another.↵Like wtf is this |
06:50:46 | FromDiscord | <jos7388> In reply to @Elegantbeef "`[T]` is ambiguous for": i dunno what this even means |
06:51:05 | FromDiscord | <jos7388> that means deref the tuple? [] is the deref operator, right? |
06:51:10 | FromDiscord | <Phil> And the worst part is I can't even test it normally with `compiles` because `compiles` breaks when the expression inside of it contains a pragma. Gnaaaaa |
06:51:11 | FromDiscord | <jos7388> and it's right associative? |
06:51:13 | FromDiscord | <Elegantbeef> `[]` is also array index |
06:51:18 | FromDiscord | <jos7388> \ |
06:52:17 | FromDiscord | <jos7388> dunno somehow it still doesn't work |
06:52:22 | FromDiscord | <Elegantbeef> `[](bleh.proc, T) is how you write array access without syntax sugar, but the thing is `a.b[T]\` is considered array index |
06:52:29 | FromDiscord | <Elegantbeef> Whoops bad quote |
06:52:59 | FromDiscord | <Elegantbeef> Anyway point is `myObject.array[ind]` is preferred over `myObject.proc[T]` and as such `[: T]` is used |
06:52:59 | FromDiscord | <jos7388> sent a code paste, see https://play.nim-lang.org/#ix=4DVR |
06:53:04 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1142350502240206899/image.png |
06:53:05 | FromDiscord | <Elegantbeef> The hell |
06:53:16 | FromDiscord | <Elegantbeef> `DUiComponent[int].new)` |
06:53:27 | FromDiscord | <Elegantbeef> `DUiComponent[int].new()` |
06:53:38 | FromDiscord | <jos7388> oh its beacuse i'm using new |
06:53:44 | FromDiscord | <jos7388> weird |
06:53:45 | FromDiscord | <Elegantbeef> No |
06:53:47 | FromDiscord | <jos7388> it is |
06:53:55 | FromDiscord | <Elegantbeef> What you can alias new |
06:53:55 | FromDiscord | <jos7388> changing the name fixes the issue |
06:54:08 | FromDiscord | <jos7388> yea i did before |
06:54:10 | FromDiscord | <jos7388> without an issue |
06:54:14 | FromDiscord | <jos7388> but never with a generic |
06:54:19 | FromDiscord | <Elegantbeef> The issue is likely that you have no argument and are importing this module |
06:54:38 | FromDiscord | <Elegantbeef> As such `system.new` and this module's `new` are the same level |
06:55:12 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1142351040679784489/image.png |
06:55:13 | FromDiscord | <jos7388> idk |
06:55:59 | FromDiscord | <Elegantbeef> Right the issue here is your generic parameter is not an int |
06:56:18 | FromDiscord | <Elegantbeef> The generic parameter of `DUiComponentData` is attached to that type |
06:56:36 | FromDiscord | <Elegantbeef> there is only a single generic parameter here |
06:57:00 | FromDiscord | <jos7388> DUiComponentData has no generic parameters |
06:57:19 | FromDiscord | <Phil> Beef? Any way that something does not compile other than `compiles()` and testament? |
06:57:21 | FromDiscord | <jos7388> it's just used to calculate some runtime data in the actual new impl |
06:57:28 | FromDiscord | <Phil> (edit) "Beef? Any way ... that" added "to test" |
06:57:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DVS |
06:57:47 | FromDiscord | <jos7388> ye it's meant to be unparameterized |
06:58:04 | FromDiscord | <Elegantbeef> This works |
06:58:04 | FromDiscord | <Elegantbeef> Or just `MyObject[int].new()` without the `[T]` inside the proc |
06:58:26 | FromDiscord | <ajusa> Is the standard library threadpool any good? I feel like folks have told me that using `spawn` is a bad idea. If so, what's a good library to do this type of function parallelization? Is there anything more high level than creating raw threads? |
06:58:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DVU |
06:59:57 | FromDiscord | <Elegantbeef> https://github.com/Araq/malebolgia is what araq suggests now |
07:02:02 | FromDiscord | <ajusa> Huh okay, I'll look into that. No flowvar, instead it has some weird syntax for awaiting a task and storing it in a variable |
07:02:33 | FromDiscord | <Elegantbeef> Otherwise weave and taskpools are the goto afaik |
07:03:55 | FromDiscord | <ajusa> This also requires Nim 2.0, will try status taskpool again. I feel like it didn't support returning strings when I looked at it before |
07:04:10 | FromDiscord | <Elegantbeef> Oh noes stable Nim! 😛 |
07:06:34 | FromDiscord | <ajusa> I guess it's out, but I'll hold off on upgrading for a bit due to all of the changes. I'll probably wait a few months and verify that all the libs I normally use work as well |
07:26:36 | FromDiscord | <kyre58> @ElegantBeouf is nim the best programming language |
07:27:07 | FromDiscord | <Elegantbeef> This smells of LLM testing |
07:27:26 | FromDiscord | <kyre58> @ElegantBeouf what is LLM |
07:27:38 | FromDiscord | <Elegantbeef> No clue |
07:28:02 | FromDiscord | <kyre58> @ElegantBeouf you aren’t a bot :PokemonTangelaStare: |
07:28:14 | FromDiscord | <Elegantbeef> I sure hope not |
07:28:39 | FromDiscord | <Phil> sth sth everything is a simulation and testament is sucking my soul out sth sth |
07:28:47 | FromDiscord | <kyre58> @ElegantBeouf have you hacked Discord? |
07:29:04 | FromDiscord | <Elegantbeef> People really are the most confused about webhooks |
07:29:18 | FromDiscord | <Elegantbeef> No I'm using matrix and this discord server uses t2bot to bridge to matrix |
07:29:35 | FromDiscord | <Phil> Example of me (Phil) writing from matrix btw. |
07:30:21 | FromDiscord | <Elegantbeef> Nah he hacked discord |
07:30:39 | FromDiscord | <Phil> Ah when I do it suddenly it's hacking? |
07:30:48 | FromDiscord | <Elegantbeef> Of course |
07:32:13 | FromDiscord | <Phil> ... yknow what, I'll build my own mechanism for checking if a thing compiles, seems easier |
07:52:11 | FromDiscord | <.maverk> does nim programming language have asm keyword ? |
07:53:13 | ehmry | .maverk: no, but you can use emit to generate C code that does |
07:53:34 | FromDiscord | <.maverk> In reply to @ehmry ".maverk: no, but you": thanks |
07:54:03 | FromDiscord | <Phil> Hmm can you write nim-code to a file "in-memory" and compile that file? |
07:55:30 | ehmry | I think so, you could write a proc that returns a string of code and use that in {.emit.} |
07:55:32 | FromDiscord | <Phil> Basically I want to execute `nim c` on a string of nim-code to see if it compiles.↵The current path I see is write that nim-code to a file, execute nim c on that file, delete the file afterwards.↵I recall writing a file to memory being a thing, just wondering if that would be useable in this scenario |
07:57:40 | ehmry | nvm, I'm thinking of something else |
07:58:15 | FromDiscord | <.maverk> In reply to @ehmry ".maverk: no, but you": you are wrong |
07:58:27 | FromDiscord | <.maverk> nim does have the ``asm`` keyword |
07:58:48 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4DWc |
08:00:23 | ehmry | .maverk: you are right, i didn't notice that it was added |
08:00:36 | FromDiscord | <dersnof> bruh i sit in front of computer, i have nim compiler on my hand etc but |
08:00:40 | FromDiscord | <dersnof> no idea what to code |
08:01:04 | FromDiscord | <dersnof> i dont wanna code tic tac toe, i did already at like 5 yrs ago or smth |
08:01:13 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1142367649028898858/ttest.PNG |
08:02:24 | FromDiscord | <Phil> Ahhhh crap, I want to execute a shell command at compiletime |
08:02:46 | FromDiscord | <Elegantbeef> so? |
08:03:26 | FromDiscord | <Phil> I forgot what the procs for that where so that's 5 mins diving again to figure out which ones were the runtime ones and which ones were the compiletime ones |
08:03:38 | FromDiscord | <Elegantbeef> `staticExec` |
08:03:54 | ehmry | URLs are a thing https://nim-lang.org/docs/manual.html#statements-and-expressions-assembler-statement |
08:04:02 | FromDiscord | <kyre58> Anyone know how good the discord nim library is? |
08:04:32 | FromDiscord | <Elegantbeef> I heard it took money out of a tip jar |
08:05:21 | FromDiscord | <k0ts> Use it and find out |
08:05:59 | FromDiscord | <kyre58> :PepeSuffering: :PepeSuffering: :PepeSuffering: |
08:06:15 | FromDiscord | <Elegantbeef> Oh noes I need to build an informed opinion! |
08:06:47 | FromDiscord | <kyre58> :PokemonAlolanVulpixAnnoyance: |
08:10:28 | FromDiscord | <Phil> Are there versions of staticExec with exitCode? |
08:11:12 | FromDiscord | <Elegantbeef> Nope |
08:11:33 | * | junaid_ quit (Remote host closed the connection) |
08:11:54 | FromDiscord | <Phil> FML, so basically I check that a compilation succeeded by checking the output for `[SuccessX]` |
08:12:11 | FromDiscord | <Elegantbeef> `nim check --verbosity: 0 ...` |
08:12:42 | FromDiscord | <Elegantbeef> or `nim c` |
08:13:46 | FromDiscord | <demotomohiro> In reply to @isofruit "Are there versions of": https://nim-lang.org/docs/system.html#gorgeEx%2Cstring%2Cstring%2Cstring |
08:14:04 | FromDiscord | <Elegantbeef> Oh right that exists 😄 |
08:14:11 | FromDiscord | <Phil> Wait but... wtf... err nice! |
08:14:17 | FromDiscord | <Elegantbeef> Odd there is no `staticReadEx` |
08:14:38 | FromDiscord | <Elegantbeef> Anyway use `nim check --verbosity: 0` |
08:14:49 | FromDiscord | <Elegantbeef> That does semantic analysis but no C generation and is what you want |
08:20:30 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DWg |
08:24:21 | * | azimut quit (Ping timeout: 246 seconds) |
08:30:47 | FromDiscord | <dersnof> can i make compiler in nim |
08:30:59 | FromDiscord | <Phil> Wait a second... shit an erroneous compile still counts as successfully executed command |
08:32:12 | FromDiscord | <demotomohiro> In reply to @dersnof "can i make compiler": I think so because Nim is written in Nim. |
08:33:21 | FromDiscord | <dersnof> In reply to @demotomohiro "I think so because": wait Nim is written in Nim, then what Nim is written in ? |
08:34:19 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DWh |
08:34:59 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4DWh" => "https://play.nim-lang.org/#ix=4DWi" |
08:36:17 | FromDiscord | <demotomohiro> In reply to @dersnof "wait Nim is written": Here is source code of Nim.↵I heard Nim was written in Pascal at first. |
08:36:25 | FromDiscord | <demotomohiro> https://github.com/nim-lang/Nim/tree/devel/compiler |
08:40:44 | FromDiscord | <enthus1ast> Yes and then it was auto translated to nim py pas2nim https://github.com/nim-lang/pas2nim |
08:43:50 | FromDiscord | <dersnof> In reply to @demotomohiro "Here is source code": how would you code language in itself though |
08:46:04 | FromDiscord | <enthus1ast> You write the compiler in another language until it does something useful, then you rewrite (or auto rewrite) its compiler in itself and let it be compiled by the old compiler |
08:46:34 | FromDiscord | <enthus1ast> Imho this is how nim still bootstraps, by a c version of it self |
08:47:10 | FromDiscord | <enthus1ast> But yeah it's quite impressive to be honest |
09:49:59 | FromDiscord | <Phil> Ugh, if I deal with compilation myself like that I need to keep in mind what the relative filepath is where etc., that gets so ugly so quickly, why can't testament just flipping work |
09:52:13 | FromDiscord | <odexine> Because it’s not that widely used (as far as I know only in the compiler and a few packages) so many things aren’t thought over too much |
09:56:01 | FromDiscord | <jmgomez> anyone knows where is the repo for the modules that where split from the std? for instance `asyncftpclient`? |
09:58:51 | FromDiscord | <jmgomez> nvm just found it |
10:08:00 | * | jmdaemon quit (Ping timeout: 245 seconds) |
10:16:29 | FromDiscord | <Phil> I finally found the flipping issue... and I can't solve it.↵Testament can't deal with `{.error.}` getting thrown from a file that isn't the test-file |
10:16:47 | FromDiscord | <Phil> Time to file a bugreport |
10:38:23 | FromDiscord | <starkiller1493> How would I write a macro that returns the currently checked out git hash? |
10:39:31 | FromDiscord | <Phil> No need to write a macro for that. You can do both at compile or runtime with just procs |
10:40:05 | FromDiscord | <Phil> It's about the hash of the current git commit? |
10:40:49 | NimEventer | New thread by matkuki: Local bug-tracker (written in Nim or not), see https://forum.nim-lang.org/t/10420 |
10:41:09 | FromDiscord | <Phil> `exec("git rev-parse HEAD")` (assuming this gets executed from within the git repo) should work |
10:41:35 | FromDiscord | <starkiller1493> yep↵at runtime it's simple, but i'm not sure how to do it at compile time |
10:41:49 | NimEventer | New thread by Cnerd: Ssl with asynchttpserver, see https://forum.nim-lang.org/t/10421 |
10:42:14 | FromDiscord | <Phil> `staticExec` should do it, assuming again it's called from within the git repo |
10:43:45 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DWE |
10:43:57 | FromDiscord | <Phil> mapster is a project of mine that is a git repo |
10:44:19 | FromDiscord | <starkiller1493> oh, that's simple, thanks |
10:54:13 | * | koltrast_ quit (Quit: ZNC - http://znc.in) |
10:54:32 | * | koltrast joined #nim |
12:14:08 | FromDiscord | <Phil> I want to kick... I dunno, myself, the docs, sth |
12:17:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DX2 |
12:19:25 | * | dithpri quit (Remote host closed the connection) |
12:19:48 | * | dithpri joined #nim |
12:28:06 | * | azimut joined #nim |
12:31:22 | * | azimut quit (Remote host closed the connection) |
12:31:43 | * | azimut joined #nim |
13:34:25 | FromDiscord | <Phil> ... what was the flag to get generated c code again? cc? |
13:35:22 | FromDiscord | <Phil> Pretty sure it's `nim cc ./src/somefile.nim` but I can't find the c-code and when I pass in `-o:./src/cout` to get the c-files in a specific directory I just get the `out` file, not a C-source file |
13:35:38 | FromDiscord | <Phil> (edit) "the `out`" => "a `cout.out`" |
13:36:51 | FromDiscord | <Phil> I solely want the source files so I can check that some code is in them |
13:37:27 | FromDiscord | <ringabout> Well, you might specify the nimcache location by `--nimcache:nimcache` where the C code lay in. |
13:38:30 | FromDiscord | <Phil> ... oh wow that's a lot of C code for 2 lines of nim |
13:52:37 | * | xet7 joined #nim |
13:54:12 | NimEventer | New post on r/nim by quirkst3r: Evading Windows Defender with Nim [Article], see https://reddit.com/r/nim/comments/15vgwiz/evading_windows_defender_with_nim_article/ |
13:58:08 | * | junaid_ joined #nim |
13:59:18 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1142457766657658921/image.png |
13:59:20 | FromDiscord | <jos7388> sent a code paste, see https://play.nim-lang.org/#ix=4DXE |
13:59:32 | FromDiscord | <jos7388> anything below that padding tuple new thing doesn't work |
14:00:07 | FromDiscord | <jos7388> doesn't really make sense to me-- removing the first declaration fixes it |
14:02:32 | FromDiscord | <jos7388> i guess overload resolution or whatever doesn't work with generics? |
14:04:31 | FromDiscord | <jos7388> weird, because the error'd out line is resolving to `system.new`-- so why is the first declaration even relevant? |
14:12:16 | FromDiscord | <jos7388> ok well one thing i can do is make the second arg `typedesc[T]`, and then T is inferred, and it works |
14:12:21 | FromDiscord | <jos7388> :PeepoShrug: |
14:14:37 | FromDiscord | <Phil> Your entire : int construct weirds me out as hell so I can't really say much here 😅 |
14:14:55 | FromDiscord | <Phil> I know that to check for inheritance in a way, not for much more than that |
14:27:36 | FromDiscord | <odexine> In reply to @isofruit "Your entire : int": wdym |
14:34:14 | FromDiscord | <Phil> What is `[ :int]` for a generic type, basically?↵What thus does `new[: int](MyObjectType)` express? |
14:34:31 | FromDiscord | <jos7388> In reply to @isofruit "Your entire : int": ye i also don't like this syntax |
14:34:44 | FromDiscord | <jos7388> nim pros be like "haha what do you mean??" but the character obviously shouldn't be there |
14:34:55 | FromDiscord | <jos7388> the ambiguity with the other expression seems insane to me |
14:36:01 | FromDiscord | <Phil> Nim as a language just has a pretty wide range of expressions, knowing them all takes a bit ^^ |
14:36:31 | FromDiscord | <jos7388> UFCS just has some rough edges |
14:36:49 | FromDiscord | <jos7388> i love UFCS in general but this is of those edges i guess |
14:37:19 | FromDiscord | <jos7388> i'm sure it could be fixed in some way, maybe with type information-- like array deref should only be valid on array types, and on procs it should prefer to parse as a call |
14:37:31 | FromDiscord | <jos7388> but then i guess you don't have a context free grammar any more, right? |
14:38:10 | FromDiscord | <Phil> sent a long message, see http://ix.io/4DXQ |
14:38:20 | FromDiscord | <Phil> Screenshots generally aren't my favourites when looking at code |
14:39:36 | FromDiscord | <jos7388> from a chat before |
14:39:41 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=4DXR |
14:40:05 | FromDiscord | <odexine> or rather insert any type as the first param ... you know what i mean |
14:40:09 | FromDiscord | <jos7388> well obviously the [] symbol is overloaded, and <> should have been used for generics |
14:40:31 | FromDiscord | <jos7388> that would probably be the most obvious solution if you could go back and change it |
14:40:32 | FromDiscord | <odexine> there is the lt-gt problem then |
14:40:43 | FromDiscord | <jos7388> eh that is much simpler isn't it |
14:40:47 | FromDiscord | <odexine> is it |
14:40:53 | FromDiscord | <jos7388> i think so |
14:41:11 | FromDiscord | <jos7388> is there any ambiguity with that? |
14:41:30 | FromDiscord | <jos7388> there shouldn't be, the symbols are overloaded but in the parser impl they're never used in the same place |
14:41:49 | FromDiscord | <jos7388> i know in rust you have to use the weird ::<> operator or it thinks it's a comparison operator |
14:41:58 | FromDiscord | <jos7388> but i've never had to do that in other langs that use <> for generics |
14:43:14 | FromDiscord | <odexine> because it likely has some hacks (like iirc in c++) that allow it for the more trivial cases but then fail to parse in the more complex cases |
14:44:24 | FromDiscord | <jos7388> it probably requires the parser to look ahead a bit more |
14:44:30 | FromDiscord | <jos7388> but nobody ever said LL1 was a requirement rly |
14:44:46 | FromDiscord | <jos7388> but i dont know |
14:44:54 | FromDiscord | <jos7388> it might not be possible in a context free language |
14:45:01 | FromDiscord | <odexine> In reply to @jos7388 "it probably requires the": i think it is unbounded how much the parser has to look ahead to properly resolve <> |
14:45:10 | FromDiscord | <jos7388> ye but in practice this really doesn't matter imo |
14:45:19 | FromDiscord | <jos7388> a lot of compiler design is hoity-toity BS IMO |
14:45:35 | FromDiscord | <jos7388> overexplored problem by nerds in the 80's |
14:46:25 | FromDiscord | <jos7388> at the end of the day the parser should just parse text and produce some artifact, the LL1 stuff and all those other properties-- just safeguards to make it impossible for the compiler to infinite loop and stuff innit? |
14:46:44 | FromDiscord | <jos7388> but if you're okay with maintaining a few places where those invariants are violated |
14:46:52 | FromDiscord | <jos7388> why not, if it makes your language better? |
14:54:30 | FromDiscord | <jos7388> anyway im working on a UI library that uses ECS patterns and the depth buffer for ordering |
14:54:58 | FromDiscord | <jos7388> has anyone done that before? i feel most UI libs use recursive descent down the DOM and painters algorithm for ordering |
14:55:08 | FromDiscord | <jos7388> and somehow i think that's probably quite a bit slower, but i'm not sure |
14:58:25 | FromDiscord | <System64 ~ Flandre Scarlet> Hi, how can I preallocate a seq and then append stuff into it without reallocating it? |
14:58:33 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "it?" => "it please?" |
14:58:34 | FromDiscord | <odexine> newSeqWithCap |
15:00:51 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DY2 |
15:01:56 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "newSeqWithCap": Seems it doesn't find it |
15:01:57 | FromDiscord | <odexine> what? |
15:02:00 | FromDiscord | <heysokam> In reply to @sys64 "Hi, how can I": there is also sequtils `newSeqWith` that takes contents so that it is not initialized to `0` or whatever the defaults |
15:02:12 | FromDiscord | <odexine> sorry |
15:02:15 | FromDiscord | <odexine> newseqofcap |
15:02:16 | FromDiscord | <odexine> not with |
15:04:50 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "newseqofcap": Ah thanks, it works↵And to get a slice of a seq? |
15:04:59 | FromDiscord | <odexine> toopenarray? |
15:05:46 | FromDiscord | <Phil> In reply to @jos7388 "has anyone done that": Sadly I'm uneducated on that, more a higher-level person. can.l might know since he wrote owlkettle and possible one of the folks that wrote bindings to qt/qml |
15:07:40 | FromDiscord | <jos7388> those libs look really interesting for all the other parts of building a UI |
15:08:12 | FromDiscord | <jos7388> i tried owlkettle before too i think |
15:08:15 | FromDiscord | <Phil> I think lower than that the only person I'd guess is treeform maybe (?) |
15:08:33 | FromDiscord | <jos7388> i was looking at nimx, have you tried it? it looks really awesome |
15:08:37 | FromDiscord | <Phil> I'm super uneducated on the GUI stack |
15:08:47 | FromDiscord | <Phil> only played around with owlkettle in terms of GUI |
15:08:57 | FromDiscord | <jos7388> u can click around the web demo for nimx if u wanna try it |
15:08:59 | FromDiscord | <jos7388> http://yglukhov.github.io/nimx/livedemo/main.html |
15:09:26 | FromDiscord | <jos7388> i think it's really neat-- i love how rust has nothing like this because retained mode is so hard with rust's memory model |
15:19:22 | FromDiscord | <System64 ~ Flandre Scarlet> Not possible to make X mutable? https://media.discordapp.net/attachments/371759389889003532/1142477914210840607/image.png |
15:19:59 | NimEventer | New thread by mildred: How to update a nimble package?, see https://forum.nim-lang.org/t/10422 |
15:21:11 | FromDiscord | <odexine> In reply to @sys64 "Not possible to make": no, its a property of the iterator's return value |
15:25:26 | arkanoid | do you know if there's a lib capable of creating object definitions from yaml? |
15:26:08 | FromDiscord | <heysokam> In reply to @arkanoid "do you know if": does nimyaml not do that? 🤔↵or do you mean their declarations? |
15:27:43 | arkanoid | afaik nimyaml load yaml file and create instances of existing object definitions |
15:27:53 | arkanoid | (is it definition or declaration?) |
15:28:10 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4DY8 |
15:28:12 | arkanoid | I mean the "type" section |
15:28:49 | FromDiscord | <odexine> as in load a yaml schema? |
15:29:34 | FromDiscord | <heysokam> In reply to @chronos.vitaqua "Why not just make": because otherprefix is overriden by this file, and coming from a different library |
15:29:43 | FromDiscord | <Chronos [She/Her]> Ah |
15:30:00 | FromDiscord | <heysokam> In reply to @arkanoid "(is it definition or": declaration is the type, definition is the contents |
15:30:28 | FromDiscord | <heysokam> nimyaml populates data in the definition↵if you meant the declaration, then that's different (i don't know if it does or not" |
15:30:30 | FromDiscord | <heysokam> (edit) "not"" => "not)" |
15:31:02 | arkanoid | thanks. So I'd like to "declare" types by reading a yaml |
15:31:16 | arkanoid | and also creating relative instances |
15:31:58 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "because otherprefix is overriden": You could do it from a config file instead? |
15:37:10 | FromDiscord | <heysokam> In reply to @chronos.vitaqua "You could do it": yeah that's what I fell back into. i guess there is no escaping that |
15:38:43 | FromDiscord | <heysokam> In reply to @arkanoid "thanks. So I'd like": i had to do something similar for my glTF reader at `ngltf`, and I had to basically implement a quick-n-dirty code generator based on the schema. Hopefully you get a better option than that |
15:38:53 | FromDiscord | <heysokam> (edit) "In reply to @arkanoid "thanks. So I'd like": i had to do something similar for my glTF reader at `ngltf`, and I had to basically implement a quick-n-dirty code generator based on the ... schema." added "spec" |
15:39:00 | FromDiscord | <heysokam> (edit) "In reply to @arkanoid "thanks. So I'd like": i had to do something similar for my glTF reader at `ngltf`, and I had to basically implement a quick-n-dirty code generator based on the spec ... schema." added "json" |
15:58:26 | * | deadmarshal_ quit (Remote host closed the connection) |
16:00:30 | FromDiscord | <jos7388> is there anything like std::unique_ptr in nim |
16:00:37 | FromDiscord | <jos7388> something i wanna make sure nobody copies |
16:00:41 | FromDiscord | <jos7388> by accident |
16:00:47 | FromDiscord | <jos7388> and i only want 1 ref to it |
16:03:37 | FromDiscord | <k0ts> https://github.com/nim-lang/threading/blob/master/threading/smartptrs.nim |
16:03:43 | FromDiscord | <k0ts> This exists, never tried it though |
16:05:09 | FromDiscord | <amjadhd> How do you backport a fix to Nim 2.0 ? you create a PR against `version-2-0` branch ? |
16:15:35 | FromDiscord | <krisp0> Whenever I set my future return type to a type where it could be `Foo|Bar` I get a `cannot instantiate: 'FB`? ↵https://play.nim-lang.org/#ix=4DT3↵Is there a way you could fix this? |
16:15:43 | FromDiscord | <odexine> In reply to @amjadhd "How do you backport": maybe also ask in #internals, prolly higher chance to be answered |
16:15:52 | FromDiscord | <krisp0> (edit) "'FB`? ↵https://play.nim-lang.org/#ix=4DT3↵Is" => "'FB`↵https://play.nim-lang.org/#ix=4DT3↵Is" |
16:16:14 | FromDiscord | <odexine> In reply to @krisp0 "Whenever I set my": not allowed as the return type changes depending on runtime data |
16:16:27 | FromDiscord | <odexine> youd need to use object variants or another solution |
16:17:11 | FromDiscord | <odexine> btw it's not a problem of async either, this can be further minimised to remove async and still have the same issue |
16:50:40 | * | tiorock joined #nim |
16:50:40 | * | tiorock quit (Changing host) |
16:50:40 | * | tiorock joined #nim |
16:50:40 | * | rockcavera is now known as Guest4231 |
16:50:40 | * | Guest4231 quit (Killed (tungsten.libera.chat (Nickname regained by services))) |
16:50:40 | * | tiorock is now known as rockcavera |
16:56:38 | termer | Anyone know how I could convert an array[10, char] to a cstring? |
16:56:47 | termer | Anyone know how I could convert an array[10, char] to a cstring? |
16:56:48 | termer | oops |
16:56:53 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "yeah that's what I": Fair |
17:00:42 | FromDiscord | <nomad> how do i kill a alredy running process by name and not id? |
17:03:08 | FromDiscord | <jos7388> cute |
17:03:29 | termer | nomad, It depends on your OS |
17:03:48 | termer | I'm not sure if you can see the list of processes in the stdlib, but if you're on Windows, you might want to check the winim library |
17:04:04 | termer | Killing a process by name is usually not a very good idea though, since the name of your process might not be unique |
17:04:12 | termer | Why do you need to kill the process by its name? |
17:06:02 | FromDiscord | <nomad> im currently trying to make anti-cracking software |
17:06:27 | FromDiscord | <nomad> so im finding processes that are used to tamper and crack software and killing those |
17:15:52 | FromDiscord | <odexine> its possible that your software wont be running at a privilege where it can kill other processes |
17:16:10 | FromDiscord | <odexine> and lots of cracking software can mask its name |
17:22:44 | * | junaid_ quit (Remote host closed the connection) |
17:28:08 | FromDiscord | <jos7388> does atlas not do recursive pinning? |
17:28:12 | FromDiscord | <jos7388> i'm only using 3 deps and my lockfile only has 3 deps |
17:28:34 | FromDiscord | <jos7388> oh i think it's flattening out my deps? |
17:28:48 | FromDiscord | <jos7388> ye i just have no transient dependencies |
17:28:50 | FromDiscord | <jos7388> wild!! |
17:29:00 | FromDiscord | <jos7388> that means the stdlib is good |
17:33:33 | termer | odexine, I'd look into the winim library then |
17:33:40 | termer | everything odexine said is still valid, though |
17:33:59 | FromDiscord | <odexine> i think you pinged me by mistake? |
17:34:13 | termer | Oops |
17:34:18 | termer | nomad, see what I wrote above lol |
18:04:38 | FromDiscord | <etra> Can I have two async runtimes running in two different threads while communicating by a thread-safe channel? |
18:04:58 | FromDiscord | <etra> I have some sort of mpsc situation, and I'd like the producers to be on a separated thread than the consumer |
18:05:21 | FromDiscord | <etra> should be fine as long as they only communicate by channel right? |
18:14:01 | FromDiscord | <odexine> And also that you don’t send futures |
18:20:45 | * | azimut quit (Ping timeout: 246 seconds) |
18:21:59 | * | azimut joined #nim |
18:35:27 | FromDiscord | <heysokam> ' |
18:36:10 | FromDiscord | <krisp0> Is there a reason why whenever I compile with orc (nim v2.0.0) it gets stuck on `CC main.nim` and finishes compiling within like 120s on average? when I do `--mm:refc` the compilation is decently fast with just 12s on average. |
18:36:23 | FromDiscord | <krisp0> (edit) "12s" => "8-12s" |
18:36:37 | FromDiscord | <krisp0> I'm using linux mint |
18:36:40 | FromDiscord | <krisp0> (edit) "I'm using linux mint ... " added "btw" |
18:37:26 | FromDiscord | <heysokam> @ElegantBeouf do you have any package maintained exclusively with graffiti, without any manual release on github, only graffiti tags?↵for some reason, versions with `url/pkg#head` is not updating to the latest version whenever one is stored locally, so wondering if it might be because they are just tags and not proper github manual releases or something 🤔 |
18:37:28 | FromDiscord | <Phil> Sounds like you're running into a compilation edgecase |
18:37:53 | FromDiscord | <Phil> Can you feasably replicate that behaviour with a minimal example? |
18:43:23 | FromDiscord | <krisp0> hmm it seems like with a minimal example it only takes 4s, that imports everything that my file does.↵my nim file is 1111 lines long. |
18:45:04 | FromDiscord | <krisp0> I compiled a duplicate copy of the file and it took 61s, but the original file takes forever |
18:45:16 | FromDiscord | <krisp0> maybe it might be due to something with nim cache |
18:45:21 | FromDiscord | <Phil> Note that I'm not an expert in this field, but based on the surface level knowledge I have of ORC (which is the new mm under nim 2.0) I'd assume you're stumbling into a complex data structure of sorts where the compiler has to calculate a lot about where to insert destructors etc. |
18:45:39 | FromDiscord | <Phil> You can of course also delete your ~/.cache/nim folder and see if that helps |
18:45:52 | FromDiscord | <Phil> (on Linux, no clue about windows) |
18:50:16 | * | disso-peach joined #nim |
19:02:55 | * | deadmarshal_ joined #nim |
19:03:45 | * | junaid_ joined #nim |
19:04:11 | termer | Elegantbeef, https://github.com/termermc/nim-stack-strings/releases/tag/v1.1.0 |
19:08:40 | termer | The `views` experimental feature is great |
19:08:46 | termer | it should absolutely be made stable |
19:11:14 | * | ntat joined #nim |
19:11:35 | FromDiscord | <Chronos [She/Her]> In Nim, are ref types basically an equivalent for C accepting a pointer of a type? (But not as prettily wrapped up) |
19:12:41 | FromDiscord | <Chronos [She/Her]> In reply to @termer "Elegantbeef, https://github.com/termermc/nim-stack-": Huh... This looks interesting honestly |
19:12:52 | FromDiscord | <Chronos [She/Her]> Why is it nil terminated though, if I can ask? |
19:13:01 | FromDiscord | <Chronos [She/Her]> Did it have to be nil terminated? |
19:13:17 | termer | The old version wasn't |
19:13:24 | termer | The new version is so that it can interop with C easier |
19:13:48 | termer | C strings are null-terminated and if you want to use a StackString pointer as a cstring instead of copying memory, the only option is making them nil-terminated |
19:14:14 | termer | To answer your question about ref types, ref types are pointers that are managed by the compiler or GC |
19:14:25 | termer | Managed in general |
19:14:43 | termer | Under ARC/ORC, they're very similar to C++ and Rust smart pointers |
19:15:00 | termer | Under refc, they're just managed garbage-collected memory |
19:15:24 | termer | Are you familiar with the difference between Nim's ptr and ref keywords? |
19:17:05 | termer | TL;DR, they're both pointers, but ref is managed and ptr is unmanaged |
19:23:52 | * | junaid_ quit (Remote host closed the connection) |
19:28:00 | FromDiscord | <heysokam> In reply to @chronos.vitaqua "In Nim, are ref": regular types are the same as C accepting a ptr Type, since C is bycopy and nim is byref (unless you force them otherwise)↵ref types are the same as heap-allocating a C object and then sending the pointer to the function↵both send a ptr of some kind, but very differently used (ptr Type does not need to be heap-alloc, refs are always heap) |
19:29:58 | * | def- quit (Quit: -) |
19:30:39 | * | def- joined #nim |
19:37:11 | qwr | arc/orc might be similar to those smart pointers, but afaik its deferred reference counting, i.e. the compiler minimizes RC updates |
19:39:34 | termer | It might be more compiler-optimized I suppose |
19:45:54 | * | ntat quit (Quit: leaving) |
19:49:45 | FromDiscord | <Chronos [She/Her]> In reply to @termer "The new version is": Hm fair |
19:50:04 | FromDiscord | <Chronos [She/Her]> In reply to @termer "Are you familiar with": Yeah I am |
19:50:32 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "regular types are the": Makes sense, thanks! |
19:53:18 | FromDiscord | <heysokam> now that I think about it...↵is Nim also `{.byref.}` when there is no GC involved, like with `--mm:none`?↵or do object automatically become `{.bycopy.}` 🤔 |
19:53:28 | FromDiscord | <heysokam> (edit) "now that I think about it...↵is Nim also `{.byref.}` when there is no GC involved, like with `--mm:none`?↵or do object automatically become `{.bycopy.}` ... 🤔" added "in that case" |
19:57:50 | termer | no idea |
20:08:10 | FromDiscord | <Elegantbeef> byref simply means the compiler passes by reference |
20:08:32 | FromDiscord | <Elegantbeef> There is no memory management model there it's just instead of generating `T a` in a parameter list it's `T a` |
20:13:45 | FromDiscord | <dersnof> is this correct way |
20:13:46 | FromDiscord | <dersnof> sent a code paste, see https://play.nim-lang.org/#ix=4DZb |
20:13:47 | FromDiscord | <dersnof> to use macro |
20:19:14 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4DZd |
20:19:21 | FromDiscord | <heysokam> In reply to @Elegantbeef "There is no memory": ty ✍️ |
20:20:07 | FromDiscord | <heysokam> Did you see the graffiti @ from before, beef? |
20:20:26 | FromDiscord | <Elegantbeef> Just seen the thing about graffiti, all my packages on github use graffiti |
20:20:46 | FromDiscord | <heysokam> but do they have manually pushed releases? |
20:20:57 | FromDiscord | <Elegantbeef> No |
20:20:59 | FromDiscord | <heysokam> for some reason my packages don't get auto-updated, so was wondering why |
20:21:28 | FromDiscord | <Elegantbeef> `@#head` should fetch the head regardless if you have a tag |
20:21:36 | FromDiscord | <heysokam> yeah i do that |
20:21:42 | FromDiscord | <heysokam> but still happens, which is why i asked |
20:22:14 | FromDiscord | <Elegantbeef> I don't think `@#head` works with local |
20:22:41 | FromDiscord | <dersnof> In reply to @griffith1deadly "but it can also": what is diff between template and macro |
20:23:15 | FromDiscord | <Elegantbeef> A template is just code substitution, a macro evaluates code on the VM to mutate a passed in AST |
20:23:23 | FromDiscord | <griffith1deadly> In reply to @dersnof "what is diff between": templates allow you passing code block's to argument |
20:23:38 | FromDiscord | <Elegantbeef> Macros allow the same |
20:23:45 | FromDiscord | <griffith1deadly> ik |
20:23:52 | FromDiscord | <Elegantbeef> termer did you use graffiti for that release? 😄 |
20:24:01 | termer | What's that supposed to mean lol |
20:24:07 | termer | also I was about to thank you for the fix |
20:24:12 | FromDiscord | <Elegantbeef> Ah nah you didnt |
20:24:23 | FromDiscord | <Elegantbeef> graffiti is my automatic git tagger for nimble packages |
20:24:40 | FromDiscord | <Elegantbeef> I still need to collate the message like you have there |
20:24:42 | termer | I vaguely remember you mentioning it |
20:24:43 | FromDiscord | <dersnof> In reply to @Elegantbeef "Macros allow the same": aaand |
20:24:46 | FromDiscord | <dersnof> what is the difference |
20:24:52 | FromDiscord | <dersnof> where to use template, where to macro |
20:25:03 | termer | I think this repo is my most starred on GitHub despite definitely not being the most impressive |
20:25:10 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DZf |
20:25:14 | FromDiscord | <Elegantbeef> `graffiti ./bleh.nimble 0.1.2` would automatically create a tag, bump nimble, and push it for you |
20:25:28 | termer | cool |
20:25:29 | FromDiscord | <Elegantbeef> You use a template when you want code subsitution |
20:25:40 | FromDiscord | <Elegantbeef> You use a macro when you want code introspection |
20:26:04 | FromDiscord | <Elegantbeef> I still need to collect all commit messages to produce a nice release message 😄 |
20:26:39 | FromDiscord | <Elegantbeef> Right now if you use the bump version it just is "bump to version x" and if you do not use the bump version and just do `graffiti ./your.nimble` it uses the commit message of that manual bump |
20:27:08 | termer | That's handy |
20:27:27 | FromDiscord | <Elegantbeef> I know sokam wants the whole commit message setup, just havent got around to it |
20:30:46 | FromDiscord | <dersnof> sent a code paste, see https://play.nim-lang.org/#ix=4DZk |
20:30:54 | FromDiscord | <dersnof> (edit) "https://play.nim-lang.org/#ix=4DZk" => "https://play.nim-lang.org/#ix=4DZl" |
20:30:54 | FromDiscord | <dersnof> is this code gud |
20:31:10 | FromDiscord | <Elegantbeef> You're using a macro when a template suffices |
20:31:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DZm |
20:32:00 | FromDiscord | <dersnof> idk what is difference of macro and template lol |
20:32:31 | FromDiscord | <Elegantbeef> One is code substitution like C macros, the other is intropsection |
20:32:52 | FromDiscord | <dersnof> sent a code paste, see https://play.nim-lang.org/#ix=4DZn |
20:33:05 | FromDiscord | <dersnof> In reply to @Elegantbeef "One is code substitution": intropsection ? |
20:33:34 | FromDiscord | <Elegantbeef> Of course it errored I did a type and forgot the name of the template |
20:33:38 | FromDiscord | <Elegantbeef> typo\ |
20:34:07 | FromDiscord | <Elegantbeef> Introspection is the ability to look inside, macros can change their output depending on their input, templates cannot |
20:34:43 | FromDiscord | <dersnof> In reply to @Elegantbeef "Introspection is the ability": are there good guide about template and macros |
20:39:07 | termer | https://nim-lang.org/docs/tut2.html#templates |
20:40:51 | termer | There are few surprises with templates |
20:41:15 | termer | One thing to note about templates: they're sanitary, so variables inside of them don't leak outside the scope |
20:41:28 | termer | but you can inject them explicitly by annotating them with the {.inject.} pragma |
20:41:29 | FromDiscord | <etra> In reply to @odexine "And also that you": apparently `async_http_client` isn't thread safe? if I do one request in one thread, then send the struct to another thread, it raises with a dispatcher error |
20:41:43 | FromDiscord | <Elegantbeef> Or by explicitly giving them a name like done above |
20:41:58 | termer | that too |
20:42:16 | termer | etra, That's very possible |
20:42:49 | FromDiscord | <Elegantbeef> They have seperate dispatchers so moving a request across a thread is not as simple as just giving the future |
20:43:09 | termer | Oh yeah that's true lol I forgot |
20:43:33 | FromDiscord | <etra> In reply to @Elegantbeef "They have seperate dispatchers": no but I mean if I do a complete request, `waitFor`, then move the client, it raises too |
20:44:02 | termer | There may be some references to Futures in the other thread, not sure |
20:44:49 | FromDiscord | <dersnof> Wonder if we would rewrite Rust library Nim, would it speed up |
20:45:13 | FromDiscord | <Elegantbeef> Are you smarter than the Rust programmer? If so yes |
20:45:29 | FromDiscord | <Elegantbeef> When it comes to speed of system languages it's about the cleverness of the programmer and not the programming language |
20:46:14 | termer | Compiled languages USUALLY don't have an inherent "speed" |
20:46:19 | termer | unless you're talking about compilation speed |
20:46:40 | termer | If you have a perfectly good Rust library, why rewrite in Nim? |
20:46:50 | termer | the only reason to do that is if you want to also use it in Nim |
20:47:05 | termer | which, if you want to save effort, you could do in many cases by exporting C symbols and then creating a Nim wrapper |
20:52:26 | FromDiscord | <emanresu3> correct me if I'm wrong, but rust system libraries produce bigger files sizes than nim's, no?↵(<@709044657232936960_termer=5b=49=52=43=5d>) |
20:53:26 | FromDiscord | <dersnof> In reply to @Elegantbeef "When it comes to": Cleverness comes from born so… |
20:55:52 | FromDiscord | <Elegantbeef> Uhh |
20:56:10 | FromDiscord | <Elegantbeef> If that was the case I'd still shit my... ok never mind point stands |
20:57:25 | FromDiscord | <dersnof> In reply to @Elegantbeef "If that was the": Lol |
20:59:15 | FromDiscord | <heysokam> In reply to @dersnof "Wonder if we would": make some C ABI exports and then wrap those with nim. thats what https://github.com/heysokam/wgpu does, from the original C https://github.com/gfx-rs/wgpu-native/ that wraps https://github.com/gfx-rs/wgpu |
21:01:02 | * | disso-peach quit (Ping timeout: 246 seconds) |
21:06:09 | FromDiscord | <dersnof> hmm |
21:06:16 | FromDiscord | <dersnof> btw are there backend lib for Nim |
21:06:24 | FromDiscord | <dersnof> like Django for Python |
21:06:28 | FromDiscord | <etra> In reply to @etra "no but I mean": ok apparently it was a keep-alive issue, if I send it with `Connection: close` it works fine 😄 |
21:06:48 | FromDiscord | <heysokam> In reply to @dersnof "btw are there backend": backend as in? |
21:06:48 | FromDiscord | <griffith1deadly> In reply to @dersnof "btw are there backend": https://github.com/HapticX/happyx |
21:07:08 | FromDiscord | <heysokam> ah web framework |
21:07:29 | FromDiscord | <heysokam> yeah there are a couple. i don't know names. jester was one of them? 🤔 |
21:08:19 | FromDiscord | <dersnof> nice |
21:09:22 | FromDiscord | <Phil> `happyX` I haven't used yet but the library author looks like they're really putting some quality work in based on the presentation and brief skimming over stuff |
21:10:07 | FromDiscord | <Phil> It is more of a full-stack framework, meaning it'll also provide frontend-rendering-options, namely karax |
21:10:41 | FromDiscord | <Phil> prologue, mummy and jester are all options that are solely for the backend and do not provide a frontend.↵You'd need to wire one together yourself. |
21:10:59 | FromDiscord | <dersnof> interesting, Jester uses HttpBeast. so that means i can make my own Jester with HttpBeast |
21:11:02 | FromDiscord | <Phil> (edit) "yourself." => "yourself, but if you're using a JS framework anyway that's not much of a change." |
21:11:03 | FromDiscord | <dersnof> would be quite experience |
21:11:41 | FromDiscord | <dersnof> httpbeast is very simple lib though, it just gives simple http connection |
21:11:49 | FromDiscord | <dersnof> would be hard to build web framework with it |
21:12:25 | FromDiscord | <Phil> I'd have a chat with @guzba8 how the performance is compared to mummy, particularly in multi-threaded contexts. |
21:12:37 | FromDiscord | <Phil> (edit) "mummy," => "mummy if I were you in that case," |
21:12:44 | FromDiscord | <Phil> (edit) "I'd have a chat with @guzba8 how the performance ... is" added "of httpbeast" |
21:13:14 | FromDiscord | <dersnof> In reply to @isofruit "I'd have a chat": oh is he dev of mummy or smth ? |
21:13:19 | FromDiscord | <Phil> Pretty much |
21:14:09 | FromDiscord | <Phil> The reason I generally steer gently away from jester is because the lead dev is no longer an active nim member, so you're unlikely to sea any future goodies arise from it such as bugfixes. |
21:14:30 | FromDiscord | <dersnof> hmm can i make my own jester or smth |
21:15:15 | FromDiscord | <Phil> You can still use it perfectly fine for the next eternity basically, that thing is rather robust and nim doesn't change that much, I'd just view it as something that might lead you to limitations unless you take ownership of that codebase as well. |
21:15:27 | FromDiscord | <Phil> In reply to @dersnof "hmm can i make": That's always an option |
21:15:51 | FromDiscord | <Phil> Though generally I'm also in favour of improving what's there, rather than rewriting it all from the jump |
21:16:10 | FromDiscord | <dersnof> In reply to @isofruit "Though generally I'm also": Oh wym ? Like fork jester ? |
21:17:44 | FromDiscord | <Phil> That'd be an option.↵Or build something that has a similar/identical API to jester with mummy as the underlying server.↵Or contribute to prologue.↵Or build something that has a similar API to prologue with mummy as the underlying server. |
21:18:35 | FromDiscord | <dersnof> Ah jester but has mummy as server instead |
21:18:39 | FromDiscord | <dersnof> Wonder would it speed up |
21:19:23 | FromDiscord | <Phil> Or write plugins for any of the existing frameworks.↵Like providing an admin area the likes of Django (for prologue I've played around with something like that purely based on generics around the Models of norm). |
21:20:10 | FromDiscord | <Phil> In reply to @dersnof "Wonder would it speed": That I am not sure, thus I'd recommend having a chat with guzba to start getting into that topic and httpserver-performance characteristics 😄 |
21:21:35 | FromDiscord | <Phil> Another nice plugin idea would be to write some kind of mini-routing-framework for any of the servers for websocket messages.↵Basically implement a protocol that allows you to specify different kinds of JSON websocket messages and route them to "Handlers" which expect to receive websocket messages already parsed into a specific nim data type |
21:22:30 | FromDiscord | <Phil> Bonus points for some kind of validation on the server that for every "ReceivingWebsocketMessage"-type that exists the server has a message-handler registered |
21:22:51 | FromDiscord | <Phil> (edit) "Bonus points for some kind of validation ... on" added "at compile-time or on server start-up" |
21:23:33 | FromDiscord | <Phil> Triple bonus points if you can make the type for Websocket Messages that the server can send to the client also integrate nicely with karax |
21:24:39 | FromDiscord | <Phil> Other than that you could of course write a component library for karax the likes of bootstrap |
21:24:52 | FromDiscord | <Phil> (edit) "bootstrap" => "ng-bootstrap" |
21:25:06 | FromDiscord | <dersnof> nice idea |
21:25:24 | FromDiscord | <Phil> Okay I don't know what I've eaten today but the ideas for shit to work on kind of are just flowing out of me |
21:25:43 | FromDiscord | <Phil> Owlkettle widget library is the equivalent for that btw. |
21:25:47 | FromDiscord | <dersnof> yeah kind of nice lol |
21:25:51 | FromDiscord | <Phil> (edit) "Owlkettle widget library is the equivalent for that btw. ... " added "on native with GTK" |
21:26:19 | FromDiscord | <dersnof> i should read book about networking nowadays, to strengthen my networking knowledge |
21:28:19 | FromDiscord | <Phil> sent a long message, see http://ix.io/4DZy |
21:28:35 | FromDiscord | <Phil> (edit) "http://ix.io/4DZy" => "http://ix.io/4DZz" |
21:29:02 | FromDiscord | <Phil> (edit) "http://ix.io/4DZz" => "http://ix.io/4DZC" |
21:29:19 | FromDiscord | <Phil> Could implement acknowledge-messages that automatically get sent back and forth so that the user doesn't have to think about that |
21:29:38 | FromDiscord | <dersnof> what is acknowledge-messages ? |
21:29:56 | FromDiscord | <Phil> You know how with HTTP you always get a response when you make a request and thus can know when it is finished? |
21:30:28 | FromDiscord | <dersnof> yeah |
21:30:47 | FromDiscord | <Phil> Websocket messages don't have that, a message there is a one-way street.↵You basically can not know if the server received your message or not by default, you can only send.↵If you want to know that the server received your message, the server needs to implement that it sends you an "acknowledge" that it received the message of id blablabla |
21:32:08 | FromDiscord | <arathanis> does nim have logical shl? |
21:32:46 | FromDiscord | <Phil> Based on that acknowledge mechanism you could e.g. write a queue that stores messages that you are not sure if the server has received them.↵When you send a message it gets stored in the queue. ↵When the server sends an acknowledge it gets removed from the queue. ↵When a message is stored in the queue for more than X seconds you try to send it again until you get an acknowledge or a max amount of retries has happened, then you inform t |
21:33:04 | FromDiscord | <dersnof> In reply to @isofruit "Websocket messages don't have": ah |
21:33:22 | FromDiscord | <dersnof> its instant messaging |
21:33:30 | FromDiscord | <Phil> That but also much more |
21:33:40 | FromDiscord | <Phil> You can replace your entire HTTP layer with websocket messages |
21:33:48 | FromDiscord | <Phil> In fact treeform apparently likes to do so |
21:34:31 | FromDiscord | <Phil> Excerpt from their WS lib:↵> I love webSockets. They are easy to use and supported everywhere. I use them instead of HTTP REST APIs. I find it much easier to think in terms of client/server messages then verbs and resource paths. Inevitably you want the server to notify the client when some thing changes. Inevitably you will use webSockets. Then you will have two systems. Stop the pain and just use plain webSockets from the start. Say no t |
21:34:41 | FromDiscord | <Phil> (edit) "lib:↵>" => "lib README.md:↵>" |
21:35:48 | FromDiscord | <Phil> It's a pretty interesting idea and starts becoming really interesting once you have a central store in the frontend with its own centralized event-bus that informs the entire application on which events are currently happening. |
21:59:21 | termer | Phil, The annoying part of this is maintaining the websocket connection, and forgoing the ability to make one-shot requests |
21:59:34 | termer | The differentiator is whether you consider your website a fully interactive webapp or not |
22:00:06 | termer | I've written a few applications that use exclusively WebSocket for their communication, but those are applications with a ton of back-and-forth with many messages coming from the server |
22:01:05 | FromDiscord | <Phil> Absolutely, that was the vein I was thinking about, stuff like notifying users of recent updates that just happened etc. |
22:01:16 | FromDiscord | <Phil> (edit) "Absolutely, that was the vein I was thinking about, stuff like notifying users of recent updates that just happened ... etc." added "by another user, chat messages" |
22:01:36 | FromDiscord | <Elegantbeef> It also prevents easy usage in other places |
22:01:43 | termer | That's the big problem with it for me |
22:01:51 | termer | you can't just fire shit off with curl |
22:01:57 | termer | which is fine in certain circumstances |
22:02:12 | FromDiscord | <Phil> Doesn't change that it could be interesting to implement a lib to simplify setup and implementation |
22:02:28 | FromDiscord | <Phil> Which was what the topic originally was about, suggestions on what one could do |
22:03:04 | termer | websocket with protobuf |
22:03:09 | FromDiscord | <Elegantbeef> it's `shl`↵(@arathanis) |
22:03:18 | termer | or msgpack if you don't want to have to use complicated things |
22:10:03 | FromDiscord | <Phil> That sounds like some seriously high performance stuff that you could be doing with websockets |
22:10:20 | FromDiscord | <Phil> Like a monitoring board with tons of data on it that auto-updates or sth |
22:11:17 | termer | you could certainly do it |
22:11:31 | termer | WebSocket doesn't have much overhead over normal TCP sockets after the initial handshake |
22:12:07 | FromDiscord | <Phil> I'm aware, it was more the protobuf-bits that made me think of more throughput-heavy applications |
22:18:37 | FromDiscord | <Chronos [She/Her]> It wouldn't be too hard to make something to abstract over code for HTTP routes and WS API stuff, would it? |
22:18:58 | termer | Not hard |
22:19:06 | termer | but I don't like super proprietary schemes |
22:19:19 | FromDiscord | <Chronos [She/Her]> Proprietary? |
22:19:37 | FromDiscord | <Chronos [She/Her]> I don't get it in this context |
22:19:45 | FromDiscord | <Phil> Pretty sure he just means "non-standard" |
22:19:58 | FromDiscord | <Chronos [She/Her]> Ah |
22:20:03 | FromDiscord | <Phil> Or "they" rather |
22:20:10 | FromDiscord | <Chronos [She/Her]> Gucci |
22:22:59 | FromDiscord | <arathanis> In reply to @Elegantbeef "it's `shl` (<@136570191038513152>)": that seems to be bitwise shift left |
22:23:37 | FromDiscord | <arathanis> (edit) "bitwise" => "bitwise/arithmetic" |
22:23:59 | FromDiscord | <arathanis> it rotates the bits instead of zero padding like a logical leftshift |
22:24:49 | FromDiscord | <arathanis> https://media.discordapp.net/attachments/371759389889003532/1142584985778405426/image.png |
22:25:03 | FromDiscord | <arathanis> 1 lshl 65 should be 0 |
22:25:14 | FromDiscord | <arathanis> (edit) "1 lshl 65 should be 0 ... " added "in a 64-bit integer" |
22:31:24 | * | lucasta_ joined #nim |
22:34:15 | termer | I'm a he, you are free to refer to me as such |
22:34:25 | termer | And you're right, I mean mostly non-standard |
22:34:35 | termer | but particularly, something that's very language-oriented |
22:34:59 | termer | when things revolve around one language so heavily, making nice implementations in other languages can suck, or at least feel very unfamiliar |
23:01:09 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @arathanis "": Sounds like an actual bug |
23:01:29 | FromDiscord | <arathanis> this is pretty normal behavior for arithmetic aka bitwise shift |
23:01:50 | FromDiscord | <arathanis> i just figured there would be a logical counterpart |
23:02:01 | FromDiscord | <arathanis> but i cant seem to find one |
23:02:11 | FromDiscord | <System64 ~ Flandre Scarlet> shr gives you... 0 |
23:02:25 | FromDiscord | <arathanis> is shr doing logical shift...? u-u |
23:02:27 | FromDiscord | <arathanis> (edit) "u-u" => "u_u" |
23:02:47 | FromDiscord | <arathanis> oh god it is |
23:02:59 | FromDiscord | <arathanis> so shl is arithmetic and shr is logical???? |
23:03:06 | FromDiscord | <sirolaf> This is just what C does |
23:03:07 | FromDiscord | <arathanis> im not about that |
23:05:05 | FromDiscord | <odexine> shr has an arithmetic version |
23:05:19 | FromDiscord | <odexine> ashr is also in the standard library |
23:05:35 | FromDiscord | <arathanis> but does shl have a logical version? |
23:05:49 | FromDiscord | <arathanis> and maybe I am crazy but I would assume they would be the same... |
23:05:52 | FromDiscord | <odexine> Not that I know of |
23:06:01 | FromDiscord | <arathanis> so shl and shr would both be arithmetic or logical |
23:06:10 | FromDiscord | <odexine> I would say they are the same in behaviour |
23:06:12 | FromDiscord | <arathanis> and then either lshl and rshr or ashl and ashr would be the others |
23:06:24 | FromDiscord | <odexine> I mean logical and arithmetic shift left |
23:07:19 | FromDiscord | <arathanis> one truncates and the other rotates |
23:07:54 | FromDiscord | <arathanis> assuming 64-bit:↵1 lshl 65 == 0↵1 ashl 65 == 1 ashl 2 == 2 |
23:09:00 | FromDiscord | <arathanis> probably isnt too hard to roll your own lshl i guess. i just figured there would be one in there somewhere |
23:09:07 | FromDiscord | <arathanis> like even in std/bitops |
23:09:23 | FromDiscord | <odexine> Nim has rotate left in bitops |
23:09:49 | FromDiscord | <arathanis> ahh there it is |
23:10:41 | FromDiscord | <arathanis> shl: arithmetic left shirt↵shr: logical right shift↵ashr: arithmetic right shift↵std/bitops.rotateLeftBits: logical left shift |
23:11:55 | FromDiscord | <odexine> Shift left cannot make numbers 64 bit depending on how much it shifts because it would then depend on the possibly runtime data, and if it only does for static data then the logic would be inconsistent between static and runtime data |
23:58:02 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4E03 |
23:58:04 | FromDiscord | <etra> (edit) "https://play.nim-lang.org/#ix=4E03" => "https://paste.rs/tP6IF" |
23:58:44 | FromDiscord | <Elegantbeef> The issue is the `isolation` destructor |
23:58:58 | FromDiscord | <etra> (edit) "https://play.nim-lang.org/#ix=4E05" => "https://play.nim-lang.org/#ix=4E04" |
23:59:09 | FromDiscord | <Elegantbeef> It's not a big issue presently, but in the future destructors will likely be forced to be `{.raises: [].}` |