00:02:03 | FromDiscord | <Anonymous Poet> is there a way to get the nim compiler to print out the nim code in the final pass before converting it to c/c++? i know theres dumpAstGen, dumpTree, etc. but those arent the final asts. there might still be template rewriting, and macro expansion, etc. |
00:04:45 | FromDiscord | <Elegantbeef> there is `macros.expandMacros` |
00:04:56 | FromDiscord | <Elegantbeef> it takes in a typed AST so all expansions happen |
00:05:54 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=3CrP |
00:06:31 | FromDiscord | <Anonymous Poet> compiling with just `nim r file.nim` |
00:07:30 | FromDiscord | <Elegantbeef> Doesnt `r` hide compiler output? |
00:07:59 | FromDiscord | <Anonymous Poet> not sure, but `c` doesnt print anything either |
00:08:11 | FromDiscord | <Elegantbeef> I cannot compile that code so cannot help |
00:08:15 | FromDiscord | <Anonymous Poet> im concerned that `expandMacros` doesnt do anything if theres no macro in it |
00:10:05 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3CrT |
00:12:15 | FromDiscord | <Anonymous Poet> i dont understand why but now it works for my code too ... could it have been cached somehow? |
00:12:27 | FromDiscord | <Elegantbeef> Are you sure it's compiling again? |
00:12:30 | FromDiscord | <Elegantbeef> `nim c -f` |
00:13:04 | FromDiscord | <Anonymous Poet> i copied your playground snippet into a file, compiled that, saw the output, and then tried the same thing on my file, and got output, where before i wasnt (with the same compile command) |
00:14:07 | * | rockcavera joined #nim |
00:14:07 | * | rockcavera quit (Changing host) |
00:14:07 | * | rockcavera joined #nim |
00:16:03 | FromDiscord | <Anonymous Poet> very strange that this works ... i mustve been doing something wrong before. thank you! |
00:17:29 | FromDiscord | <Anonymous Poet> one more thing: when i use `--expandArc:myfunc` it produces an even-more expanded ast, but im not sure its still valid nim, ex `:tmpD` as a statement on a line by itself. do you know if theres a way to get the lifecycle hooks in my macro too? |
00:18:18 | FromDiscord | <Elegantbeef> Nope since your macro can completely change the output which means arc hasnt ran yet |
00:18:35 | FromDiscord | <Elegantbeef> Arc needs code it knows will be safe to insert it's destructors |
00:19:09 | FromDiscord | <Anonymous Poet> i see, thanks. that makes sense |
00:58:11 | FromDiscord | <deech> It seems shipping a Nim library with `exportc`d functions also requires bundling `nimbase.h`. Is there any way around this? |
00:58:51 | * | Gustavo6046 quit (Ping timeout: 245 seconds) |
00:58:54 | * | Gustavo6046_ joined #nim |
01:01:44 | * | Gustavo6046_ is now known as Gustavo6046 |
01:04:20 | FromDiscord | <Elegantbeef> I dont think treeform's genny does, could be wrong though |
01:04:46 | FromDiscord | <Elegantbeef> Though that's dynlib, i guess |
01:05:12 | FromDiscord | <Elegantbeef> Hurdur i'm a genius or something here |
01:09:29 | FromDiscord | <Elegantbeef> So I guess assuming you're using the generated C it's required |
01:11:31 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
01:13:02 | * | Gustavo6046 joined #nim |
01:19:45 | * | neurocyte0132889 quit (Ping timeout: 260 seconds) |
01:36:25 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Cs9 |
01:38:46 | FromDiscord | <geekrelief> if I swap `object | proc` for `typed` it compiles. |
01:43:47 | * | NimBot joined #nim |
01:44:21 | FromDiscord | <Elegantbeef> Can i see the object's declaration? |
01:44:59 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Csb |
01:45:25 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Csc |
01:46:17 | FromDiscord | <Elegantbeef> And macro usage? |
01:46:23 | FromDiscord | <geekrelief> sent a code paste, see https://paste.rs/G1y |
01:46:25 | FromDiscord | <Elegantbeef> There you go |
01:46:45 | FromDiscord | <geekrelief> I'm dumb.. what am I missing? |
01:47:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Cse |
01:47:29 | FromDiscord | <Elegantbeef> The descriminator is bound to the first type so it gets `init_i` and expects `tmPluginInitI` |
01:47:39 | FromDiscord | <Elegantbeef> You want `varargs[typed]` in this case |
01:47:46 | FromDiscord | <Elegantbeef> Then you check in the macro they're objects afaik |
01:47:51 | FromDiscord | <geekrelief> oh duh.. tm_plugin_init_i and tm_plugin_shutdown_i aren't from the same root |
01:48:22 | FromDiscord | <geekrelief> ok I guess there's no way around using `typed` |
01:48:49 | FromDiscord | <geekrelief> can using parameter constraints help? |
01:49:21 | FromDiscord | <geekrelief> I guess not since there's nothing for `object` |
01:51:43 | FromDiscord | <geekrelief> this is what I get for trying to get fancy for the wrong reason, nim has so many features to play with! |
02:05:28 | * | arkurious quit (Quit: Leaving) |
02:11:50 | FromDiscord | <ruki> Do you know how I should solve this problem? https://github.com/nim-lang/Nim/issues/19033 |
02:14:16 | FromDiscord | <geekrelief> this might be dumb, but did you try putting double quotes around the argument to `--passL:"-libpath:...."`? |
02:15:20 | FromDiscord | <geekrelief> for instance in my nimble file I use `--passC` like `"--passC:\"/wd4311 /wd4312 /wd4103 /wd4133 /wd4028\"" & ` |
02:15:24 | FromDiscord | <geekrelief> (edit) "/wd4028\"" & `" => "/wd4028\""`" |
02:28:30 | FromDiscord | <ruki> In reply to @geekrelief "this might be dumb,": I try it, it does not work. = = |
02:28:35 | * | LyndsySimon quit (Ping timeout: 264 seconds) |
02:28:46 | * | LyndsySimon joined #nim |
02:31:28 | FromDiscord | <geekrelief> what if you switch the '-libpath' with a '/libpath'? |
02:32:19 | FromDiscord | <geekrelief> https://docs.microsoft.com/en-us/cpp/build/reference/libpath-additional-libpath?view=msvc-160 |
02:32:40 | FromDiscord | <ruki> same problem |
02:33:38 | FromDiscord | <ruki> The problem is that vccexe passed the link flags to cl.exe, but cl.exe ignored them |
02:34:32 | FromDiscord | <ruki> sent a code paste, see https://play.nim-lang.org/#ix=3Csn |
02:35:04 | FromDiscord | <ruki> nim c --cc:vcc -d:release --nimcache:build\.gens\test\windows\x64\release\nimcache --passL:-libpath:build\windows\x64\release --passL:-lfoo -o:build\windows\x64\release\test.exe src\main.nim |
02:40:07 | FromDiscord | <geekrelief> seems like this error has been around a while https://forum.nim-lang.org/t/341 |
02:40:16 | FromDiscord | <geekrelief> There's gotta be a fix by now |
02:42:09 | FromDiscord | <ruki> oh, seems to be the same problem. |
02:42:40 | FromDiscord | <geekrelief> https://github.com/nim-lang/Nim/issues/8098 |
02:45:35 | FromDiscord | <ruki> This problem seems to exist for a long time, but it has not been fixed. 🙃 |
02:46:21 | FromDiscord | <geekrelief> well looks like you just volunteered 🙂 |
02:46:24 | FromDiscord | <geekrelief> j/k |
02:46:40 | FromDiscord | <ruki> I am very curious, now how nim links other static libraries on windows, this should be a basic feature. |
02:46:48 | FromDiscord | <geekrelief> I'm sure I'll run into this at some point too |
02:47:26 | FromDiscord | <geekrelief> In theory this should be a simple fix |
02:49:26 | FromDiscord | <Elegantbeef> I thought you just make an `.a` then link it with the compiler |
02:51:20 | FromDiscord | <ruki> .a? but it's windows library. |
02:51:51 | FromDiscord | <Elegantbeef> Thought`.a` is also used for windows static linking |
02:52:29 | FromDiscord | <geekrelief> just to double check did you try using `--clibdir`? |
02:55:22 | FromDiscord | <IsaacPaul> I'm trying to get some simple tests to run but keep running into an error: undeclared identifier: 'addTest' https://media.discordapp.net/attachments/371759389889003532/900940358995836968/Screen_Shot_2021-10-21_at_10.50.34_PM.png |
02:55:54 | FromDiscord | <Elegantbeef> have you exported `addTest`? |
02:55:55 | FromDiscord | <IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3Csq |
02:55:58 | FromDiscord | <Elegantbeef> You havent exported `addTest` |
02:56:08 | FromDiscord | <Elegantbeef> `addTest` |
02:56:21 | FromDiscord | <Elegantbeef> That'll export it, it's like a public accesor in other languages |
02:57:25 | FromDiscord | <IsaacPaul> ah that worked 🙃 |
02:57:54 | FromDiscord | <ruki> In reply to @geekrelief "just to double check": When I use it, I will encounter another problem. It cannot completely pass the relative path to the compiler and linker. It seems that it will be converted to an absolute path, but the path location is wrong. So I can only use --passC/--passL to pass the real relative path |
02:57:56 | FromDiscord | <geekrelief> `--clibdir` returns the same issue |
02:58:26 | * | Gustavo6046 quit (Ping timeout: 245 seconds) |
02:58:39 | * | Gustavo6046 joined #nim |
02:59:13 | * | Pyautogui joined #nim |
03:20:30 | * | Pyautogui quit (Ping timeout: 260 seconds) |
03:39:19 | * | Pyautogui joined #nim |
03:41:00 | Pyautogui | Noob Question: Why does strmisc have a expandTabs func, when the same effect could be achieved with the strutils replace? |
03:41:19 | * | Gustavo6046_ joined #nim |
03:42:13 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
03:43:32 | FromDiscord | <Elegantbeef> I think it's to reduce module dependencies and cyclical logic |
03:44:34 | * | Gustavo6046_ is now known as Gustavo6046 |
03:48:01 | Pyautogui | The module dependencies reduction makes. I have never heard the term "cyclical logic" in connection with programming. Google just brings up circular reasoning. What does it mean in this context? |
03:48:24 | Pyautogui | Edit: "makes sense" |
03:49:20 | FromDiscord | <Elegantbeef> Cyclical dependancies mostly |
03:49:45 | Pyautogui | Got it, thanks. |
03:56:22 | FromDiscord | <geekrelief> In reply to @ruki "When I use it,": probably need to modify this https://github.com/nim-lang/Nim/blob/5e2b9341f343c3f80f92cfd160a0186f23521a42/tools/vccexe/vccexe.nim#L163-L169 |
03:59:13 | * | Pyautogui quit (Quit: Connection closed) |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:31 | * | supakeen joined #nim |
04:10:46 | * | tiorock joined #nim |
04:10:46 | * | tiorock quit (Changing host) |
04:10:46 | * | tiorock joined #nim |
04:10:46 | * | rockcavera is now known as Guest7704 |
04:10:46 | * | Guest7704 quit (Killed (tungsten.libera.chat (Nickname regained by services))) |
04:10:46 | * | tiorock is now known as rockcavera |
04:12:34 | * | tiorock joined #nim |
04:12:34 | * | tiorock quit (Changing host) |
04:12:34 | * | tiorock joined #nim |
04:12:34 | * | rockcavera quit (Killed (sodium.libera.chat (Nickname regained by services))) |
04:12:34 | * | tiorock is now known as rockcavera |
04:12:58 | FromDiscord | <ruki> In reply to @geekrelief "probably need to modify": oh thanks |
04:18:08 | * | tiorock joined #nim |
04:18:08 | * | tiorock quit (Changing host) |
04:18:08 | * | tiorock joined #nim |
04:18:08 | * | rockcavera is now known as Guest5938 |
04:18:08 | * | tiorock is now known as rockcavera |
04:19:06 | * | Guest5938 quit (Ping timeout: 260 seconds) |
04:27:48 | FromDiscord | <Tunnel> sent a code paste, see https://play.nim-lang.org/#ix=3CsB |
04:28:39 | FromDiscord | <Elegantbeef> `exportC`? |
04:29:12 | * | rockcavera quit (Remote host closed the connection) |
04:31:33 | FromDiscord | <Elegantbeef> You can also look at the `emit` pragma https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma |
04:31:47 | FromDiscord | <Tunnel> sent a code paste, see https://play.nim-lang.org/#ix=3CsC |
04:32:20 | FromDiscord | <Elegantbeef> what's `goto` defined as? |
04:32:27 | FromDiscord | <Tunnel> nothing? |
04:32:41 | FromDiscord | <Elegantbeef> Why not import the procedure than? |
04:33:08 | FromDiscord | <Tunnel> I think I follow now, but why would newPage work, and "otherSymbol" work, but goto gets mangled? |
04:34:08 | FromDiscord | <Elegantbeef> what's newPage defined as? |
04:34:16 | FromDiscord | <Tunnel> nothing as well |
04:34:23 | FromDiscord | <Elegantbeef> Uhh |
04:34:31 | FromDiscord | <Tunnel> sent a code paste, see https://play.nim-lang.org/#ix=3CsD |
04:34:46 | FromDiscord | <Tunnel> well I was adding my attempt at the goto proc, ignore that line... |
04:37:28 | FromDiscord | <Elegantbeef> Oh this is using js magic i see |
04:37:35 | FromDiscord | <Elegantbeef> does the `std/asyncjs` `await` not work here? |
04:37:59 | FromDiscord | <Tunnel> await expects a Future[T], and I havent figured out how to make jsobject into that. |
04:41:26 | FromDiscord | <Elegantbeef> Hmm the macros do cause some weird behaviour, i'll see if i can figure it out |
04:52:43 | FromDiscord | <Elegantbeef> Ah i found the issue `https://github.com/nim-lang/Nim/blob/version-1-6/lib/js/jsffi.nim#L50` goto is in a reservedWords list |
04:53:05 | FromDiscord | <Tunnel> I had just noticed that too. I'm not sure I understand why that is a thing though. |
04:53:27 | FromDiscord | <Elegantbeef> It's to avoid using keywords as procedures and the like i believe |
04:53:59 | FromDiscord | <Elegantbeef> `function for(){ console.log("hello");}` is invalid for instance |
04:54:09 | FromDiscord | <Tunnel> but that doesn't seem to be an issue to do on purpose though. Since Puppeteer seems to break that rule. |
04:54:14 | FromDiscord | <ruki> In reply to @geekrelief "probably need to modify": I have solved this problem, Thanks! 😀 https://github.com/nim-lang/Nim/issues/19033#issuecomment-949285922 |
04:54:32 | FromDiscord | <Elegantbeef> Some words in that list might not be actually restricted |
04:56:01 | FromDiscord | <geekrelief> In reply to @ruki "I have solved this": nice 🙂 |
04:56:45 | FromDiscord | <Tunnel> "removed from ecma 5/6 standard" https://www.w3schools.com/js/js_reserved.asp Seems like it is sometimes a restricted keyword... |
04:57:23 | FromDiscord | <geekrelief> In reply to @geekrelief "nice 🙂": I wonder if the link flags are guaranteed to always be at the end |
04:57:58 | FromDiscord | <geekrelief> In reply to @ruki "I have solved this": Do we know if the links flags are always at the end? |
04:58:26 | FromDiscord | <Elegantbeef> It's not ideal tunnel but https://play.nim-lang.org/#ix=3CsF |
04:58:39 | FromDiscord | <Elegantbeef> I'd suggest making a PR for removing it though |
05:00:05 | * | mahlon quit (Ping timeout: 258 seconds) |
05:00:44 | FromDiscord | <Tunnel> I thought about that, but does nim intentionally target pre 5/6? Directly removing it might break that compatibility. |
05:02:37 | FromDiscord | <Elegantbeef> Think it targets es3 |
05:02:58 | FromDiscord | <Elegantbeef> So yea maybe just an optional overridemangle parameter |
05:04:37 | FromDiscord | <Rika> Nim targets es3 |
05:05:02 | * | mahlon joined #nim |
05:07:02 | FromDiscord | <ruki> In reply to @geekrelief "Do we know if": I will sort them and put all --passL in tail |
05:07:07 | FromDiscord | <ruki> https://github.com/xmake-io/xmake/blob/62d3e0c681f25cb48560d07461a92738b55a0b6d/xmake/rules/nim/xmake.lua#L133-L150 |
05:07:07 | FromDiscord | <Tunnel> Thanks for the help! The problem seems to be resolved for now at the very least. |
05:07:54 | FromDiscord | <geekrelief> In reply to @ruki "I will sort them": cool |
05:10:05 | FromDiscord | <OceanMongrel> proc func |
05:13:26 | * | Gustavo6046 quit (Ping timeout: 245 seconds) |
05:14:17 | * | Gustavo6046 joined #nim |
05:17:46 | FromDiscord | <geekrelief> In reply to @ruki "I will sort them": Seems like putting `--passL:/link` in front should do it, no need to sort. I tried changing the order of my arguments to `nim` and it compiled fine. |
05:19:28 | FromDiscord | <ruki> In reply to @geekrelief "Seems like putting `--passL:/link`": But there are some compile flags, not link flags. I need to submit the compiled flags in front of --passL:-link |
05:19:36 | FromDiscord | <ruki> e.g. --passC:xx |
05:19:50 | FromDiscord | <geekrelief> I'm using -passC too |
05:19:57 | FromDiscord | <geekrelief> I have a bunch of warnings I disable |
05:20:23 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3CsK |
05:20:39 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3CsL |
05:20:42 | FromDiscord | <geekrelief> so passL is in front of passC |
05:21:12 | FromDiscord | <geekrelief> anyway, just fyi |
05:22:50 | FromDiscord | <ruki> ok |
05:33:44 | * | Gustavo6046_ joined #nim |
05:33:44 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
05:36:32 | * | Gustavo6046_ is now known as Gustavo6046 |
05:39:19 | NimEventer | New thread by Gblbaozi: How to send a command to cmd.exe, see https://forum.nim-lang.org/t/8530 |
06:11:37 | * | pro joined #nim |
06:22:04 | FromDiscord | <soupayan> any good resource from where i can learn metaprogrammimg using nim? |
06:23:51 | nrds | <Prestige99> https://dev.to/beef331/demystification-of-macros-in-nim-13n8 is good to learn macros |
06:26:07 | FromDiscord | <Elegantbeef> Dont say that might go to the authors head |
06:32:14 | FromDiscord | <Rika> Fuck you beef |
06:32:18 | FromDiscord | <Rika> Your shit is awful |
06:32:24 | FromDiscord | <Rika> Is that good enough to mitigate that issue |
06:42:42 | FromDiscord | <Elegantbeef> Rika with all the new users you need to say jk 😛 |
06:43:04 | FromDiscord | <evoalg> nim 1.6 ... when I compile, I get Hints of unused variable twice each, why would that be? |
06:43:29 | FromDiscord | <Elegantbeef> Variables are unused |
06:44:04 | FromDiscord | <evoalg> I mean instead of once each, I get it twice each, exactly the same part of the code |
06:44:37 | FromDiscord | <Elegantbeef> Can you reproduce on playground? |
06:45:06 | FromDiscord | <evoalg> "test16.nim(15, 7) Hint: 'a' is declared but not used [XDeclaredButNotUsed]" and then other "test16.nim(15, 7) Hint: 'a' is declared but not used [XDeclaredButNotUsed]".↵How do I use playground? (sorry I'm quite new) |
06:45:21 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/ |
06:47:10 | FromDiscord | <Smarc> sent a long message, see http://ix.io/3CsW |
06:48:15 | FromDiscord | <evoalg> In reply to @Elegantbeef "https://play.nim-lang.org/": oh it's only when I use "import timeit" .... |
06:49:21 | FromDiscord | <evoalg> (edit) "...." => "....↵eg:↵echo timeGo do:↵ var a = 1" |
06:50:09 | FromDiscord | <geekrelief> In reply to @Smarc "Hey party people, here": I think this is what you're looking for https://nim-lang.github.io/Nim/manual.html#procedures-var-parameters |
06:52:00 | FromDiscord | <Elegantbeef> Does timeit take typed code? |
06:53:04 | FromDiscord | <Elegantbeef> rather `timeGo` |
06:54:07 | FromDiscord | <Rika> In reply to @Smarc "Hey party people, here": There’s no concept of modules after you compile afaik |
06:57:01 | FromDiscord | <evoalg> In reply to @Elegantbeef "rather `timeGo`": timeGo runs fine on my computer, but on playground it doesn't seem to work ... I'm not sure what you mean by typed code |
06:58:10 | FromDiscord | <geekrelief> In reply to @Smarc "Hey party people, here": Are you saying you want to modify the array C at compile time? |
06:58:10 | FromDiscord | <Elegantbeef> Macros can take `typed` and `untyped` code typed is semantically checked so has to be valid, and untyped is parsed but unchecked |
06:59:06 | FromDiscord | <geekrelief> (edit) "In reply to @Smarc "Hey party people, here": Are you saying you want to modify the array C at compile time? ... " added "Maybe a combination of `static` with `var` parameter to set array C?" |
06:59:28 | FromDiscord | <Elegantbeef> But it takes untyped, so i dont get what the macro is doing |
06:59:41 | FromDiscord | <geekrelief> (edit) "In reply to @Smarc "Hey party people, here": Are you saying you want to modify the array C at compile time? Maybe a combination of `static` with `var` parameter to set array C? ... " added "or just return the new array instead of using var parameter." |
06:59:47 | FromDiscord | <Elegantbeef> Smarc i'd suggest making an example and sharing it, it's unclear what you're after to me 😀 |
07:01:22 | FromDiscord | <Smarc> In reply to @geekrelief "Are you saying you": `var` parameters did exactly what I wanted to do, thank you! |
07:04:49 | FromDiscord | <evoalg> In reply to @Elegantbeef "Macros can take `typed`": Thank you |
07:08:13 | FromDiscord | <that_dude> I was looking at the 1.6 changelog, and I was wondering, what's the difference between `import foo {.all.}` and `include foo`? |
07:12:27 | FromDiscord | <geekrelief> In reply to @that_dude "I was looking at": just a guess, but `include foo` is a basically inserted so any imports would be brought into your module, while `import foo {.all.}` probably wouldn't bring any imports in. I would have to test this to confirm it. |
07:13:06 | FromDiscord | <Elegantbeef> That's be my assumption aswell |
07:13:26 | FromDiscord | <that_dude> Ah so include also imports all of `foo`s dependencies as well. Got it |
07:15:40 | FromDiscord | <konsumlamm> include just copy pastes the module |
07:17:14 | FromDiscord | <geekrelief> Yeah I just tested it, and `{.all.}` doesn't bring in imports. |
07:18:05 | pro | is it possible that one process appends to file, while another process is reading the first line of the same file and consuming it (deleting it) without changing the rest of the file |
07:28:44 | * | PMunch joined #nim |
07:28:52 | * | PMunch quit (Client Quit) |
07:29:08 | * | PMunch joined #nim |
07:35:18 | FromDiscord | <Smarc> Is it possible to create an object without explicitly naming the arguments? I mean writing Name(x, y) instead of Name(par1: x, par2: y) |
07:37:05 | FromDiscord | <Rika> Create a proc for it |
07:37:12 | FromDiscord | <Rika> That is the common convention |
07:37:36 | FromDiscord | <Rika> initType for objects, newType for reference objects |
07:38:29 | FromDiscord | <that_dude> I still want to complain that object initialization uses `:` to set its values despite nim using `=` everywhere else to set values and `:` to define type (afaik) |
07:38:46 | FromDiscord | <Rika> No comment |
07:40:11 | FromDiscord | <Rika> It’s not a change that can be done anymore without a version 2 |
07:40:38 | FromDiscord | <that_dude> ik :( |
07:40:48 | FromDiscord | <that_dude> Here's to me hoping it will happen in v2 |
07:40:58 | FromDiscord | <Rika> Just wait for the more unified initialisation RFCs to pass |
07:41:02 | FromDiscord | <Elegantbeef> I mean using procs works well so idk |
07:42:43 | FromDiscord | <that_dude> Yeah, but I find it just hides the issue. And often I don't want to make a proc whos purpose is nothing but to copy and paste the values with no changes. If I wanted to also add defaults, then sure, but often I don't need them |
07:43:43 | FromDiscord | <Elegantbeef> My view is constructors always suck |
07:44:05 | FromDiscord | <that_dude> Really? |
07:44:19 | FromDiscord | <that_dude> What about working with defaults? |
07:44:57 | FromDiscord | <Elegantbeef> doing `YourType(x: x, y: y)` is tedious so is `proc initYourType(x: XType, y: YType): YourType = YourType(x: x, y: y)` |
07:45:06 | FromDiscord | <Elegantbeef> I'm not talking about their existence just the syntax |
07:45:43 | FromDiscord | <Elegantbeef> Nowadays I think something like https://github.com/beef331/constructor#constructor-1 is idea, but who knows what i'll think later |
07:46:00 | FromDiscord | <Elegantbeef> ideal\ |
07:47:16 | FromDiscord | <Rika> Not sure if I like how you use “let” instead of “result.” for defaults… |
07:47:27 | FromDiscord | <that_dude> Cheers to that, I do like that a lot more. |
07:48:05 | FromDiscord | <that_dude> In reply to @Rika "Not sure if I": It uses the implicit result in there instead |
07:48:21 | FromDiscord | <that_dude> from what I can see |
07:48:32 | FromDiscord | <Elegantbeef> Nah it emits a constructor at the end iirc |
07:48:59 | FromDiscord | <that_dude> I was wondering, I see the let in there, does that make the object immutable? |
07:49:00 | FromDiscord | <Rika> I mean the macro syntax |
07:49:19 | FromDiscord | <that_dude> that field I mean |
07:49:43 | FromDiscord | <Elegantbeef> Nope `let` is just demonstrating that you can get values at runtime |
07:49:53 | FromDiscord | <that_dude> Got it |
07:50:03 | FromDiscord | <Rika> I think it’s better if the body wasn’t a scuffed DSL and was just a “this part is inserted after the macro-created body” |
07:50:27 | FromDiscord | <Elegantbeef> Yea that could work |
07:56:36 | FromDiscord | <Elegantbeef> Anywho i'm still actively trying to think of better ways of making constructors cause i really dislike all present versions 😀 |
07:56:59 | FromDiscord | <that_dude> What's wrong with them? |
07:57:29 | FromDiscord | <Elegantbeef> Generally tedious or just annoy me to write |
07:57:59 | FromDiscord | <that_dude> Even with your package |
07:58:02 | FromDiscord | <that_dude> ? |
07:58:29 | FromDiscord | <that_dude> Because tbh it seems pretty good, I'm struggling to find issues/disagreements |
07:58:53 | FromDiscord | <Elegantbeef> Well it makes it less annoying but i'm an idiot that's hesitant to bring in dependencies |
07:59:53 | FromDiscord | <Elegantbeef> Constructors are such a small portion of code that it seems comical to pull in a dependancy to just make a constructor 😀 |
07:59:58 | FromDiscord | <that_dude> Ah. I'm a "As long as it doesn't crash and works as expected, I don't mind a minor size and performance hit" kinda guy |
08:00:10 | FromDiscord | <Elegantbeef> Well it doesnt effect either of those |
08:00:22 | FromDiscord | <that_dude> In which case why not just use it. |
08:00:30 | FromDiscord | <Elegantbeef> It's more just in most cases in the time i add the dependancy i could've made the constructor |
08:01:03 | FromDiscord | <Elegantbeef> I have to go get the version i have it pinned, put it in the nimble file, add the import, then make the constructor |
08:01:22 | FromDiscord | <that_dude> I made this thing because I needed better switches and counters for a program that has a gui https://github.com/XDEmer0r-L0rd-360-G0d-SlayerXD/NimCounter |
08:01:51 | FromDiscord | <that_dude> It's the most trivial thing ever, but I'm lazy and I did the work once already |
08:01:54 | FromDiscord | <Elegantbeef> `clear` should be `.setLen(0)` |
08:02:24 | FromDiscord | <that_dude> Is what I currently have bad? |
08:02:27 | FromDiscord | <Elegantbeef> `@[]` allocates a new sequence so you lose all that capacity you had |
08:02:35 | FromDiscord | <that_dude> ah |
08:03:04 | FromDiscord | <Elegantbeef> Isnt this an elaborate `CountTable[string]`? |
08:03:22 | FromDiscord | <that_dude> Hold up let me look that up lol |
08:03:39 | FromDiscord | <Elegantbeef> It's a table that goes string -\> int |
08:03:49 | FromDiscord | <that_dude> Damn lol yeah |
08:04:14 | FromDiscord | <that_dude> Well my initial purpose was for the single version so I can use it as switches. The multi was and after thought lol |
08:04:17 | FromDiscord | <Elegantbeef> `yourTable.inc("someString")` will add `"someString"` and make it `1` |
08:05:21 | FromDiscord | <that_dude> I was 90% what I did already existed so that's why I haven't messed with posting it in nimble |
08:06:09 | FromDiscord | <Elegantbeef> Well another note is you've mad an alias which isnt distinctly typed, so any `seq[string]` can use these procs |
08:06:12 | FromDiscord | <Elegantbeef> Which could be desired, but idk |
08:07:14 | FromDiscord | <Elegantbeef> Probably should ask if people want me to comment on their code instead of just doing it |
08:07:22 | FromDiscord | <that_dude> Who am I to take away possible niche functionality |
08:07:35 | FromDiscord | <that_dude> Nah I'm happy for it. I learned like 3 things already |
08:09:55 | FromDiscord | <Elegantbeef> Just to show you how you might do this if you want an object to be a type but not type match for it https://play.nim-lang.org/#ix=3Ctd |
08:09:56 | NimEventer | New Nimble package! dslutils - A macro collection for creating DSL in nim, see https://github.com/codehz/dslutils |
08:11:22 | FromDiscord | <Elegantbeef> There are some bugs with distinct but i've got some PRs for some of those issues, though there are still others 😀 |
08:11:56 | FromDiscord | <that_dude> Tbh I've known for a while that distinct exists, but I've like the ability to be lazy and just it work itself out |
08:12:30 | FromDiscord | <that_dude> That way I can still use normal procs I don't want to bother to impliment or somethnig |
08:13:26 | FromDiscord | <that_dude> Quite often I find that there is no need to remove features when it has little effect on the complexity |
08:14:00 | FromDiscord | <Elegantbeef> Yea i was just mentioning it cause some people act like distinct and type aliases are the same \:D |
08:14:42 | FromDiscord | <that_dude> That's why each type has exactly 4 procs with the same name that are intended to kinda mirror each other |
08:16:37 | FromDiscord | <that_dude> I guess I've never seen the need for distinct in the things I do because I don't really need a name that much that I want to overwrite the builtin |
08:24:05 | * | pro quit (Quit: WeeChat 3.3) |
08:56:07 | * | Vladar joined #nim |
08:56:55 | FromDiscord | <dilawar (Dilawar Singh)> Is there a way to pass the C compiler path to nim directly e.g. `nim c --some_cc_opt:/mingw64/bin/gcc.exe foo.nim`. Following works on bash like shell `CC=/mingw64/bin/gcc.exe nim c --cc:env foo.nim` but it is not very portable (inside cmake `add_custom_command` which may be executed with `cmd.exe` or `pwsh.exe`). |
08:57:12 | FromDiscord | <dilawar (Dilawar Singh)> The last resort would be to write a wrapper script 😟 |
08:57:48 | FromDiscord | <dilawar (Dilawar Singh)> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/901031353036976148): Is there a way to pass the C compiler path to nim directly e.g. `nim c --some_cc_opt:/mingw64/bin/gcc.exe foo.nim`?↵↵Following works on bash like shell `CC=/mingw64/bin/gcc.exe nim c --cc:env foo.nim` but it is not very portable (inside cmake `add_custom_command` which may be executed with `cmd.exe` or `pwsh.exe`). |
09:00:45 | FromDiscord | <Elegantbeef> I think the general way of doing it is making a shell script which invokes the compiler |
09:05:20 | FromDiscord | <dilawar (Dilawar Singh)> @elegantbeef\:matrix.org You may be right. Unfortunately add\_custom\_command does not copy parent process ENVs (https://stackoverflow.com/questions/35029277/how-to-modify-environment-variables-passed-to-custom-cmake-target/35032051) |
09:07:06 | FromDiscord | <Elegantbeef> Yea i dont know the best way here, so i can only say good luck |
09:14:57 | FromDiscord | <dilawar (Dilawar Singh)> Hmm. Not sure if it is worth asking it as a feature request on nim Github/forum. May be a useful feature in the universe of build environments!! Anyway, custom script it is. |
09:35:26 | PMunch | IIRC Nim does some extra choices when you choose the compiler, not only which binary to build with |
09:47:53 | FromDiscord | <dilawar (Dilawar Singh)> @\_discord\_709044657232936960\_=50=4dunch=5b=49=52=43=5d\:t2bot.io You are right. You can choose gcc, llvm etc but not the full path |
09:48:12 | FromDiscord | <dilawar (Dilawar Singh)> its finds the binary for you. Most of the time it does a pretty good job |
09:49:28 | FromDiscord | <dilawar (Dilawar Singh)> I got into one corner case where I am using msys+mingw and visual studio to build the whole system. Its a nightmare. And not to mention, on CI environment things are installed at non-standard places.. |
10:02:50 | FromDiscord | <dilawar (Dilawar Singh)> In python, `sys.executable` in a script returns the path of the python interpreter. What is nim equivalent? |
10:05:07 | FromDiscord | <Rika> You cannot reliably do soafaik |
10:05:11 | FromDiscord | <Rika> (edit) "soafaik" => "so afaik" |
10:11:31 | * | madprops quit (Ping timeout: 268 seconds) |
10:12:53 | * | aaaaaaaaaa joined #nim |
10:14:47 | FromDiscord | <Rika> https://nim-lang.org/docs/os.html#getAppFilename |
10:14:50 | FromDiscord | <Rika> Maybe |
10:19:34 | NimEventer | New question by Dilawar: What is nim's equivalent of Python's `sys.executable`?, see https://stackoverflow.com/questions/69675173/what-is-nims-equivalent-of-pythons-sys-executable |
10:20:23 | * | Vladar quit (Remote host closed the connection) |
10:20:55 | FromDiscord | <dilawar (Dilawar Singh)> Thanks. https://nim-lang.org/docs/os.html#getCurrentCompilerExe also looks promising.↵(@Rika) |
10:21:05 | FromDiscord | <Rika> That is the compiler |
10:21:14 | FromDiscord | <Rika> Do you want the running program or the compiler |
10:21:21 | FromDiscord | <Rika> And what for |
10:22:50 | FromDiscord | <dilawar (Dilawar Singh)> Both are same the same at compile time. |
10:23:10 | FromDiscord | <dilawar (Dilawar Singh)> At compile time, both are the same. Thanks for the help. |
10:26:01 | FromDiscord | <dilawar (Dilawar Singh)> I am working with `nimscript`. I should have been clearer. |
10:27:34 | FromDiscord | <Yardanico> In reply to @dilawar (Dilawar Singh) "I am working with": oh |
10:30:23 | FromDiscord | <Yardanico> btw, out of curiosity, any reason you're using nimscript? :P |
10:30:40 | FromDiscord | <Yardanico> no i mean it's fine, just curious why you're trying out nimscript first |
10:31:21 | FromDiscord | <dilawar (Dilawar Singh)> I don't want to learn PowerShell and python is part of development stack.. A good excuse to get into nim. |
10:33:13 | FromDiscord | <Yardanico> well, you can use Nim itself as kind of a scripting language easily |
10:33:18 | FromDiscord | <Yardanico> quite a lot of people do just that |
10:33:42 | FromDiscord | <Yardanico> and Nimscript is really just Nim, if you're worrying about the static typing - NimScript is also statically typedf |
10:33:44 | FromDiscord | <Yardanico> (edit) "typedf" => "typed" |
10:41:15 | FromDiscord | <dilawar (Dilawar Singh)> @\_discord\_177365113899057152\:t2bot.io Ah, I see. I got the impression that for scripting, `nimscript` is the way. |
10:49:08 | * | neurocyte0132889 joined #nim |
10:49:08 | * | neurocyte0132889 quit (Changing host) |
10:49:08 | * | neurocyte0132889 joined #nim |
10:51:51 | PMunch | Not really, Nim itself can be used for scripting just fine |
10:52:10 | PMunch | You might want to check out nimcr for an easier way to run your scripts as well |
10:52:31 | PMunch | Oh wait, you mentioned Powershell, so I guess your on Windows.. |
10:52:34 | PMunch | Might not work then |
10:54:07 | FromDiscord | <Jan81> I would love using a language go write apps and also write basic scripts in 🙂 thats why im learning nim as well! I hate using powershell for this, bash for that, python for another |
11:00:12 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
11:03:21 | * | Gustavo6046 joined #nim |
11:10:39 | FromDiscord | <dilawar (Dilawar Singh)> "I hate using powershell for this, bash for that, python for another so decided to use NIM" would make a good manga! |
11:13:38 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3Cu3 |
11:13:55 | FromDiscord | <Rika> No |
11:14:21 | FromDiscord | <Smarc> So then whats the Nim way to solve this? Please don't say don't use inheritance :P |
11:14:46 | FromDiscord | <Rika> If I cannot say that then my answer is “deal with it” |
11:14:57 | FromDiscord | <Rika> Or wait do you not know of the “of” operator |
11:15:02 | FromDiscord | <Yardanico> @Smarc i guess you can write a macro that will convert this to if/elif with `of` |
11:15:04 | FromDiscord | <Rika> “if animal of Cat” |
11:15:15 | FromDiscord | <Yardanico> if you want to use case statements |
11:15:31 | FromDiscord | <Rika> In reply to @Yardanico "<@!218712890780155915> i guess you": Ah case statement macros yeah those are new |
11:15:38 | FromDiscord | <Smarc> okay i figured that, so a usual if/elif statement with of operator is the way to go in this case? |
11:16:00 | FromDiscord | <Rika> If you don’t wanna make a macro yeah |
11:16:20 | FromDiscord | <Smarc> haven't dabbled into macros yet, but i'll look into it! Thank you guys once again |
11:21:56 | * | PMunch quit (Quit: Leaving) |
11:30:38 | arkanoid | I'm experimenting with nimpy, I want to try compiling a static executable that embeds python (limited to builtin modules to make things easier). It should be possible as my ubuntu box ships with "/usr/lib/x86_64-linux-gnu/libpython3.8.a" |
11:31:40 | FromDiscord | <Yardanico> well, the problem is that nimpy only supports dynamic loading of libpython so you'll have to modify it for static linking |
11:32:14 | arkanoid | problem is that according to /proc/<pid>/maps the .so keeps being loaded even when using this config.nims: https://termbin.com/wp3i |
11:32:38 | arkanoid | oh, ok |
11:32:38 | FromDiscord | <Yardanico> yes, as I said |
11:32:46 | FromDiscord | <Yardanico> nimpy doesn't use dynlib, it loads the python libs by itself |
11:32:50 | FromDiscord | <Yardanico> so you'll have to modify it |
11:32:54 | arkanoid | not even dynlibOverride can bypass nimpy logic? |
11:33:03 | arkanoid | ok |
11:33:11 | FromDiscord | <Yardanico> no, dynlibOverride is only for when the library is using the `dynlib` pragma |
11:33:17 | FromDiscord | <Yardanico> for loading dynamic libraries |
11:33:25 | arkanoid | why nimpy went the non-nim way? |
11:34:00 | FromDiscord | <Yardanico> eh, it's not a "non-nim" way, and checking nimpy source code it seems to do that because python has a lot of versions, y'know :) |
11:36:33 | arkanoid | Yeah I see it uses loadLib directly https://nim-lang.org/docs/dynlib.html#loadLib |
11:37:30 | FromDiscord | <Yardanico> if you check py_lib.nim you can see it has some checks for different versions that have different symbols or don't have some of them at all |
11:37:57 | FromDiscord | <Yardanico> i think it shouldn't too hard to modify nimpy for a static compilation, but you'll have to hardcode it to the python version you're using |
11:38:10 | FromDiscord | <Yardanico> also, why not just ship libpython with your app? |
11:38:50 | arkanoid | you mean ship the dll/so with my nim executable? |
11:38:54 | FromDiscord | <Yardanico> yes |
11:38:59 | FromDiscord | <Yardanico> if you want a "single file binary" on linux, you can just use AppImage for example |
11:39:17 | FromDiscord | <Yardanico> and on windows you usually create installers, or in the worst case you can use tools like Enigma VirtualBox that pack whole folders into a single exe |
11:39:31 | FromDiscord | <Yardanico> and honestly python is almost universally available on linux distros |
11:39:40 | FromDiscord | <Yardanico> the version might differ though |
11:39:43 | arkanoid | well for windows should be possible as exec folder is in dyn loader search path, but that's not true for linux |
11:40:10 | FromDiscord | <Yardanico> but you can just use https://github.com/yglukhov/nimpy/blob/master/nimpy/py_lib.nim#L471 |
11:41:16 | arkanoid | cool! |
11:42:20 | FromDiscord | <Yardanico> `pyInitLibPath(getAppDir() / "libpython3.8.so")` or something like that |
11:42:29 | FromDiscord | <Yardanico> assuming you did `import std/os` for the `/` |
11:42:51 | FromDiscord | <evoalg> In reply to @Yardanico "<@!218712890780155915> i guess you": Quick noob question about that: in general for nim, what's the advantage of using case/of's instead of if/elif's? |
11:43:21 | FromDiscord | <Yardanico> all case statements must be exhaustive, meaning that you need to always handle all possible values (or _explicitly_ not handle them) |
11:43:41 | FromDiscord | <evoalg> that's a good thing? |
11:43:44 | FromDiscord | <Yardanico> yes? |
11:43:53 | FromDiscord | <Yardanico> you're not going to miss some value from your enum for example |
11:44:01 | FromDiscord | <Yardanico> see https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement for a more detailed explanation |
11:44:12 | FromDiscord | <evoalg> ah thank you |
11:45:35 | FromDiscord | <Yardanico> also it can be faster than if/elif in some cases, e.g. if you're doing some parser that consumes chars so you can use char sets |
11:45:44 | FromDiscord | <Yardanico> (second case example in that link) |
11:47:30 | * | Vladar joined #nim |
11:51:47 | FromDiscord | <evoalg> Thank you! ... that reminds me, in a proc when I do "if foo: return bar", then for the next line I don't bother with "else" because there's no need - is that bad? I've seen examples of people using "else". |
11:53:19 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Cu9 |
11:53:32 | FromDiscord | <Yardanico> it's not "bad" but depending on the code it can lead to unexpected behaviour |
11:53:40 | FromDiscord | <Yardanico> (not "undefined" but unexpected :P) |
11:54:46 | FromDiscord | <evoalg> can the next line be: return "goodbye" ... without else ... I know it can, but is it "ok"? |
11:55:31 | FromDiscord | <evoalg> I mean I know it works, but are there good reasons to use "else" where it's not needed here? |
11:56:57 | FromDiscord | <Rika> It’s okay |
11:57:22 | FromDiscord | <evoalg> Thank you! |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:32 | * | supakeen joined #nim |
12:09:50 | FromDiscord | <Arend | ᛗᛟᚢᚱᛁᛖᛊ> I used `setSockOpt(OptReuseAddr, true)` in my code but every time I boot up the server it says address is in use since switching to 1.6.0 🤔 |
12:18:10 | * | elph joined #nim |
12:19:31 | * | kayabaNerve quit (Remote host closed the connection) |
12:19:56 | * | kayabaNerve joined #nim |
13:30:13 | * | rockcavera joined #nim |
13:30:13 | * | rockcavera quit (Changing host) |
13:30:13 | * | rockcavera joined #nim |
14:00:06 | * | pch_ quit (Ping timeout: 260 seconds) |
14:03:54 | * | pch joined #nim |
14:20:34 | FromDiscord | <tandy> is there a way to cite the nim programming language? |
14:21:20 | FromDiscord | <Yardanico> i don't think there's a research paper about nim that you can cite, but i'm not an expert in this area |
14:34:36 | FromDiscord | <haxscramper> There should be a rules for citing online resources and other things |
14:34:50 | FromDiscord | <tandy> yeah im using that |
14:34:50 | FromDiscord | <haxscramper> Of course nim does not have research paper with DOI |
14:34:56 | FromDiscord | <tandy> just was wondering if there was a preferd way |
14:35:23 | FromDiscord | <haxscramper> I suppose you can look up general rules for citing an open-source projects |
14:35:38 | FromDiscord | <haxscramper> https://arxiv.org/abs/2003.03449 |
14:38:14 | * | pro joined #nim |
14:45:43 | * | pro quit (Quit: WeeChat 3.3) |
14:46:00 | * | pro joined #nim |
14:46:38 | * | pro quit (Client Quit) |
14:46:53 | * | pro joined #nim |
14:48:55 | * | pro quit (Client Quit) |
14:49:13 | * | pro joined #nim |
14:50:13 | * | pro quit (Client Quit) |
15:17:44 | arkanoid | when should I use orc and not only arc? |
15:19:04 | FromDiscord | <Yardanico> In reply to @arkanoid "when should I use": well, basically, if you don't care much you can always use orc |
15:19:08 | FromDiscord | <Yardanico> orc is arc + cycle collector |
15:19:19 | FromDiscord | <Yardanico> so if you are sure that your program does not create cycles, you can just use arc |
15:19:28 | FromDiscord | <Yardanico> but if it does actually use cycles and you're using arc, the program will leak memory |
15:19:37 | arkanoid | is it when I make a ref object that references itself? |
15:19:50 | FromDiscord | <Yardanico> that too |
15:20:06 | FromDiscord | <dom96> In reply to @haxscramper "https://arxiv.org/abs/2003.03449": hah, that's my dissertation |
15:20:08 | FromDiscord | <Yardanico> or if you have a -> b -> c and c references a |
15:21:05 | * | al1ranger joined #nim |
15:21:15 | arkanoid | got it, thanks. I wonder what's the overhead of orc over arc. I'd always use orc even if it would be 2x times slower |
15:22:04 | FromDiscord | <Yardanico> the overhead is not big, and it can be 0 if you mark potentially cyclic objects that are not actually cyclic as {.acyclic.} |
15:22:18 | FromDiscord | <Yardanico> https://nim-lang.org/blog/2020/12/08/introducing-orc.html |
15:27:45 | arkanoid | Yardanico: is {.acyclic.} a pragma to help compiler compile faster, or it does actually speedup runtime? |
15:27:57 | FromDiscord | <Yardanico> check that article |
15:28:15 | FromDiscord | <Yardanico> ORC assumes all acyclic types can never contain cycles so it doesn't check them |
15:28:18 | arkanoid | it says "The Nim compiler analyses the involved types and only if it is potentially cyclic, code is produced that calls into the cycle collector" |
15:28:28 | FromDiscord | <Yardanico> cycle collector is orc's runtime part |
15:28:36 | FromDiscord | <Yardanico> so if you mark an actually cyclic type as acyclic it'll leak memory even with orc |
15:34:17 | * | Gustavo6046_ joined #nim |
15:34:28 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
15:35:47 | arkanoid | got it, thanks |
15:36:12 | arkanoid | well, hard realtime party! |
15:36:59 | arkanoid | thanks to nim 1.6.0 I've finally enabled arc/orc in my app. I was waiting for a bug to be fixed |
15:37:09 | * | Gustavo6046_ is now known as Gustavo6046 |
15:39:14 | * | al1ranger quit (Quit: Leaving) |
15:41:30 | FromDiscord | <gerwy> hmm i know it might sound stupid, but i have module conflict and is there a way to like, seperate those two?↵i could always have one script that uses one module and the other one uses other one (they must be run one after another) but its pretty ugly solution↵I know its a problem because linking error pops up only when i import both of them |
15:44:59 | FromDiscord | <gerwy> and its stupid because i just wanted to use nimview with webview... |
15:46:18 | FromDiscord | <lbart> mmmhh I have an Enum which start with "1" and case kind of this enum and nim raises this: "Error: low(kind) must be 0 for discriminant"↵Why kind must start at 0? |
15:46:48 | FromDiscord | <Yardanico> can you show the enum definition? |
15:47:44 | FromDiscord | <Yardanico> and preferably code where you're trying to use the enums too |
15:49:18 | FromDiscord | <Yardanico> ah I see now, for an object variant |
15:49:18 | FromDiscord | <Yardanico> hmm |
15:50:57 | FromDiscord | <lbart> something like this: https://play.nim-lang.org/#ix=3CvO |
15:51:18 | FromDiscord | <Yardanico> yeah, I figured, doesn't look like you can fix that, any reason you want this enum to start at 1 ? |
15:51:56 | FromDiscord | <Yardanico> In reply to @lbart "something like this: https://play.nim-lang.org/#ix=": see the original issue https://github.com/nim-lang/Nim/issues/3096 |
15:52:46 | arkanoid | can {.push warningAsError[Effect]: on.} be applied at whole project and not as module pragma? |
15:53:12 | FromDiscord | <Yardanico> yes, just put it in your config |
15:53:27 | FromDiscord | <Yardanico> should be just `--warningAsError[Effect]:on` |
15:53:36 | FromDiscord | <Yardanico> i mean nim config, file.nim.cfg or file.nims |
15:53:54 | FromDiscord | <lbart> In reply to @Yardanico "yeah, I figured, doesn't": It's come from a standard. But I can live with an "unknown = 0" |
15:54:36 | arkanoid | config.nims(1, 2) Error: invalid command line option: '--warningAsError[Effect]' |
15:54:39 | * | Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in) |
15:55:01 | * | Gustavo6046 joined #nim |
15:55:10 | FromDiscord | <Yardanico> ah, in nims it's a bit different I think |
15:55:19 | FromDiscord | <gerwy> okay nevermind, i didn't know about all nimview functions sowwy |
15:55:29 | FromDiscord | <Yardanico> In reply to @arkanoid "config.nims(1, 2) Error: invalid": try --warningAsError:"Effect:on" |
15:56:11 | arkanoid | ok this works! |
15:56:12 | FromDiscord | <Yardanico> this is needed because in nimscript (which .nims is) `--` is just a template for `switch` |
15:56:13 | arkanoid | thanks |
15:56:23 | FromDiscord | <Yardanico> https://nim-lang.org/docs/nimscript.html#--.t%2Cuntyped%2Cuntyped |
15:57:52 | arkanoid | and how to make "UnusedImport" an error too? |
15:58:20 | FromDiscord | <Yardanico> same as you did Effect ? |
15:58:20 | arkanoid | found |
15:58:32 | arkanoid | but I get errors in system.nim :D |
15:58:35 | arkanoid | not usable |
15:59:03 | FromDiscord | <Yardanico> well yeah, and I don't think it's such a big deal really |
15:59:04 | arkanoid | .choosenim/toolchains/nim-1.6.0/lib/system.nim(1902, 14) Error: imported and not used: 'coro_detection' [UnusedImport] |
15:59:13 | arkanoid | sure, not a problem |
15:59:15 | FromDiscord | <Yardanico> nim always has dead code elimination enabled anyway |
15:59:37 | arkanoid | yeah but it help keeping readable code clean |
16:00:35 | FromDiscord | <Yardanico> sure, but I find warnings given by the compiler enough for me to fix those issues :) |
16:00:46 | FromDiscord | <Yardanico> i don't need to make them into errors to be forced to fix them |
16:25:31 | * | Gustavo6046 quit (Ping timeout: 245 seconds) |
16:25:33 | * | Gustavo6046_ joined #nim |
16:28:20 | * | Gustavo6046_ is now known as Gustavo6046 |
16:32:32 | * | arkurious joined #nim |
17:07:17 | * | natrys joined #nim |
17:13:17 | FromDiscord | <DMI-1407> is there a list of known bugs ? (most famous ones etc... ?) |
17:16:59 | FromDiscord | <Rika> the issues page on github? |
17:17:19 | FromDiscord | <DMI-1407> these are not bugs related to the language |
17:17:25 | FromDiscord | <DMI-1407> (mostly) |
17:17:46 | FromDiscord | <DMI-1407> i mean bugs related to the language only |
17:18:59 | FromDiscord | <DMI-1407> e.g. : https://media.discordapp.net/attachments/371759389889003532/901157696462532618/unknown.png |
17:22:37 | FromDiscord | <haxscramper> there are tags for the bugs on github |
17:22:48 | FromDiscord | <haxscramper> you can filter out things that you need |
17:23:29 | FromDiscord | <Rika> there are a lot of labels |
17:23:44 | FromDiscord | <haxscramper> And if you are wondering what it means exactly by "has a bug that affects symbols" then your best bet is to git blame someone who wrote this |
17:23:48 | FromDiscord | <haxscramper> read their mind |
17:24:03 | FromDiscord | <haxscramper> who the hell writes messages like that I wonder |
17:24:06 | FromDiscord | <haxscramper> super descriptive |
17:24:25 | FromDiscord | <haxscramper> "there might be some bug, but I won't even tell you what it can affect, or how or in what situations" |
17:24:30 | FromDiscord | <Rika> should have linked the issue |
17:27:33 | FromDiscord | <DMI-1407> ok 😅 |
17:28:05 | FromDiscord | <haxscramper> image.png https://media.discordapp.net/attachments/371759389889003532/901159989324959744/image.png |
17:28:05 | FromDiscord | <haxscramper> holy shit |
17:28:07 | FromDiscord | <haxscramper> 11 years ago |
17:28:09 | FromDiscord | <haxscramper> fucking |
17:28:35 | FromDiscord | <haxscramper> unbelievable |
17:28:37 | FromDiscord | <DMI-1407> yeah hopefully that bug has been fixed already |
17:28:45 | FromDiscord | <dom96> there are older bugs in Firefox |
17:28:55 | FromDiscord | <haxscramper> The main question is "what bug" |
17:29:19 | FromDiscord | <haxscramper> sure, there are older bugs in multix↵(@dom96) |
17:29:38 | FromDiscord | <haxscramper> I bet there are bugs as old as half a century somewher |
17:29:40 | FromDiscord | <haxscramper> so what? |
17:30:03 | FromDiscord | <Rika> what does bugs in firefox have to do with this |
17:30:07 | FromDiscord | <Rika> thats a strange thing to say |
17:30:08 | FromDiscord | <DMI-1407> nim started in 2008 |
17:30:12 | FromDiscord | <haxscramper> I've personally been bitten in the ass by bug report 23 years old, but that does not indicate anything |
17:30:29 | FromDiscord | <haxscramper> open-sourced in 2008 |
17:30:32 | FromDiscord | <haxscramper> started in 2004 IIRC |
17:30:36 | FromDiscord | <DMI-1407> oh ok |
17:30:51 | FromDiscord | <haxscramper> well, that does not mean to imply anything, just a clarification |
17:31:10 | FromDiscord | <dom96> In reply to @Rika "what does bugs in": firefox is an open source project that actually has a lot of donations and they also have old bugs |
17:31:19 | FromDiscord | <dom96> how is it strange to draw parallels? |
17:31:37 | FromDiscord | <haxscramper> well, it is not strange to draw parallels if they mean anything |
17:31:49 | FromDiscord | <haxscramper> yeah, sure eveyone writes buggy code |
17:32:04 | FromDiscord | <haxscramper> main point is not an existence of the bug itself, but documentation that says |
17:32:13 | FromDiscord | <haxscramper> "it might be broken, idk how, idk why" |
17:32:31 | FromDiscord | <DMI-1407> its scary |
17:32:51 | FromDiscord | <dom96> In reply to @haxscramper "well, it is not": eh, the parallels I drew do mean something |
17:33:14 | FromDiscord | <dom96> it means "every open source project has 11+ year old bugs |
17:33:19 | FromDiscord | <dom96> (edit) "bugs" => "bugs"" |
17:33:21 | FromDiscord | <haxscramper> I mean I don't know when bad things can happen, but you did inform that they are likely to happen somehow |
17:34:17 | FromDiscord | <haxscramper> This statement is just as hard to argue against as to find any value that it brings to the conversation. And that was not the point of the original discussion anyway↵(@dom96) |
17:34:59 | FromDiscord | <haxscramper> The point is, that for over a decate there has been a line in the docs, that said "things might go wrong" without actually telling anyone |
17:35:01 | FromDiscord | <haxscramper> and guess what |
17:35:14 | FromDiscord | <haxscramper> nobody has any means to actually find what this means now |
17:35:24 | FromDiscord | <DMI-1407> https://media.discordapp.net/attachments/371759389889003532/901161829047337031/unknown.png |
17:35:42 | FromDiscord | <haxscramper> unless they go over all bugs there are, find which ones are related to fieldPairs and try to play detective |
17:35:52 | FromDiscord | <haxscramper> but anyway, my assumption is that bug has been fixed |
17:36:06 | FromDiscord | <haxscramper> because `fieldPairs` worked in just about every situation that I managed to put it through |
17:36:14 | FromDiscord | <haxscramper> and I write some very whacky shit |
17:36:22 | FromDiscord | <dom96> In reply to @haxscramper "nobody has any means": Clearly you can just ask Araq about it 🙂 |
17:40:22 | FromDiscord | <haxscramper> Let's see if this yields anything |
17:40:33 | FromDiscord | <haxscramper> Btw, 11989 stars on the GH |
17:43:07 | FromDiscord | <dom96> socialblade needs a github stars category |
17:54:48 | * | xet7 quit (Remote host closed the connection) |
17:55:43 | * | xet7 joined #nim |
17:56:26 | * | xet7 quit (Remote host closed the connection) |
18:12:36 | FromDiscord | <Hamid Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3CwF |
18:12:53 | FromDiscord | <Hamid Bluri> (edit) "https://play.nim-lang.org/#ix=3CwF" => "https://play.nim-lang.org/#ix=3CwG" |
18:13:25 | FromDiscord | <Illusive> Hey guys, not sure where to post, but i am thinking of which language to learn. I am coming from Rust lang, and thinking which next one to learn. I picked golang and nim. |
18:15:01 | FromDiscord | <tandy> nim \@Illusive) |
18:17:31 | FromDiscord | <Illusive> In reply to @tandy "nim \> go (<@790153860130799616>)": nim syntax seems comfy |
18:17:47 | FromDiscord | <tandy> it is |
18:20:10 | FromDiscord | <reilly> I recently had to write some Go for a project, and while Go's tooling leaves Nim in the dust, writing actual Go code made it very obvious to me just how much more Nim can do than Go. |
18:21:15 | FromDiscord | <haxscramper> Curly bracket itself is called pragma annotations↵(@Hamid Bluri) |
18:21:56 | FromDiscord | <haxscramper> well, it is not exactly after template, the formatting is not really readable here |
18:22:15 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3CwL |
18:22:15 | FromDiscord | <haxscramper> it is a pragma block |
18:22:29 | FromDiscord | <reilly> @haxscramper I believe they're talking about the `{echo(x)}` |
18:23:04 | FromDiscord | <Illusive> In reply to @reilly "I recently had to": hm i guess i will use nim for my needs then |
18:23:13 | FromDiscord | <Illusive> any recommendations where to start? |
18:23:38 | FromDiscord | <Hamid Bluri> In reply to @reilly "<@!608382355454951435> I believe they're": yes but what's pragma block : D - i can't find it in the manual |
18:23:50 | FromDiscord | <Hamid Bluri> now i have 2 questions |
18:24:08 | FromDiscord | <haxscramper> `{echo(x)}`? |
18:24:09 | FromDiscord | <tandy> the manual↵(@Illusive) |
18:24:09 | FromDiscord | <haxscramper> https://nim-lang.org/documentation.html there are quite a few places you can start with |
18:24:21 | FromDiscord | <Hamid Bluri> In reply to @haxscramper "`{echo(x)}`?": yes |
18:24:27 | FromDiscord | <reilly> In reply to @haxscramper "`{echo(x)}`?": Look closer at what comes right after `template` |
18:24:48 | FromDiscord | <haxscramper> Pragma block is a pragma in form of a block ... basically. It is not different from regular pragma, and serves to provide some extra information to the compiler↵(@Hamid Bluri) |
18:25:04 | FromDiscord | <haxscramper> Most pragmas are added to procs, types and fields |
18:25:08 | FromDiscord | <Hamid Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3CwM |
18:25:11 | FromDiscord | <haxscramper> TWM pattern |
18:25:14 | FromDiscord | <haxscramper> TRM |
18:25:15 | FromDiscord | <Rika> term rewriting |
18:25:37 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual_experimental.html#term-rewriting-macros |
18:25:38 | FromDiscord | <Rika> basically nim looks for `echo x` and replaces it with `pwnecho(x)` |
18:25:40 | FromDiscord | <Rika> pretty much |
18:25:46 | FromDiscord | <reilly> In reply to @Illusive "any recommendations where to": I think https://learnxinyminutes.com/docs/nim/ is a good way of quickly familiarizing yourself with basic Nim syntax. Also a good reference in case you forget anything. |
18:26:09 | FromDiscord | <Rika> In reply to @reilly "I recently had to": tooling is quicker to remediate than language features |
18:28:18 | FromDiscord | <reilly> In reply to @haxscramper "https://nim-lang.org/documentation.html there are q": @Illusive the other links on this page are also definitely good to look at. I'd say start with Learn Nim in 5 Minutes so that you can know what you're looking at, then move on to the official tutorials. Also look at "Nim for..." if you have previous experience with C, Python, or TS/JS. |
18:29:11 | FromDiscord | <reilly> Also, the Nim for Beginners video series is relatively new and is still updated. Good if you prefer to listen and watch rather than just read. https://www.youtube.com/playlist?list=PLvwc2YT9MFOlPPexrsY-t7BNTdg2Vsx06 |
18:29:35 | FromDiscord | <Hamid Bluri> thanks to Hax & Rika |
18:29:53 | FromDiscord | <haxscramper> Hamid Bluri\: if you are wondering whether you need to learn TRM patterns, I would say they answer is no |
18:30:00 | FromDiscord | <haxscramper> they are hardly ever used |
18:30:03 | FromDiscord | <Rika> same here |
18:30:11 | FromDiscord | <Hamid Bluri> ok : D |
18:30:12 | FromDiscord | <Rika> you need a really really good reason to use them |
18:30:25 | FromDiscord | <haxscramper> Like, they look like a nuclear option to solve some problems |
18:30:37 | FromDiscord | <haxscramper> Sometimes |
18:30:48 | FromDiscord | <haxscramper> But more often that not they are too powerful of a tool |
18:30:58 | FromDiscord | <haxscramper> And also have some bugs |
18:31:38 | FromDiscord | <Hamid Bluri> +1 |
18:32:32 | FromDiscord | <Illusive> In reply to @reilly "Also, the Nim for": thanks i will take a look |
18:46:07 | * | xet7 joined #nim |
18:50:57 | * | yann-kaelig joined #nim |
18:52:23 | FromDiscord | <DMI-1407> is there a ide (except vs) that support nim (not just highlighting) ? |
18:53:56 | yann-kaelig | Hello. I'm new to nim language, I'm not a dev but I'm really interested to start with nim and learn this language. My first question is, is there an nim dedicated IDE, I don't want to start to hack or lost my time in some configuration, I want to start to learn nim with a sane environment. What can you propose ? |
18:54:21 | FromDiscord | <IsaacPaul> looks like fieldPairs might have been fixed? https://github.com/nim-lang/Nim/issues/15221 |
18:55:43 | FromDiscord | <IsaacPaul> In reply to @yann-kaelig "Hello. I'm new to": I'm currently using nim with vscode. Has all the features I need so far (linting, error highlighting, autocomplete), but a little bit confusing to set up. |
18:56:58 | FromDiscord | <IsaacPaul> In reply to @DMI-1407 "is there a ide": theres a sublime text plugin. Though I haven't tried it: https://github.com/nim-lang/NimLime |
18:58:03 | FromDiscord | <Hamid Bluri> In reply to @yann-kaelig "Hello. I'm new to": vscode + nim extention |
18:58:04 | yann-kaelig | Hello IsaacPaul. I'm really not a fan of vscode, but if there is a clear tutorial to configure nim without headache, well if there is nothing else, it's ok for me |
18:59:14 | FromDiscord | <Hamid Bluri> nim extention for vscode doesn't need configuration |
18:59:47 | yann-kaelig | O, so I'm installing vscode, nim extension and I'm ready to go, that right ? |
19:00:18 | FromDiscord | <Hamid Bluri> if you've installed nim lang already, yes |
19:00:25 | FromDiscord | <Rika> what are you a fan of regards editors? |
19:00:27 | FromDiscord | <Rika> if not vscode |
19:00:36 | FromDiscord | <Rika> there is for [n]vim, emacs, etc |
19:00:40 | FromDiscord | <tandy> lite-xl↵(@Rika) |
19:00:49 | FromDiscord | <Hamid Bluri> just make sure download `nim-saem` extenstion |
19:05:32 | yann-kaelig | Well, not a fan it's only my point of view, I'm just not interested to lose a month in learning and configuring nvim, emacs or any any other IDE before I can start to work on nim. I'm interested to lean nim, and maybe after that I will see what I need to adjust in my IDE to optimize my work |
19:06:06 | FromDiscord | <Rika> i mean |
19:06:11 | FromDiscord | <Rika> what ide/editor do you use |
19:06:14 | FromDiscord | <haxscramper> open notepad, save `test.nim` |
19:06:15 | FromDiscord | <Rika> right now |
19:06:24 | FromDiscord | <haxscramper> run `nim c test.nim` |
19:06:33 | FromDiscord | <haxscramper> I mean there is 0 config needed to play with the langauge |
19:06:56 | FromDiscord | <haxscramper> you can use absolutely any editor to get started, and then if you are interested invest some more time |
19:07:16 | yann-kaelig | I know but at least some help is welcome, error highlighting, autocomplete and more |
19:07:41 | FromDiscord | <IsaacPaul> In reply to @yann-kaelig "O, so I'm installing": No you need a build task, update some configurations, and if you want to use the debugger then that needs to be setup too. ↵https://gist.github.com/izackp/485a850e485893ce5b808124826f69fc - Example of my current setup |
19:07:52 | FromDiscord | <haxscramper> autocomplete is not really good in any IDEs as of now |
19:08:08 | FromDiscord | <Yardanico> In reply to @IsaacPaul "No you need a": You don't need a build task though |
19:08:20 | FromDiscord | <IsaacPaul> need is a strong word.. lol |
19:08:23 | FromDiscord | <Rika> man im just asking what you're using right now to edit code so i can see if there is a nim plugin for it |
19:08:31 | FromDiscord | <haxscramper> well, doom emacs with nim layer worked for me out of the box, but in the end it all comes down to the nimsuggest being kind of bad |
19:08:34 | FromDiscord | <Yardanico> Nim extension has F6 for quick compile and run for the current Nim file |
19:08:45 | FromDiscord | <IsaacPaul> Oh I didn't know that lol |
19:14:07 | FromDiscord | <jmgomez> Hey guys Im trying to import a cpp dyn library as a test but the nim compiler is complaining. It does not seem to find it I think. Where is it looking for? Is there any special folder or something? |
19:15:44 | FromDiscord | <Yardanico> where is that library located? |
19:16:04 | FromDiscord | <Yardanico> And also, does it export a C ABI or a C++ ABI? |
19:16:15 | FromDiscord | <haxscramper> "nim compiler is complaining" what is the error message |
19:16:58 | FromDiscord | <haxscramper> If you are on linux the easiest way might be to run it via strace to find out where it scans for the files |
19:17:00 | FromDiscord | <jmgomez> The error message is https://media.discordapp.net/attachments/371759389889003532/901187399181275186/unknown.png |
19:17:05 | FromDiscord | <jmgomez> It's a Cpp |
19:17:38 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix= |
19:17:57 | FromDiscord | <jmgomez> That's how Im making the binding and the lib is located alongside the binary |
19:18:19 | FromDiscord | <haxscramper> First, this is not a dynamic library erro message, your program has failed static linking via `ld` |
19:18:22 | FromDiscord | <haxscramper> How do you wrap the function? |
19:18:41 | FromDiscord | <jmgomez> https://media.discordapp.net/attachments/371759389889003532/901187823288324156/unknown.png |
19:19:08 | FromDiscord | <haxscramper> It is not possible to importcpp symbols from the cxx dynamic library this way |
19:19:09 | FromDiscord | <haxscramper> if it is exports cxx symbols |
19:19:09 | FromDiscord | <haxscramper> cpp\ |
19:19:10 | yann-kaelig | So, as I understand there is no nim IDE for nim programming, an All-In-One ready to go that make the learning of nim language fun, pleasant. The opposite of having to configure n softwares for this purpose. |
19:19:26 | FromDiscord | <Rika> yes |
19:19:30 | FromDiscord | <Rika> we are not big enough for that |
19:19:43 | FromDiscord | <haxscramper> we have plugins for the editors |
19:19:47 | FromDiscord | <Rika> IIRC neither does rust |
19:19:52 | FromDiscord | <haxscramper> we don't have dedicated IDE for that one |
19:20:02 | FromDiscord | <jmgomez> Im not following man. How they should be exported them? |
19:20:09 | FromDiscord | <jmgomez> Is there any doc or something that I can refer to? |
19:20:25 | FromDiscord | <IsaacPaul> https://nim-lang.org/nimedit/ 🤷♂️ No idea if it's useful but its on the official website lol |
19:20:29 | FromDiscord | <Rika> its old |
19:20:36 | FromDiscord | <Rika> prolly abandoned even |
19:20:43 | FromDiscord | <IsaacPaul> makes sense |
19:20:53 | nrds | <Prestige99> vscode is probably your best bet |
19:21:18 | FromDiscord | <IsaacPaul> Honestly if you're new set it up isn't going to take you months.. worst case a day or two. |
19:21:33 | FromDiscord | <IsaacPaul> (edit) "set it up" => "setup" |
19:22:07 | FromDiscord | <IsaacPaul> It's also needed experience for becoming a capable developer |
19:22:10 | nrds | <Prestige99> I think there's a single vscode plugin that does everything you need, saemnim or nimsaem I think |
19:22:40 | FromDiscord | <IsaacPaul> average case an hour lol |
19:22:53 | FromDiscord | <IsaacPaul> like it should just work, but sometimes these plugins just don't work lol |
19:23:07 | yann-kaelig | ok, thank you very much, so vscode until I acquire enough competence to write one :) |
19:23:09 | FromDiscord | <haxscramper> This code is C or C++? How do you compile it? When C++ code is involved your shared library will usually not contain symbol names like `helloDLl`, instead it would be a mangled representation↵(@jmgomez) |
19:23:10 | FromDiscord | <IsaacPaul> maybe nims not in the path or a dependencies crashes |
19:23:17 | FromDiscord | <haxscramper> Can you send the code text so I can try this out |
19:23:30 | FromDiscord | <IsaacPaul> (edit) "nims" => "nim is" |
19:23:47 | FromDiscord | <haxscramper> Or you can run `readelf -sW` for this purpose |
19:23:48 | FromDiscord | <IsaacPaul> (edit) "dependencies" => "dependency" |
19:24:23 | FromDiscord | <haxscramper> Also, I'm not sure if `importcpp` is even supported for dynamic library imports, since in this case you are dealing only with library symbols |
19:24:48 | FromDiscord | <haxscramper> https://forum.nim-lang.org/t/8352#53847 this is a more convoluted example |
19:24:59 | FromDiscord | <jmgomez> There is no much code. A basic library with a function in cpp and that binding |
19:25:05 | FromDiscord | <haxscramper> `_ZN6Optick4Core16BeginUpdateFrameENS_9FrameType4TypeElm` is how functions in namespaces look in cxx shoo |
19:25:15 | FromDiscord | <haxscramper> can you send the code so I can try this out?↵(@jmgomez) |
19:25:35 | FromDiscord | <haxscramper> something I can copy-paste to reproduce the issue you are having and maybe try to figure out how to solve it |
19:26:41 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3CwZ |
19:28:05 | yann-kaelig | My first project is to port a software written in Bash to nim, it's a software that takes care of configuring, compiling, installing software in a Linux distribution. |
19:28:28 | FromDiscord | <jmgomez> My goal is to do a test of a binding for Unreal. They use dynamic libraries all the way down |
19:31:16 | FromDiscord | <jmgomez> looking around it seems like you can also include the headers directly and compile the cpps? |
19:31:27 | FromDiscord | <haxscramper> yes |
19:32:01 | FromDiscord | <geekrelief> In reply to @jmgomez "My goal is to": There's this https://github.com/pragmagic/nimue4 but they dropped it and went with godot. |
19:32:02 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Cx1 |
19:32:34 | yann-kaelig | I would like to offer a graphical interface for this software, I have done a lot of research on this subject, still seams that in most case GUI project written in nim are at the test stage |
19:32:47 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Cx2 |
19:32:50 | FromDiscord | <haxscramper> And then you can wrap it in nim using `importc: "helloDll", dynlib: "ActualDll.so"` |
19:33:24 | FromDiscord | <haxscramper> There is no C++ when dynamic libraries are invoved, it all has to be squashed to the regular C-mangled names |
19:33:29 | FromDiscord | <jmgomez> In reply to @geekrelief "There's this https://github.com/pragmagic/nimue4 bu": I know. I would like to narrow the scope first and just get nim code executed |
19:33:46 | FromDiscord | <haxscramper> Then `extern "C"` on the cxx definition |
19:34:12 | FromDiscord | <haxscramper> Other alternative is to just `importcpp: , "header"` this |
19:35:00 | FromDiscord | <haxscramper> I don't remember how you are supposed to do `cxx -> dl -> cxx` interface sandwich |
19:35:31 | FromDiscord | <jmgomez> I see. So TIL I learn that I wont be going that route. Will give at shot to compile the cpp sources them. Maybe I can make that work more easily |
19:35:34 | FromDiscord | <haxscramper> but `importcpp/header` would allow you to do this, since it just generates C code |
19:35:34 | FromDiscord | <jmgomez> Thanks for your support |
19:35:52 | FromDiscord | <haxscramper> compiling C++ sources is certainly easier |
19:36:31 | FromDiscord | <haxscramper> Though UE might require build to be done via Visual Studio or something along those lines, and in this case you might be not so lucky |
19:37:20 | FromDiscord | <geekrelief> In reply to @jmgomez "I know. I would": Have you seen deech's Nim Nuggets talk? |
19:38:59 | FromDiscord | <jmgomez> In reply to @haxscramper "Though UE might require": I know better their build system than the Cpp traditional one. That's why I wanted to go with dlls.↵@geekrelief nope |
19:40:24 | FromDiscord | <geekrelief> In reply to @jmgomez "I know better their": might be helpful for you https://youtu.be/d2VRuZo2pdA?t=1964 |
19:40:32 | FromDiscord | <Smarc> Whats the common naming convention for procs? camelCase or snake_case? |
19:41:12 | FromDiscord | <Rika> camel but it doesnt matter |
19:41:14 | FromDiscord | <Rika> you can use either |
19:42:02 | FromDiscord | <Smarc> Ye, but I want to go full blown nim style :) great, I like camelCase a lot more actually |
19:46:53 | FromDiscord | <zetashift> Handy doc for future Nimisms\: https://nim-lang.org/docs/nep1.html↵(@Smarc) |
19:50:46 | FromDiscord | <Illusive> So I would like to have a TOML file where I have some stuff to be set, and then in my main program I would like to parse configuration from this toml file. |
19:51:25 | FromDiscord | <Illusive> currently it is hardcoded inside of the code |
19:51:30 | FromDiscord | <Illusive> like this |
19:51:33 | FromDiscord | <Illusive> sent a code paste, see https://play.nim-lang.org/#ix=3Cx4 |
19:54:57 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Cx5 |
19:55:15 | FromDiscord | <Illusive> cool thanks |
19:55:18 | FromDiscord | <haxscramper> might not actually compile since I just wrote it without checking |
19:57:12 | FromDiscord | <Illusive> In reply to @haxscramper "*might not actually compile": and it will build with these values that are in toml file, and it will not require the toml file it self right? |
19:57:27 | * | yann-kaelig left #nim (#nim) |
19:57:41 | FromDiscord | <Illusive> when i will have the executable it self |
19:58:56 | FromDiscord | <haxscramper> No, it will require the toml file, because that's the purpose of the configuration file. |
19:59:02 | FromDiscord | <Illusive> damn |
19:59:03 | FromDiscord | <Illusive> sad |
19:59:18 | FromDiscord | <haxscramper> well, you can do `const tomlData = staticRead"config.toml"` |
19:59:28 | FromDiscord | <haxscramper> Then `let conf = parseToml(tomlData)` |
19:59:47 | FromDiscord | <haxscramper> this way you won't need toml file and all values will be stored in the exe |
20:00:14 | FromDiscord | <haxscramper> `const tomlData = staticRead...` reads file at compile-time and stores its content in the `tomlData` that can be later read at runtime |
20:00:24 | FromDiscord | <Illusive> In reply to @haxscramper "this way you won't": this is what i need |
20:00:25 | FromDiscord | <Illusive> lel |
20:00:35 | FromDiscord | <Illusive> thanks |
20:00:58 | FromDiscord | <Illusive> but what about webhook? |
20:00:59 | FromDiscord | <haxscramper> Though I would personally just move common configuration into separate `.nim` file in this case, and just `import` it when needed |
20:01:22 | FromDiscord | <haxscramper> `comf["webhook"].getStr()` |
20:01:31 | FromDiscord | <Illusive> In reply to @haxscramper "`comf["webhook"].getStr()`": thanks again |
20:02:15 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Cx8 |
20:02:21 | FromDiscord | <haxscramper> I mean it is even simpler than toml and achieves the same results |
20:04:20 | FromDiscord | <Illusive> In reply to @haxscramper "I mean it is": maybe but tbh i like toml variant more |
20:18:30 | FromDiscord | <Illusive> sooo |
20:18:38 | FromDiscord | <Illusive> compiler screams at me with lots of erros |
20:18:40 | FromDiscord | <Illusive> (edit) "erros" => "errors" |
20:19:10 | FromDiscord | <rainbowasteroids> `slurp` \> `staticRead` |
20:19:42 | FromDiscord | <haxscramper> Yes, now imagine someone reading the code |
20:20:39 | FromDiscord | <haxscramper> And `cost tomlData = readFile` actually works just as well. I actually use it more often than staticRead |
20:21:24 | FromDiscord | <rainbowasteroids> slurp funnie nam |
20:28:29 | FromDiscord | <Illusive> soo |
20:28:49 | FromDiscord | <Illusive> sent a code paste, see https://play.nim-lang.org/#ix=3Cxe |
20:28:55 | FromDiscord | <Illusive> this is how this whole thing looks like |
20:29:13 | FromDiscord | <Illusive> (edit) "https://play.nim-lang.org/#ix=3Cxe" => "https://play.nim-lang.org/#ix=3Cxf" |
20:29:27 | FromDiscord | <rainbowasteroids> what compiler errors are you getting? |
20:29:53 | FromDiscord | <Rika> no, parse the string from tomlData |
20:30:47 | FromDiscord | <Illusive> yay |
20:30:50 | FromDiscord | <Illusive> got it working |
20:30:52 | FromDiscord | <Illusive> i think |
20:30:57 | FromDiscord | <Illusive> thanks |
20:42:32 | * | aaaaaaaaaa is now known as madprops |
20:42:32 | * | madprops quit (Changing host) |
20:42:32 | * | madprops joined #nim |
20:49:24 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Cxj |
20:49:52 | FromDiscord | <Yardanico> Because otherwise you'll be reading the toml config at compile time but parsing it at runtime |
21:04:30 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
21:07:47 | * | Gustavo6046 joined #nim |
21:11:54 | * | Vladar quit (Quit: Leaving) |
21:31:26 | * | FromDiscord quit (*.net *.split) |
21:31:26 | * | redj quit (*.net *.split) |
21:31:26 | * | nisstyre quit (*.net *.split) |
21:31:26 | * | systemdsucks quit (*.net *.split) |
21:31:56 | * | FromDiscord joined #nim |
21:31:57 | * | nisstyre joined #nim |
21:32:34 | * | nisstyre quit (Signing in (nisstyre)) |
21:32:34 | * | nisstyre joined #nim |
21:33:37 | * | redj joined #nim |
21:36:34 | * | systemdsucks joined #nim |
21:49:35 | * | natrys quit (Ping timeout: 264 seconds) |
22:03:16 | FromDiscord | <tandy> [leorize](https://matrix.to/#/@leorize:envs.net)\: why does `currentType` return `or[int, string]` shouldnt it just return a single type? |
22:04:27 | FromDiscord | <leorize> currentType gets you the type discriminator, which is an enum |
22:04:45 | FromDiscord | <leorize> I suppose that name might be confusing \:p |
22:04:46 | FromDiscord | <tandy> oh |
22:05:05 | FromDiscord | <tandy> yeah lol |
22:05:22 | FromDiscord | <tandy> is there a way to infer the current type of a union type field? |
22:05:35 | FromDiscord | <tandy> `var v2: type(currentType(v))` |
22:05:39 | FromDiscord | <tandy> i was tryna do this |
22:06:27 | FromDiscord | <Elegantbeef> It's not statically known so nope |
22:06:36 | FromDiscord | <tandy> hmmm |
22:06:37 | FromDiscord | <leorize> the variants iterator will get you the variants of the union type |
22:06:53 | FromDiscord | <Elegantbeef> Based off runtime information it could be `int` or `string` presently, it'd need to be a union 😀 |
22:07:10 | FromDiscord | <leorize> which you can use to generate `if x of typeA: x as typeA`, and things like that |
22:07:34 | FromDiscord | <tandy> hmmm |
22:07:44 | FromDiscord | <tandy> well it would need to work genericaly |
22:07:50 | FromDiscord | <tandy> cos jsony |
22:08:19 | FromDiscord | <Elegantbeef> Generics are statically known 😀 |
22:08:54 | FromDiscord | <leorize> you can coerce the types |
22:09:21 | FromDiscord | <tandy> how? |
22:09:31 | FromDiscord | <tandy> / wdym |
22:10:07 | FromDiscord | <leorize> so you will want to generate a dispatch for jsony to dispatch based on what is the current type of the union |
22:10:43 | FromDiscord | <leorize> to do this, use the `variants` iterator to get all types contained within union |
22:11:37 | FromDiscord | <leorize> sent a code paste, see https://play.nim-lang.org/#ix=3Cxu |
22:12:15 | FromDiscord | <leorize> I gtg now, but I can explain it in more details later |
22:12:40 | FromDiscord | <tandy> thanks, il pm you if thats okay |
22:12:49 | FromDiscord | <leorize> sure |
22:13:12 | FromDiscord | <Yardanico> https://programming-language-benchmarks.vercel.app/ has nim apparently |
22:13:17 | FromDiscord | <Yardanico> https://github.com/hanabi1224/Programming-Language-Benchmarks |
22:13:41 | FromDiscord | <Yardanico> although I think that doing benchmarks on the CI is kind of unreliable |
23:31:21 | FromDiscord | <Gumber> sent a code paste, see https://play.nim-lang.org/#ix=3CxC |
23:31:59 | FromDiscord | <Elegantbeef> I'd say use saem's extension |
23:33:14 | FromDiscord | <Gumber> thanks - will give that a go |
23:34:21 | FromDiscord | <Gumber> yay! thanks! formatting works 😄 |
23:34:45 | FromDiscord | <Elegantbeef> I did nothing! 😛 |
23:35:10 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
23:36:24 | * | Gustavo6046 joined #nim |
23:39:38 | FromDiscord | <Elegantbeef> A lot of stuff will probably work better i believe |