00:17:43 | FromDiscord | <Odi> sent a code paste, see https://play.nim-lang.org/#ix=4o5X |
00:21:08 | FromDiscord | <Elegantbeef> Is your `nimble/bin` folder in path? |
00:22:45 | * | jmdaemon joined #nim |
00:39:27 | * | nyeaa49284230 joined #nim |
00:41:36 | * | nyeaa4928423 quit (Ping timeout: 248 seconds) |
00:49:00 | * | jmdaemon quit (Ping timeout: 255 seconds) |
00:50:15 | FromDiscord | <Odi> sent a code paste, see https://play.nim-lang.org/#ix=4o64 |
00:50:43 | FromDiscord | <Elegantbeef> So it's not |
00:51:01 | FromDiscord | <Elegantbeef> You need to add `.nimble/bin` to your path |
00:51:41 | * | azimut joined #nim |
01:04:18 | * | dza quit (Quit: Ping timeout (120 seconds)) |
01:05:33 | * | dza joined #nim |
01:13:57 | * | lain quit (Ping timeout: 252 seconds) |
01:15:45 | * | lain joined #nim |
01:18:22 | * | jmdaemon joined #nim |
01:22:51 | FromDiscord | <Odi> sent a code paste, see https://play.nim-lang.org/#ix=4o6a |
02:34:59 | * | jmdaemon quit (Ping timeout: 252 seconds) |
04:24:36 | FromDiscord | <newlibarian> how can i compile to web and linux besides windows? and how can i compile link the data files such as, png, txt, jpg files into the exe or at least combine it in such a way people can't modify the program? |
04:26:15 | * | derpydoo quit (Quit: derpydoo) |
04:29:56 | FromDiscord | <Rika> Files embedded into the executable will always be modifiable in a way, it just depends how hard you make it |
04:30:32 | FromDiscord | <newlibarian> i meant for the average joe that don't code and just play games. |
04:30:56 | FromDiscord | <newlibarian> coders will always to find a way to hack your game. |
04:33:20 | FromDiscord | <Rika> A modder could make it so that an average Joe could change it |
04:33:45 | FromDiscord | <newlibarian> what is a modder and where can i get it? |
04:34:05 | FromDiscord | <Rika> A person who modifies games for fun or whatever |
04:44:55 | FromDiscord | <newlibarian> https://github.com/Vladar4/sdl2_nim |
04:45:08 | FromDiscord | <newlibarian> this is a newb question. how do i install this? |
05:09:08 | * | arkurious quit (Quit: Leaving) |
05:57:52 | FromDiscord | <pmunch> Yeah I've been saying for ages that we should have a simple proc or template for doing this in the stdlib. At least that way if it ever changes stuff will still work↵(@Yepoleb) |
05:59:37 | FromDiscord | <Yepoleb> It seems like almost everyone eventually needs it |
05:59:41 | FromDiscord | <pmunch> @newlibarian\: embedding into your game can simply be done through staticRead. You might want to bundle them up and compress them though if you're doing this for all your assets. |
06:04:10 | FromDiscord | <ringabout> In reply to @Yepoleb "It seems like almost": Perhaps https://github.com/nim-lang/Nim/issues/14810 |
06:04:10 | FromDiscord | <Rika> Isn’t there a third party library for that |
06:15:42 | FromDiscord | <Yepoleb> In reply to @ringabout "Perhaps https://github.com/nim-lang/Nim/issues/1481": That describes the problem but never went anywhere |
06:17:19 | FromDiscord | <Rika> In reply to @Yepoleb "That describes the problem": ~~like a lot of the issues~~ |
06:32:57 | FromDiscord | <Hourglass [She/Her]> Does Nim have a way to control a browser from a program? I want to interact with a website but have an API that lets me access the DOM and mess with the console, but really DOM is morr important |
06:37:12 | FromDiscord | <Hourglass [She/Her]> Kinda like Puppeteer ig |
06:49:11 | * | advesperacit joined #nim |
06:55:35 | FromDiscord | <Hourglass [She/Her]> The webdriver module looks interesting |
06:55:46 | FromDiscord | <Phil> In reply to @Odi "Again, sorry for asking": You have the correct thing in there. You should be able to check for that though by just running your prior zigcc command |
06:56:10 | FromDiscord | <Phil> Keep in mind to close and re-open the terminal to the environmental variable can take effect |
06:57:23 | FromDiscord | <Phil> In reply to @BobBBob "feel like that should": One sec, I can not confirm what Yepo said here, `join` exists |
06:59:27 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/0lM |
07:01:39 | FromDiscord | <Phil> In reply to @sOkam! "the temporality of the": The answer to that is writing a .state.json file somewhere and reading that in as part of the task which I think might work. But yeah, that's a hassle. |
07:02:20 | FromDiscord | <Phil> In reply to @Hourglass, When the Hour Strikes "Does Nim have a": Yes, nim has a webdriver package that e.g. the forum uses for integration testing |
07:02:31 | FromDiscord | <Phil> Which uses firefox I think |
07:03:32 | FromDiscord | <Phil> You will be pleased to find that it works for both nim 1.6 as well as 1.9.X aka nim 2.0 |
07:03:57 | FromDiscord | <Phil> https://github.com/dom96/webdriver↵↵Usage examples are in the readme of it |
07:04:32 | * | jmdaemon joined #nim |
07:06:06 | FromDiscord | <Phil> The nice thing is that apparently webdrivers really aren't that hard to code if they fit into a measily 375 loc |
07:08:40 | FromDiscord | <Hourglass [She/Her]> Sweet! This means I can now make a CLI client for something I'm interested in! |
07:09:53 | * | redj quit (Ping timeout: 246 seconds) |
07:11:59 | * | redj joined #nim |
07:12:11 | FromDiscord | <newlibarian> where do i find more info on staticread and compiling to web? |
07:12:25 | FromDiscord | <Rika> Web as in JavaScript? |
07:13:31 | FromDiscord | <newlibarian> yes, how do i compile a game to web? |
07:14:55 | FromDiscord | <Rika> Not all libraries in Nim are able to be compiled into JavaScript |
07:15:45 | FromDiscord | <Rika> It might be a bit hard to tell but anything that relies on solely C APIs of course can’t be compiled into JavaScript |
07:15:50 | FromDiscord | <newlibarian> i just want to make a game in sdl and compile to linux, web and win |
07:16:03 | FromDiscord | <Elegantbeef> Well then you'd use emscripten and compile to web assembly |
07:16:05 | FromDiscord | <Rika> I don’t know about that library |
07:16:07 | * | tiorock joined #nim |
07:16:08 | * | tiorock quit (Changing host) |
07:16:08 | * | tiorock joined #nim |
07:16:08 | * | rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services))) |
07:16:08 | * | tiorock is now known as rockcavera |
07:16:21 | FromDiscord | <Elegantbeef> https://github.com/treeform/nim_emscripten_tutorial |
07:16:29 | FromDiscord | <Phil> staticRead: https://nim-lang.org/docs/system.html#staticRead%2Cstring |
07:18:58 | FromDiscord | <newlibarian> another newb question how do i convert raw data files: txt, png, video, ect to bin to be read by staticread? |
07:19:30 | FromDiscord | <Elegantbeef> You literally just read them |
07:19:48 | FromDiscord | <Elegantbeef> staticRead stores the binary data in the executable |
07:22:32 | * | kenran joined #nim |
07:23:25 | * | kenran quit (Remote host closed the connection) |
07:26:29 | * | tiorock joined #nim |
07:26:29 | * | tiorock quit (Changing host) |
07:26:29 | * | tiorock joined #nim |
07:26:29 | * | rockcavera is now known as Guest819 |
07:26:30 | * | tiorock is now known as rockcavera |
07:27:31 | * | rockcavera quit (Remote host closed the connection) |
07:29:36 | * | Guest819 quit (Ping timeout: 255 seconds) |
07:35:21 | FromDiscord | <Phil> Note that you need to use const to store the result as it acts as compile-time and let/var are runtime |
07:35:43 | FromDiscord | <Elegantbeef> \well there is a caveat there |
07:36:03 | FromDiscord | <Phil> There is? |
07:36:10 | FromDiscord | <Elegantbeef> Yea |
07:36:25 | FromDiscord | <Elegantbeef> `let doThing = static: staticRead("bleh")` is valid |
07:36:56 | FromDiscord | <Phil> Okay fair, but at that point what actually happens is this turns into `let doThing = <FileContentAsString>` |
07:37:35 | FromDiscord | <Elegantbeef> Hey it's a caveat! |
07:37:45 | * | PMunch joined #nim |
07:40:31 | FromDiscord | <newlibarian> how do i compile for linux? install nim on linux and compile for linux? |
07:41:02 | Amun-Ra | newlibarian: have you read build procedure on nim webpage? |
07:41:29 | FromDiscord | <newlibarian> i skimmed through it a few months ago. |
07:41:59 | FromDiscord | <Rika> In reply to @Isofruit "Okay fair, but at": Yes, would you rather the constant be in every use instead? I do not know of any guarantees that the same constant will be put in the data section and referenced that way |
07:42:53 | Amun-Ra | newlibarian: it's almost as simple as running four commands. https://nim-lang.org/install_unix.html |
07:43:58 | FromDiscord | <huantian> You can build your program on Linux |
07:44:04 | FromDiscord | <huantian> Or cross compile from windows |
07:44:16 | FromDiscord | <huantian> https://nim-lang.org/docs/nimc.html |
07:44:19 | FromDiscord | <huantian> Has stuff in it I think |
07:44:41 | Amun-Ra | cross compiling for linux can be tricky (unless one build inside wsl) |
07:45:00 | Amun-Ra | crosscompiling for windows on linux is simple as |
07:47:23 | * | xet7 joined #nim |
07:55:47 | * | onetwo quit (Quit: The Lounge - https://thelounge.chat) |
08:00:46 | * | onetwo joined #nim |
08:07:42 | PMunch | @newlibarian, you might also find this interesting: https://forum.nim-lang.org/t/7534 |
08:12:24 | FromDiscord | <Elegantbeef> Hmph i'm presently just toying around with it, but very much wondering if I should put more time in the inverse futhark 😄 |
08:12:47 | FromDiscord | <Elegantbeef> Nothing fancy presently but I do have |
08:12:49 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1075328816106446909/image.png |
08:13:24 | FromDiscord | <Elegantbeef> Primitives and typedefs, still need sets and the like, which is the complicated stuff |
08:16:44 | FromDiscord | <newlibarian> nimble install sdl2_nim@#legacy |
08:16:49 | FromDiscord | <newlibarian> where does it install to? |
08:16:57 | FromDiscord | <Elegantbeef> `.nimble/pkgs` |
08:20:38 | PMunch | @Elegantbeef, oh creating pretty header files for Nim libraries? That's pretty cool actually, would certainly help if you wanted to develop a dynamic library in Nim |
08:21:13 | PMunch | By the way is `intptr_t` the correct in `doThing`? Wouldn't that just be passed by value? |
08:21:34 | FromDiscord | <Elegantbeef> `intptr_t` is an integer the size of a pointer |
08:24:21 | FromDiscord | <Elegantbeef> I suppose one could use the target arch to emit specific integer sizes |
08:25:47 | FromDiscord | <Phil> I continue to be reaffirmed that java as a language with its constructs is not as much of an atrocity as its community with 5 billion abstraction layers |
08:26:07 | FromDiscord | <Phil> Ah, that's wrong channel, thought this was offtopic, one sec |
08:26:17 | FromDiscord | <Elegantbeef> lol |
08:26:38 | FromDiscord | <Elegantbeef> Irc and matrix will always see that you goofed! |
08:26:55 | FromDiscord | <Phil> Oh no, my life is over |
08:27:15 | PMunch | And since it's in the main channel it's also backed up on irclogs.nim-lang.org |
08:28:13 | FromDiscord | <Elegantbeef> I think at one point my password manager accidentally clicked element and i pasted a random generated password for something into the irclogs 😄 |
08:31:28 | FromDiscord | <newlibarian> is nim a transcompiler or both compiler and transcompiler? in haxe it's a transcompiler. |
08:32:08 | FromDiscord | <Elegantbeef> Depends on your definition of what transpilation is |
08:32:09 | PMunch | @newlibarian, https://peterme.net/is-nim-a-transpiler.html |
08:32:27 | PMunch | @Elegantbeef, ooh, that's no fun |
08:32:41 | * | onetwo quit (Quit: The Lounge - https://thelounge.chat) |
08:32:54 | FromDiscord | <Elegantbeef> I mean it's completely fine cause i use randomly generated passwords 😄 |
08:37:57 | * | onetwo joined #nim |
08:39:40 | PMunch | Sure, as long as you remembered to change it afterwards :P |
08:45:54 | FromDiscord | <Phil> Actually, do C-compilers go C --> Assembly --> Binary or do they go C --> Binary? |
08:46:30 | FromDiscord | <Elegantbeef> They go through assembly |
08:46:35 | FromDiscord | <Elegantbeef> I mean that's even a short path |
08:46:46 | FromDiscord | <Elegantbeef> They are multiple stages and it's all lowerings |
08:46:52 | FromDiscord | <Phil> Because IIRC the "transpile" chain would be:↵Nim --> NimAST --> C --> C-AST (I assume (?)) --> Assembly --> ??? --> Binary |
08:47:04 | FromDiscord | <Elegantbeef> Lol |
08:47:12 | FromDiscord | <Elegantbeef> What a simplification |
08:47:42 | FromDiscord | <Phil> I mean, I'm pretty much ignoring all of Nim's pre-processor stuff, so yeah |
08:47:48 | FromDiscord | <Elegantbeef> For clang it's more like C -\> SomeAst -\> LLVM IR -\> LLVM -\> Assembly -\> Binary |
08:47:50 | FromDiscord | <Phil> And likely other low-level details |
08:48:09 | FromDiscord | <ringabout> Transpiler might use AST to AST transformation directly, which is more easier to generate code. |
08:48:18 | FromDiscord | <ringabout> (edit) "transformation" => "transformations" |
08:48:23 | FromDiscord | <ringabout> (edit) removed "more" |
08:48:27 | FromDiscord | <Elegantbeef> Many compilers have their own intermediate representation that people often remove from the step |
08:48:39 | FromDiscord | <Phil> So basically after Nim-AST all bets are off on how that chain looks like because it depends on the used toolchain after? |
08:48:45 | FromDiscord | <Elegantbeef> The definition of transpilation is always so hand wavy |
08:49:02 | FromDiscord | <Elegantbeef> Of course all the C compilers are different |
08:49:18 | FromDiscord | <Elegantbeef> There's a reason they all offer different levels of optimisation and compilation speed |
08:50:03 | FromDiscord | <Phil> Was more that the idea was floated that Nim-AST e.g. might be turned directly into a C-AST and then handed to a compiler, rather than creating C-code in between |
08:50:36 | FromDiscord | <Elegantbeef> Yea that doesnt make any sense |
08:50:37 | FromDiscord | <Elegantbeef> Each compiler has it's own AST |
08:50:45 | FromDiscord | <Elegantbeef> There is no "C AST standard that everyone must follow" |
08:50:47 | FromDiscord | <ringabout> There is an RFC for AST to AST transformations. |
08:51:16 | FromDiscord | <Elegantbeef> There is? |
08:51:29 | FromDiscord | <ringabout> ^ https://github.com/nim-lang/compilerdev/issues/6 |
08:53:20 | FromDiscord | <Elegantbeef> Ah right not actually AST |
09:20:45 | * | jmdaemon quit (Ping timeout: 255 seconds) |
10:18:09 | * | xet7 quit (Remote host closed the connection) |
10:37:41 | * | jmdaemon joined #nim |
10:39:30 | FromDiscord | <enthus1ast> do we have an ini file to object mapper? |
10:40:54 | FromDiscord | <enthus1ast> https://github.com/ba0f3/sim.nim |
10:52:52 | * | jmdaemon quit (Ping timeout: 246 seconds) |
11:11:42 | PMunch | @sOkam!, looking at the snippet you sent yesterday. How would you want that to be put into the nimble file? |
11:12:04 | PMunch | `import nimbleutils; enableAnyBuild()`? |
12:28:59 | * | dnh joined #nim |
12:52:48 | PMunch | Doesn't mapIt work on empty sequences? |
12:52:56 | PMunch | That's annoying |
12:58:25 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4o96 |
12:58:37 | FromDiscord | <Phil> Works as expected in my book |
13:01:46 | PMunch | Hmm, might be a VM bug then |
13:01:49 | * | kenran joined #nim |
13:01:55 | PMunch | This was on compile-time |
13:08:57 | FromDiscord | <4zv4l> this doesn't seem to work |
13:08:58 | FromDiscord | <4zv4l> sent a code paste, see https://paste.rs/5ID |
13:09:11 | FromDiscord | <4zv4l> between the `echo 1. got: str`↵and the second one in the function that gets the string |
13:09:15 | FromDiscord | <4zv4l> the content of the string is cleared |
13:09:42 | FromDiscord | <4zv4l> does it really copy the cstring ? |
13:11:30 | * | doomduck quit (Remote host closed the connection) |
13:58:29 | FromDiscord | <4zv4l> ok I found how to |
14:00:38 | FromDiscord | <enthus1ast> is there a syntax to give two typed params to a template? |
14:00:53 | FromDiscord | <enthus1ast> `template interaction(elem: IsClickable, onClick: typed, onHover: typed)=` |
14:03:16 | PMunch | @enthus1ast, what do you mean? |
14:03:51 | FromDiscord | <ringabout> `do:` might work. |
14:05:26 | PMunch | Yeah you can have multiple do statements |
14:05:47 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4o9N |
14:06:28 | FromDiscord | <enthus1ast> ah ok |
14:06:28 | FromDiscord | <enthus1ast> thank you |
14:06:54 | FromDiscord | <ringabout> No problem |
14:09:46 | FromDiscord | <Nerve> I'm trying to translate some PHP code that slices an associative array. In PHP, associative arrays preserve order and `array_slice` returns the slices with the key-value pairs in the order they were entered. Can I replicate this with ordered tables? Or do I just use a sequence of 2-tuples? |
14:12:40 | FromDiscord | <ringabout> Ordered tables seem to be a simple option. |
14:14:25 | FromDiscord | <Nerve> How do you slice them? |
14:15:41 | FromDiscord | <ringabout> Do you also need to index them using `key`? |
14:16:03 | FromDiscord | <Nerve> Presumably yes, though that seems to be out of the scope of the file I'm looking at |
14:16:30 | FromDiscord | <ringabout> You might use table indexed seqs. |
14:16:36 | FromDiscord | <4zv4l> can I put the documentation for a `proc` up from its body or I have to write it under it's declaration ? |
14:16:55 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4o9R |
14:17:51 | FromDiscord | <ringabout> In reply to @Nerve "Presumably yes, though that": You store `(key, value)` pairs to seqs, get the index of the current element and store (key, index) to tables. |
14:17:57 | FromDiscord | <ringabout> (edit) "In reply to @Nerve "Presumably yes, though that": You ... store" added "might" |
14:18:18 | FromDiscord | <ringabout> (edit) "(key, index)" => "`(key, index)`" |
14:19:05 | * | azimut quit (Ping timeout: 255 seconds) |
14:21:07 | * | azimut joined #nim |
14:22:52 | FromDiscord | <apahl> This is a nice read (with a positive ending for Nim users): https://mode80.github.io/7-langs-in-12-months.html (sorry if it might have been posted here before, but I could not find it) |
14:24:04 | PMunch | @apahl, it was posted on the forums a couple days ago (and on HN). I believe it was discussed in #offtopic |
14:24:10 | PMunch | But a good read indeed |
14:24:32 | FromDiscord | <apahl> Ah, ok, my apologies then. |
14:25:54 | PMunch | No worries :) |
14:26:06 | PMunch | Better to share it an extra time than people not seeing it |
14:43:50 | * | azimut quit (Ping timeout: 255 seconds) |
14:48:20 | * | azimut joined #nim |
15:02:36 | * | xet7 joined #nim |
15:04:54 | * | PMunch quit (Quit: Leaving) |
15:11:38 | * | arkurious joined #nim |
15:23:26 | * | azimut quit (Ping timeout: 255 seconds) |
15:24:12 | * | azimut joined #nim |
15:33:31 | * | dnh left #nim (Textual IRC Client: www.textualapp.com) |
15:34:12 | * | jmdaemon joined #nim |
15:38:32 | FromDiscord | <4zv4l> how can I take the `10` first char from a string when the string can be less than `10` char long ? |
15:39:10 | FromDiscord | <4zv4l> like can be longer or shorter but I wanna get maximum the first 10 char |
15:39:44 | FromDiscord | <4zv4l> `str[0..(len(str) mod 10]` ? |
15:39:50 | FromDiscord | <4zv4l> (edit) "10]`" => "10)]`" |
15:40:35 | FromDiscord | <enthus1ast> str[0 .. min(10, str.len)] |
15:40:49 | FromDiscord | <enthus1ast> but maybe there's a better option |
15:41:44 | FromDiscord | <enthus1ast> ● the off by one errors \:) |
15:51:32 | FromDiscord | <Phil> str.high |
15:52:28 | FromDiscord | <halc> In reply to @Isofruit "str.high": it'd still get the first 11 characters though ;) |
15:52:46 | FromDiscord | <Phil> Right because it's inclusive |
15:52:49 | FromDiscord | <Phil> 9 then |
15:52:50 | FromDiscord | <halc> `str[0 ..< min(10, str.len)]` |
15:54:19 | FromDiscord | <enthus1ast> +1 |
15:54:20 | FromDiscord | <enthus1ast> off by one errors should be prohibited |
15:54:20 | FromDiscord | <enthus1ast> why are they even allowed \:) |
15:57:16 | FromDiscord | <halc> In reply to @enthus1ast "off by one errors": are you talking about slicing past the last member? |
16:01:28 | * | kenran quit (Remote host closed the connection) |
16:08:00 | * | jmdaemon quit (Ping timeout: 248 seconds) |
16:16:07 | FromDiscord | <halc> oh nevermind, I was thinking of something else |
16:16:37 | FromDiscord | <halc> sent a code paste, see https://play.nim-lang.org/#ix=4oau |
16:17:05 | FromDiscord | <halc> not to bring it up again, pretty sure I already we already talked about this here |
16:17:15 | FromDiscord | <halc> (edit) removed "I already" |
16:17:37 | FromDiscord | <m4ul3r> In reply to @4zv4l "can I put the": i think it needs to be under the func- |
16:22:09 | * | jmdaemon joined #nim |
16:27:05 | * | rockcavera joined #nim |
16:37:31 | * | jmdaemon quit (Ping timeout: 248 seconds) |
16:50:47 | * | jmdaemon joined #nim |
17:00:59 | FromDiscord | <Rika> it must be inside, yes |
17:21:22 | FromDiscord | <Hourglass [She/Her]> How would I attach webdriver to a headless firefox instance? |
17:30:35 | FromDiscord | <Gabben> sent a code paste, see https://play.nim-lang.org/#ix=4oaN |
17:31:58 | FromDiscord | <Hourglass [She/Her]> That's because of how Nim does casing iirc |
17:39:50 | FromDiscord | <Phil> In reply to @Gabben "Is this case related": It is not.↵Nim is type insensitive and ignores underscores, so the following are all the same symbol:↵`is_modal, isModal, IS_MODAL, is_mo_dal, ismodal, ISMODAL` |
17:41:21 | FromDiscord | <Phil> The benefit of this is that we can have both pythonistas and folks from camel-case'd languages write code that does not interfere with each other's style.↵Just because my library uses `addCrudRoutes` doesn't mean you're forced to use it that way, you can use it as the more readable `add_crud_routes` to you |
17:41:54 | FromDiscord | <Phil> (edit) "you" => "you.↵That means all your code can be in the style that you want while all my code can be in the style that I want." |
17:42:29 | FromDiscord | <Phil> That is at the expense that in fairly rare cases you will run into this kind of symbol ambiguity issue like you did, where you have an enum value "HelloReply" and a const "HELLO_REPLY". |
17:43:00 | FromDiscord | <rakgew> wait, I thought it actually looks at the case of the first char no? |
17:43:02 | FromDiscord | <Phil> As long as you're on nim 1.6. the best practice is to prefix enums, so `kHelloReply` in your case |
17:43:04 | FromDiscord | <Rika> it does |
17:43:11 | FromDiscord | <Phil> In reply to @rakgew "wait, I thought it": That it does, my description was incomplete |
17:43:28 | FromDiscord | <Rika> more incorrect |
17:43:28 | FromDiscord | <Phil> I was too focused on trying to present Pros and Cons of this feature |
17:43:29 | FromDiscord | <rakgew> is\_modal is not the same as IS\_MODAL |
17:43:35 | FromDiscord | <Rika> yes |
17:44:01 | FromDiscord | <rakgew> but anyway - I am a big fan of that feature. |
17:44:52 | FromDiscord | <rakgew> for my old eyes I like to be able to put the underscores as spacing.. \:-D |
17:44:54 | FromDiscord | <Phil> 🤷 , the more key point to me was to elaborate on why it matters as folks tend to generally be very surprised by it |
17:45:23 | FromDiscord | <Phil> I dunno why I just got hung up on camelcase |
17:47:23 | FromDiscord | <Gabben> In reply to @Isofruit "As long as you're": Does this mean that on Nim 2.0 this code will work? |
17:51:54 | FromDiscord | <Phil> In reply to @Gabben "Does this mean that": No, because that is about 2 enum values of different enums having the same name. In your case you have a const an an enum share the same name. |
17:52:14 | FromDiscord | <Phil> (edit) "name." => "name and allowing that to happen because nim can infer which enum is meant a lot of the time." |
17:52:21 | FromDiscord | <Phil> (edit) "an" => "and" |
17:53:12 | FromDiscord | <Phil> your options are either going `helloReply` (or anything else with lower-case h), renaming the variable completely, prefix your enum with `k` anyway (or whatever other convention you want to follow) or rename the enum |
17:53:29 | FromDiscord | <Phil> (edit) "enum" => "enum-value" | "enum" => "enum-value" |
17:56:48 | * | jmdaemon quit (Ping timeout: 248 seconds) |
17:59:56 | FromDiscord | <Gabben> In reply to @Isofruit "No, because that is": Thanks for your help! |
18:00:09 | FromDiscord | <Gabben> But it looks like `overloadableEnums` is just an ad hoc to not implement type inference |
18:15:09 | FromDiscord | <eyes> wahoo |
18:16:11 | FromDiscord | <eyes> i have a very simple but long-running function I'm trying to run at the same time as the rest of my program |
18:16:35 | FromDiscord | <eyes> but i need to be able to stop + restart it |
18:17:05 | FromDiscord | <eyes> is there a way to have a shared variable between my main thread and this secondary thread, and write to it from the main thread, telling the second thread to stop? |
18:17:20 | FromDiscord | <eyes> alternatively, maybe async programming is the better way to go about this |
18:18:11 | * | rez joined #nim |
18:25:21 | FromDiscord | <Rika> In reply to @Gabben "But it looks like": ? I don’t understand this |
18:25:23 | FromDiscord | <Phil> In reply to @Gabben "But it looks like": I can't really say much about that, I'm not in the compiler-team by any stretch of the imagination. At most I support a bit of the nim webdev ecosystem if you will. |
18:25:45 | FromDiscord | <Phil> (edit) "will." => "will and explain things here on discord/write docs." |
18:25:46 | * | jmdaemon joined #nim |
18:26:36 | FromDiscord | <Phil> In reply to @eyes "alternatively, maybe async programming": Personally async > multithreading, less hassle. |
18:26:50 | FromDiscord | <Phil> If you have the option of course |
18:27:14 | FromDiscord | <enthus1ast> i think arc/orc made multithreading much more approachable |
18:27:57 | FromDiscord | <Phil> Is it now just "run some proc, pass it another proc that shall be executed as a parameter and receive a Future that'll complete when the thread is finished" ? |
18:28:50 | FromDiscord | <enthus1ast> mh, it is more like, span threads, if they need stuff from me, get it but make sure you lock the area of access |
18:28:55 | FromDiscord | <enthus1ast> from mem |
18:29:07 | FromDiscord | <enthus1ast> spawn threads |
18:29:08 | FromDiscord | <enthus1ast> -.- |
18:29:15 | FromDiscord | <Phil> I was about to ask what "span threads" meant 😄 |
18:29:34 | FromDiscord | <enthus1ast> its not my english its my keyboard.... |
18:29:37 | FromDiscord | <enthus1ast> ;) |
18:29:43 | FromDiscord | <Phil> Excuses |
18:29:44 | FromDiscord | <Phil> 😛 |
18:34:41 | * | azimut quit (Ping timeout: 255 seconds) |
18:35:19 | * | azimut joined #nim |
18:37:10 | FromDiscord | <4zv4l> how do I do a newline in nim doc ? |
18:38:50 | * | derpydoo joined #nim |
18:40:43 | FromDiscord | <eyes> In reply to @Isofruit "Personally async > multithreading,": can you describe how i might solve my problem using async? |
18:41:08 | FromDiscord | <enthus1ast> @4zv4l\: you do an empty line |
18:41:31 | FromDiscord | <eyes> i think i also dont fully understand the difference between async and threading |
18:41:51 | FromDiscord | <eyes> async doesnt create a new thread, so how can it allow another job to run in the background? |
18:42:01 | FromDiscord | <eyes> thats primarily why my first question concerned threading |
18:42:19 | FromDiscord | <enthus1ast> @eyes\: async yields back the control of the thread to a dispatcher |
18:42:30 | FromDiscord | <enthus1ast> and the dispatcher let other stuff run |
18:42:43 | FromDiscord | <Hourglass [She/Her]> For running a headless firefox instance in Nim, what args should I use? `poUsePath` and `poDaemon`? Usepath is probably good so I can just do `firefox` instead of `/firefox/binary/location` |
18:42:53 | FromDiscord | <Hourglass [She/Her]> I don't understand daemons though |
18:43:09 | FromDiscord | <Hourglass [She/Her]> I'm creating a CLI client for a website which is why I want this |
18:44:16 | FromDiscord | <enthus1ast> @eyes\: when you do threading, you can use a Cond variable so signal another thread that it must run\: https://nim-lang.org/docs/locks.html#Cond |
18:44:23 | FromDiscord | <4zv4l> In reply to @enthus1ast "<@329196212282458112>\: you do an": there is not another way ?↵it would take a bunch of newline xD |
18:45:12 | FromDiscord | <4zv4l> but alright |
18:45:14 | FromDiscord | <4zv4l> gonna try |
18:45:42 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4obf |
18:46:55 | FromDiscord | <enthus1ast> in async you do not need to take much care, you can just check a variable |
18:48:24 | FromDiscord | <Gabben> In reply to @Rika "? I don’t understand": Sorry for my English |
19:02:32 | * | PMunch joined #nim |
19:06:39 | * | rockcavera quit (Ping timeout: 255 seconds) |
19:14:17 | * | azimut quit (Ping timeout: 255 seconds) |
19:17:31 | * | azimut joined #nim |
19:28:02 | FromDiscord | <eyes> In reply to @enthus1ast "<@144207211881562112>\: async yields back": so I thought that async was just a nicer way of writing a long series of handler functions. like a way of inserting lazy evaluation into a language that does not have lazy excal |
19:28:07 | FromDiscord | <eyes> eval |
19:28:40 | FromDiscord | <eyes> but i thought that evaluation some Future object stops the primary thread while the lazy evaluation resolves what it should be |
19:31:07 | FromDiscord | <eyes> where did i go wrong |
19:31:14 | FromDiscord | <eyes> (edit) "where did i go wrong ... " added "in my thinking" |
19:33:50 | * | rockcavera joined #nim |
19:33:50 | * | rockcavera quit (Changing host) |
19:33:50 | * | rockcavera joined #nim |
19:35:05 | FromDiscord | <enthus1ast> idk how to answer, but here is an example\: |
19:35:25 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4obs |
19:37:00 | FromDiscord | <enthus1ast> here you see that on the await, the other proc gets a turn to run, until the next await |
19:43:02 | * | tiorock joined #nim |
19:43:02 | * | tiorock quit (Changing host) |
19:43:02 | * | tiorock joined #nim |
19:43:02 | * | rockcavera is now known as Guest6906 |
19:43:02 | * | tiorock is now known as rockcavera |
19:44:30 | * | rez quit (Read error: Connection reset by peer) |
19:46:16 | * | Guest6906 quit (Ping timeout: 246 seconds) |
19:49:57 | * | peterhil joined #nim |
20:17:02 | FromDiscord | <matrix07012> since Row from db libraries is just seq[string], how do i turn it back into seq[string]? |
20:17:17 | FromDiscord | <Phil> In reply to @eyes "so I thought that": Async starts becoming relevant if some of the work you do does not depend on your code and you have to wait for somebody else to finish their job |
20:18:34 | FromDiscord | <Phil> Typical scenarios are IO where not you write to disk but the OS and you just wait for it to finish (maybe feed it what to write next occasionally), or HTTP requests where you wait for the response |
20:18:49 | FromDiscord | <Phil> (edit) "Typical scenarios are IO where not you write to disk but the OS ... and" added "does" |
20:28:52 | FromDiscord | <enthus1ast> do we have a seq get `[]` that returns a var ? |
20:28:59 | FromDiscord | <enthus1ast> var T? |
20:29:35 | FromDiscord | <Yandall> How can I read enviroment variables from a .env file? |
20:31:47 | FromDiscord | <Phil> sent a long message, see http://ix.io/4oby |
20:33:08 | FromDiscord | <auxym> maybe https://nim-lang.org/docs/parsecfg.html would work? if its just key=value pairs |
20:33:56 | FromDiscord | <Phil> I mean, personally I'd just write and read JSON because it's a comparatively popular data-format, assuming it's only for machine consumption |
20:35:52 | FromDiscord | <Yandall> In reply to @Isofruit "I mean, personally I'd": Now that you say it, I do think it will be better to use json, at least for me |
20:36:26 | FromDiscord | <auxym> the .env key=value has become some sort of non-official de facto standard, for better or worse, so I assumed @Yandall might have existing files or something |
20:37:58 | FromDiscord | <Yepoleb> In reply to @Yandall "How can I read": you mean just general config variables, right? they do not have to be set as environment variables |
20:38:51 | FromDiscord | <Phil> I wonder if some folks still configure with XML on Linux |
20:39:05 | FromDiscord | <Yandall> In reply to @Yepoleb "you mean just general": Yeah, there is no need for that |
20:39:17 | FromDiscord | <enthus1ast> i must admit i would rather do xml again than yaml |
20:39:27 | FromDiscord | <enthus1ast> yaml is terrible.... |
20:39:55 | FromDiscord | <Phil> For complex scenarios I agree that's true, though it is nice to write in simple cases!↵... which were the only cases I had to deal with yaml so far |
20:41:08 | FromDiscord | <enthus1ast> take all the configs out there, i mess up yaml all the time, also for simple stuff, xml (or rather html) i do not mess up that often, could be me of course, but i think its much simpler to parse xml |
20:42:05 | FromDiscord | <enthus1ast> which is unpopular opinion in todays world \:D |
20:46:00 | * | advesperacit quit () |
20:49:15 | FromDiscord | <auxym> In reply to @Isofruit "I wonder if some": did anyone ever use XML on linux? |
20:49:52 | FromDiscord | <Phil> I'm willing to bet they did in the 2000's |
20:50:08 | FromDiscord | <Phil> Those were wild times |
20:52:32 | * | rez joined #nim |
20:52:46 | PMunch | @auxym, well for interfacing with Microsoft APIs there really isn't much choice |
20:53:09 | PMunch | And arguably if you open a docx I believe you're loading XML |
20:53:59 | FromDiscord | <Yepoleb> Apache has a weird mixed config format with some xml elements |
20:55:01 | * | rez quit (Client Quit) |
21:09:37 | FromDiscord | <auxym> yeah, I meant more as in linux OS-related config |
21:09:54 | FromDiscord | <auxym> open office formats are XML also I believed |
21:10:09 | FromDiscord | <auxym> and Maven (java package manager) |
21:10:52 | FromDiscord | <niguss_101-_-> Does anybody have experience on css |
21:11:10 | * | beholders_eye joined #nim |
21:20:57 | PMunch | niguss_101-_-, unfortunately yes |
21:31:04 | FromDiscord | <Yepoleb> https://media.discordapp.net/attachments/371759389889003532/1075529700472016916/EAmr-PAWsAEoiWR.png |
21:31:54 | * | beholders_eye quit (Ping timeout: 255 seconds) |
21:39:00 | FromDiscord | <4zv4l> how do you make some field in an object private ? |
21:39:40 | FromDiscord | <Elegantbeef> Fields are by default private |
21:51:07 | FromDiscord | <jtv> async is low-rent manual threading where each thread gets to run as long as it wants until it yields 🙂 |
21:51:25 | FromDiscord | <jtv> Oh whoops, that's old and not relevant anymore, lol, thanks discord |
21:52:30 | PMunch | @jtv, important distinction though is that async doesn't actually run stuff at the same time, unless you count stuff you've asked the OS to do and are waiting around for |
21:54:37 | FromDiscord | <jtv> Right, it's time slicing the thread you're running in yourself |
21:54:50 | FromDiscord | <jtv> Great for GIL-locked environments |
21:55:14 | FromDiscord | <jtv> A dubious abstraction elsewhere |
21:57:41 | FromDiscord | <Yepoleb> i treat it as an abstraction for select, it works quite well for that |
22:01:08 | PMunch | Same |
22:02:06 | FromDiscord | <Yepoleb> threads don't scale well for high network loads |
22:02:56 | PMunch | Threads don't scale well full stop |
22:03:59 | PMunch | I mean for ultimate performance you run one async dispatcher per thread and distribute you work over a couple threads |
22:04:30 | PMunch | Assuming you've also got some amount of work with every requests which is worth the communication overhead |
22:11:04 | * | PMunch quit (Quit: leaving) |
22:48:57 | FromDiscord | <auxym> In reply to @jtv "Great for GIL-locked environments": correction: great for IO-limited things. eg doing "other stuff" while you're waiting for a http reply or DB transaction to complete. |
22:51:57 | * | derpydoo quit (Quit: derpydoo) |
23:25:20 | FromDiscord | <eyes> In reply to @PMunch "@jtv, important distinction though": okay this is what i thought! |
23:25:29 | FromDiscord | <eyes> i dont really understand why it is considered threading then |
23:27:33 | FromDiscord | <eyes> okay im dying |
23:27:39 | FromDiscord | <eyes> is there some way to "kill" a thread? |
23:27:59 | FromDiscord | <eyes> I guess just let the thread object go out of scope? |
23:35:15 | FromDiscord | <Yepoleb> In reply to @eyes "is there some way": not really, regular termination is often the only option |
23:35:28 | FromDiscord | <eyes> interesting |
23:35:48 | FromDiscord | <eyes> okay thanks |
23:36:31 | FromDiscord | <Yepoleb> common methods are to set a variable that is regularly checked in the inner loop of the thread |
23:36:50 | FromDiscord | <Yepoleb> or to close the socket the thread is waiting on for example |
23:39:23 | FromDiscord | <eyes> In reply to @Yepoleb "common methods are to": how could you share variables between threads in this way? dont threads in nim have separate heaps |
23:43:07 | FromDiscord | <Elegantbeef> Orc/arc do not have seperate heaps |
23:43:10 | FromDiscord | <Elegantbeef> You also can manually manage shared heap memory |
23:45:34 | om3ga | shared heap is the best solution |
23:50:53 | FromDiscord | <eyes> beans |
23:51:16 | FromDiscord | <eyes> i really dont want to dive into something like that, im only just learning the language |
23:51:33 | FromDiscord | <eyes> im still hoping for the async solution to work out |
23:58:56 | FromDiscord | <Yepoleb> In reply to @eyes "how could you share": i'd share a pointer |
23:59:07 | FromDiscord | <Yepoleb> ideally to an atomic variable |