<< 15-02-2023 >>

00:17:43FromDiscord<Odi> sent a code paste, see https://play.nim-lang.org/#ix=4o5X
00:21:08FromDiscord<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:15FromDiscord<Odi> sent a code paste, see https://play.nim-lang.org/#ix=4o64
00:50:43FromDiscord<Elegantbeef> So it's not
00:51:01FromDiscord<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:51FromDiscord<Odi> sent a code paste, see https://play.nim-lang.org/#ix=4o6a
02:34:59*jmdaemon quit (Ping timeout: 252 seconds)
04:24:36FromDiscord<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:56FromDiscord<Rika> Files embedded into the executable will always be modifiable in a way, it just depends how hard you make it
04:30:32FromDiscord<newlibarian> i meant for the average joe that don't code and just play games.
04:30:56FromDiscord<newlibarian> coders will always to find a way to hack your game.
04:33:20FromDiscord<Rika> A modder could make it so that an average Joe could change it
04:33:45FromDiscord<newlibarian> what is a modder and where can i get it?
04:34:05FromDiscord<Rika> A person who modifies games for fun or whatever
04:44:55FromDiscord<newlibarian> https://github.com/Vladar4/sdl2_nim
04:45:08FromDiscord<newlibarian> this is a newb question. how do i install this?
05:09:08*arkurious quit (Quit: Leaving)
05:57:52FromDiscord<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:37FromDiscord<Yepoleb> It seems like almost everyone eventually needs it
05:59:41FromDiscord<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:10FromDiscord<ringabout> In reply to @Yepoleb "It seems like almost": Perhaps https://github.com/nim-lang/Nim/issues/14810
06:04:10FromDiscord<Rika> Isn’t there a third party library for that
06:15:42FromDiscord<Yepoleb> In reply to @ringabout "Perhaps https://github.com/nim-lang/Nim/issues/1481": That describes the problem but never went anywhere
06:17:19FromDiscord<Rika> In reply to @Yepoleb "That describes the problem": ~~like a lot of the issues~~
06:32:57FromDiscord<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:12FromDiscord<Hourglass [She/Her]> Kinda like Puppeteer ig
06:49:11*advesperacit joined #nim
06:55:35FromDiscord<Hourglass [She/Her]> The webdriver module looks interesting
06:55:46FromDiscord<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:10FromDiscord<Phil> Keep in mind to close and re-open the terminal to the environmental variable can take effect
06:57:23FromDiscord<Phil> In reply to @BobBBob "feel like that should": One sec, I can not confirm what Yepo said here, `join` exists
06:59:27FromDiscord<Phil> sent a code paste, see https://paste.rs/0lM
07:01:39FromDiscord<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:20FromDiscord<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:31FromDiscord<Phil> Which uses firefox I think
07:03:32FromDiscord<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:57FromDiscord<Phil> https://github.com/dom96/webdriver↵↵Usage examples are in the readme of it
07:04:32*jmdaemon joined #nim
07:06:06FromDiscord<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:40FromDiscord<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:11FromDiscord<newlibarian> where do i find more info on staticread and compiling to web?
07:12:25FromDiscord<Rika> Web as in JavaScript?
07:13:31FromDiscord<newlibarian> yes, how do i compile a game to web?
07:14:55FromDiscord<Rika> Not all libraries in Nim are able to be compiled into JavaScript
07:15:45FromDiscord<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:50FromDiscord<newlibarian> i just want to make a game in sdl and compile to linux, web and win
07:16:03FromDiscord<Elegantbeef> Well then you'd use emscripten and compile to web assembly
07:16:05FromDiscord<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:21FromDiscord<Elegantbeef> https://github.com/treeform/nim_emscripten_tutorial
07:16:29FromDiscord<Phil> staticRead: https://nim-lang.org/docs/system.html#staticRead%2Cstring
07:18:58FromDiscord<newlibarian> another newb question how do i convert raw data files: txt, png, video, ect to bin to be read by staticread?
07:19:30FromDiscord<Elegantbeef> You literally just read them
07:19:48FromDiscord<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:21FromDiscord<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:43FromDiscord<Elegantbeef> \well there is a caveat there
07:36:03FromDiscord<Phil> There is?
07:36:10FromDiscord<Elegantbeef> Yea
07:36:25FromDiscord<Elegantbeef> `let doThing = static: staticRead("bleh")` is valid
07:36:56FromDiscord<Phil> Okay fair, but at that point what actually happens is this turns into `let doThing = <FileContentAsString>`
07:37:35FromDiscord<Elegantbeef> Hey it's a caveat!
07:37:45*PMunch joined #nim
07:40:31FromDiscord<newlibarian> how do i compile for linux? install nim on linux and compile for linux?
07:41:02Amun-Ranewlibarian: have you read build procedure on nim webpage?
07:41:29FromDiscord<newlibarian> i skimmed through it a few months ago.
07:41:59FromDiscord<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:53Amun-Ranewlibarian: it's almost as simple as running four commands. https://nim-lang.org/install_unix.html
07:43:58FromDiscord<huantian> You can build your program on Linux
07:44:04FromDiscord<huantian> Or cross compile from windows
07:44:16FromDiscord<huantian> https://nim-lang.org/docs/nimc.html
07:44:19FromDiscord<huantian> Has stuff in it I think
07:44:41Amun-Racross compiling for linux can be tricky (unless one build inside wsl)
07:45:00Amun-Racrosscompiling 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:42PMunch@newlibarian, you might also find this interesting: https://forum.nim-lang.org/t/7534
08:12:24FromDiscord<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:47FromDiscord<Elegantbeef> Nothing fancy presently but I do have
08:12:49FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1075328816106446909/image.png
08:13:24FromDiscord<Elegantbeef> Primitives and typedefs, still need sets and the like, which is the complicated stuff
08:16:44FromDiscord<newlibarian> nimble install sdl2_nim@#legacy
08:16:49FromDiscord<newlibarian> where does it install to?
08:16:57FromDiscord<Elegantbeef> `.nimble/pkgs`
08:20:38PMunch@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:13PMunchBy the way is `intptr_t` the correct in `doThing`? Wouldn't that just be passed by value?
08:21:34FromDiscord<Elegantbeef> `intptr_t` is an integer the size of a pointer
08:24:21FromDiscord<Elegantbeef> I suppose one could use the target arch to emit specific integer sizes
08:25:47FromDiscord<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:07FromDiscord<Phil> Ah, that's wrong channel, thought this was offtopic, one sec
08:26:17FromDiscord<Elegantbeef> lol
08:26:38FromDiscord<Elegantbeef> Irc and matrix will always see that you goofed!
08:26:55FromDiscord<Phil> Oh no, my life is over
08:27:15PMunchAnd since it's in the main channel it's also backed up on irclogs.nim-lang.org
08:28:13FromDiscord<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:28FromDiscord<newlibarian> is nim a transcompiler or both compiler and transcompiler? in haxe it's a transcompiler.
08:32:08FromDiscord<Elegantbeef> Depends on your definition of what transpilation is
08:32:09PMunch@newlibarian, https://peterme.net/is-nim-a-transpiler.html
08:32:27PMunch@Elegantbeef, ooh, that's no fun
08:32:41*onetwo quit (Quit: The Lounge - https://thelounge.chat)
08:32:54FromDiscord<Elegantbeef> I mean it's completely fine cause i use randomly generated passwords 😄
08:37:57*onetwo joined #nim
08:39:40PMunchSure, as long as you remembered to change it afterwards :P
08:45:54FromDiscord<Phil> Actually, do C-compilers go C --> Assembly --> Binary or do they go C --> Binary?
08:46:30FromDiscord<Elegantbeef> They go through assembly
08:46:35FromDiscord<Elegantbeef> I mean that's even a short path
08:46:46FromDiscord<Elegantbeef> They are multiple stages and it's all lowerings
08:46:52FromDiscord<Phil> Because IIRC the "transpile" chain would be:↵Nim --> NimAST --> C --> C-AST (I assume (?)) --> Assembly --> ??? --> Binary
08:47:04FromDiscord<Elegantbeef> Lol
08:47:12FromDiscord<Elegantbeef> What a simplification
08:47:42FromDiscord<Phil> I mean, I'm pretty much ignoring all of Nim's pre-processor stuff, so yeah
08:47:48FromDiscord<Elegantbeef> For clang it's more like C -\> SomeAst -\> LLVM IR -\> LLVM -\> Assembly -\> Binary
08:47:50FromDiscord<Phil> And likely other low-level details
08:48:09FromDiscord<ringabout> Transpiler might use AST to AST transformation directly, which is more easier to generate code.
08:48:18FromDiscord<ringabout> (edit) "transformation" => "transformations"
08:48:23FromDiscord<ringabout> (edit) removed "more"
08:48:27FromDiscord<Elegantbeef> Many compilers have their own intermediate representation that people often remove from the step
08:48:39FromDiscord<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:45FromDiscord<Elegantbeef> The definition of transpilation is always so hand wavy
08:49:02FromDiscord<Elegantbeef> Of course all the C compilers are different
08:49:18FromDiscord<Elegantbeef> There's a reason they all offer different levels of optimisation and compilation speed
08:50:03FromDiscord<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:36FromDiscord<Elegantbeef> Yea that doesnt make any sense
08:50:37FromDiscord<Elegantbeef> Each compiler has it's own AST
08:50:45FromDiscord<Elegantbeef> There is no "C AST standard that everyone must follow"
08:50:47FromDiscord<ringabout> There is an RFC for AST to AST transformations.
08:51:16FromDiscord<Elegantbeef> There is?
08:51:29FromDiscord<ringabout> ^ https://github.com/nim-lang/compilerdev/issues/6
08:53:20FromDiscord<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:30FromDiscord<enthus1ast> do we have an ini file to object mapper?
10:40:54FromDiscord<enthus1ast> https://github.com/ba0f3/sim.nim
10:52:52*jmdaemon quit (Ping timeout: 246 seconds)
11:11:42PMunch@sOkam!, looking at the snippet you sent yesterday. How would you want that to be put into the nimble file?
11:12:04PMunch`import nimbleutils; enableAnyBuild()`?
12:28:59*dnh joined #nim
12:52:48PMunchDoesn't mapIt work on empty sequences?
12:52:56PMunchThat's annoying
12:58:25FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4o96
12:58:37FromDiscord<Phil> Works as expected in my book
13:01:46PMunchHmm, might be a VM bug then
13:01:49*kenran joined #nim
13:01:55PMunchThis was on compile-time
13:08:57FromDiscord<4zv4l> this doesn't seem to work
13:08:58FromDiscord<4zv4l> sent a code paste, see https://paste.rs/5ID
13:09:11FromDiscord<4zv4l> between the `echo 1. got: str`↵and the second one in the function that gets the string
13:09:15FromDiscord<4zv4l> the content of the string is cleared
13:09:42FromDiscord<4zv4l> does it really copy the cstring ?
13:11:30*doomduck quit (Remote host closed the connection)
13:58:29FromDiscord<4zv4l> ok I found how to
14:00:38FromDiscord<enthus1ast> is there a syntax to give two typed params to a template?
14:00:53FromDiscord<enthus1ast> `template interaction(elem: IsClickable, onClick: typed, onHover: typed)=`
14:03:16PMunch@enthus1ast, what do you mean?
14:03:51FromDiscord<ringabout> `do:` might work.
14:05:26PMunchYeah you can have multiple do statements
14:05:47FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4o9N
14:06:28FromDiscord<enthus1ast> ah ok
14:06:28FromDiscord<enthus1ast> thank you
14:06:54FromDiscord<ringabout> No problem
14:09:46FromDiscord<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:40FromDiscord<ringabout> Ordered tables seem to be a simple option.
14:14:25FromDiscord<Nerve> How do you slice them?
14:15:41FromDiscord<ringabout> Do you also need to index them using `key`?
14:16:03FromDiscord<Nerve> Presumably yes, though that seems to be out of the scope of the file I'm looking at
14:16:30FromDiscord<ringabout> You might use table indexed seqs.
14:16:36FromDiscord<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:55FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4o9R
14:17:51FromDiscord<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:57FromDiscord<ringabout> (edit) "In reply to @Nerve "Presumably yes, though that": You ... store" added "might"
14:18:18FromDiscord<ringabout> (edit) "(key, index)" => "`(key, index)`"
14:19:05*azimut quit (Ping timeout: 255 seconds)
14:21:07*azimut joined #nim
14:22:52FromDiscord<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:04PMunch@apahl, it was posted on the forums a couple days ago (and on HN). I believe it was discussed in #offtopic
14:24:10PMunchBut a good read indeed
14:24:32FromDiscord<apahl> Ah, ok, my apologies then.
14:25:54PMunchNo worries :)
14:26:06PMunchBetter 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:32FromDiscord<4zv4l> how can I take the `10` first char from a string when the string can be less than `10` char long ?
15:39:10FromDiscord<4zv4l> like can be longer or shorter but I wanna get maximum the first 10 char
15:39:44FromDiscord<4zv4l> `str[0..(len(str) mod 10]` ?
15:39:50FromDiscord<4zv4l> (edit) "10]`" => "10)]`"
15:40:35FromDiscord<enthus1ast> str[0 .. min(10, str.len)]
15:40:49FromDiscord<enthus1ast> but maybe there's a better option
15:41:44FromDiscord<enthus1ast> ● the off by one errors \:)
15:51:32FromDiscord<Phil> str.high
15:52:28FromDiscord<halc> In reply to @Isofruit "str.high": it'd still get the first 11 characters though ;)
15:52:46FromDiscord<Phil> Right because it's inclusive
15:52:49FromDiscord<Phil> 9 then
15:52:50FromDiscord<halc> `str[0 ..< min(10, str.len)]`
15:54:19FromDiscord<enthus1ast> +1
15:54:20FromDiscord<enthus1ast> off by one errors should be prohibited
15:54:20FromDiscord<enthus1ast> why are they even allowed \:)
15:57:16FromDiscord<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:07FromDiscord<halc> oh nevermind, I was thinking of something else
16:16:37FromDiscord<halc> sent a code paste, see https://play.nim-lang.org/#ix=4oau
16:17:05FromDiscord<halc> not to bring it up again, pretty sure I already we already talked about this here
16:17:15FromDiscord<halc> (edit) removed "I already"
16:17:37FromDiscord<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:59FromDiscord<Rika> it must be inside, yes
17:21:22FromDiscord<Hourglass [She/Her]> How would I attach webdriver to a headless firefox instance?
17:30:35FromDiscord<Gabben> sent a code paste, see https://play.nim-lang.org/#ix=4oaN
17:31:58FromDiscord<Hourglass [She/Her]> That's because of how Nim does casing iirc
17:39:50FromDiscord<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:21FromDiscord<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:54FromDiscord<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:29FromDiscord<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:00FromDiscord<rakgew> wait, I thought it actually looks at the case of the first char no?
17:43:02FromDiscord<Phil> As long as you're on nim 1.6. the best practice is to prefix enums, so `kHelloReply` in your case
17:43:04FromDiscord<Rika> it does
17:43:11FromDiscord<Phil> In reply to @rakgew "wait, I thought it": That it does, my description was incomplete
17:43:28FromDiscord<Rika> more incorrect
17:43:28FromDiscord<Phil> I was too focused on trying to present Pros and Cons of this feature
17:43:29FromDiscord<rakgew> is\_modal is not the same as IS\_MODAL
17:43:35FromDiscord<Rika> yes
17:44:01FromDiscord<rakgew> but anyway - I am a big fan of that feature.
17:44:52FromDiscord<rakgew> for my old eyes I like to be able to put the underscores as spacing.. \:-D
17:44:54FromDiscord<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:23FromDiscord<Phil> I dunno why I just got hung up on camelcase
17:47:23FromDiscord<Gabben> In reply to @Isofruit "As long as you're": Does this mean that on Nim 2.0 this code will work?
17:51:54FromDiscord<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:14FromDiscord<Phil> (edit) "name." => "name and allowing that to happen because nim can infer which enum is meant a lot of the time."
17:52:21FromDiscord<Phil> (edit) "an" => "and"
17:53:12FromDiscord<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:29FromDiscord<Phil> (edit) "enum" => "enum-value" | "enum" => "enum-value"
17:56:48*jmdaemon quit (Ping timeout: 248 seconds)
17:59:56FromDiscord<Gabben> In reply to @Isofruit "No, because that is": Thanks for your help!
18:00:09FromDiscord<Gabben> But it looks like `overloadableEnums` is just an ad hoc to not implement type inference
18:15:09FromDiscord<eyes> wahoo
18:16:11FromDiscord<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:35FromDiscord<eyes> but i need to be able to stop + restart it
18:17:05FromDiscord<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:20FromDiscord<eyes> alternatively, maybe async programming is the better way to go about this
18:18:11*rez joined #nim
18:25:21FromDiscord<Rika> In reply to @Gabben "But it looks like": ? I don’t understand this
18:25:23FromDiscord<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:45FromDiscord<Phil> (edit) "will." => "will and explain things here on discord/write docs."
18:25:46*jmdaemon joined #nim
18:26:36FromDiscord<Phil> In reply to @eyes "alternatively, maybe async programming": Personally async > multithreading, less hassle.
18:26:50FromDiscord<Phil> If you have the option of course
18:27:14FromDiscord<enthus1ast> i think arc/orc made multithreading much more approachable
18:27:57FromDiscord<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:50FromDiscord<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:55FromDiscord<enthus1ast> from mem
18:29:07FromDiscord<enthus1ast> spawn threads
18:29:08FromDiscord<enthus1ast> -.-
18:29:15FromDiscord<Phil> I was about to ask what "span threads" meant 😄
18:29:34FromDiscord<enthus1ast> its not my english its my keyboard....
18:29:37FromDiscord<enthus1ast> ;)
18:29:43FromDiscord<Phil> Excuses
18:29:44FromDiscord<Phil> 😛
18:34:41*azimut quit (Ping timeout: 255 seconds)
18:35:19*azimut joined #nim
18:37:10FromDiscord<4zv4l> how do I do a newline in nim doc ?
18:38:50*derpydoo joined #nim
18:40:43FromDiscord<eyes> In reply to @Isofruit "Personally async > multithreading,": can you describe how i might solve my problem using async?
18:41:08FromDiscord<enthus1ast> @4zv4l\: you do an empty line
18:41:31FromDiscord<eyes> i think i also dont fully understand the difference between async and threading
18:41:51FromDiscord<eyes> async doesnt create a new thread, so how can it allow another job to run in the background?
18:42:01FromDiscord<eyes> thats primarily why my first question concerned threading
18:42:19FromDiscord<enthus1ast> @eyes\: async yields back the control of the thread to a dispatcher
18:42:30FromDiscord<enthus1ast> and the dispatcher let other stuff run
18:42:43FromDiscord<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:53FromDiscord<Hourglass [She/Her]> I don't understand daemons though
18:43:09FromDiscord<Hourglass [She/Her]> I'm creating a CLI client for a website which is why I want this
18:44:16FromDiscord<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:23FromDiscord<4zv4l> In reply to @enthus1ast "<@329196212282458112>\: you do an": there is not another way ?↵it would take a bunch of newline xD
18:45:12FromDiscord<4zv4l> but alright
18:45:14FromDiscord<4zv4l> gonna try
18:45:42FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4obf
18:46:55FromDiscord<enthus1ast> in async you do not need to take much care, you can just check a variable
18:48:24FromDiscord<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:02FromDiscord<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:07FromDiscord<eyes> eval
19:28:40FromDiscord<eyes> but i thought that evaluation some Future object stops the primary thread while the lazy evaluation resolves what it should be
19:31:07FromDiscord<eyes> where did i go wrong
19:31:14FromDiscord<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:05FromDiscord<enthus1ast> idk how to answer, but here is an example\:
19:35:25FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4obs
19:37:00FromDiscord<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:02FromDiscord<matrix07012> since Row from db libraries is just seq[string], how do i turn it back into seq[string]?
20:17:17FromDiscord<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:34FromDiscord<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:49FromDiscord<Phil> (edit) "Typical scenarios are IO where not you write to disk but the OS ... and" added "does"
20:28:52FromDiscord<enthus1ast> do we have a seq get `[]` that returns a var ?
20:28:59FromDiscord<enthus1ast> var T?
20:29:35FromDiscord<Yandall> How can I read enviroment variables from a .env file?
20:31:47FromDiscord<Phil> sent a long message, see http://ix.io/4oby
20:33:08FromDiscord<auxym> maybe https://nim-lang.org/docs/parsecfg.html would work? if its just key=value pairs
20:33:56FromDiscord<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:52FromDiscord<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:26FromDiscord<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:58FromDiscord<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:51FromDiscord<Phil> I wonder if some folks still configure with XML on Linux
20:39:05FromDiscord<Yandall> In reply to @Yepoleb "you mean just general": Yeah, there is no need for that
20:39:17FromDiscord<enthus1ast> i must admit i would rather do xml again than yaml
20:39:27FromDiscord<enthus1ast> yaml is terrible....
20:39:55FromDiscord<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:08FromDiscord<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:05FromDiscord<enthus1ast> which is unpopular opinion in todays world \:D
20:46:00*advesperacit quit ()
20:49:15FromDiscord<auxym> In reply to @Isofruit "I wonder if some": did anyone ever use XML on linux?
20:49:52FromDiscord<Phil> I'm willing to bet they did in the 2000's
20:50:08FromDiscord<Phil> Those were wild times
20:52:32*rez joined #nim
20:52:46PMunch@auxym, well for interfacing with Microsoft APIs there really isn't much choice
20:53:09PMunchAnd arguably if you open a docx I believe you're loading XML
20:53:59FromDiscord<Yepoleb> Apache has a weird mixed config format with some xml elements
20:55:01*rez quit (Client Quit)
21:09:37FromDiscord<auxym> yeah, I meant more as in linux OS-related config
21:09:54FromDiscord<auxym> open office formats are XML also I believed
21:10:09FromDiscord<auxym> and Maven (java package manager)
21:10:52FromDiscord<niguss_101-_-> Does anybody have experience on css
21:11:10*beholders_eye joined #nim
21:20:57PMunchniguss_101-_-, unfortunately yes
21:31:04FromDiscord<Yepoleb> https://media.discordapp.net/attachments/371759389889003532/1075529700472016916/EAmr-PAWsAEoiWR.png
21:31:54*beholders_eye quit (Ping timeout: 255 seconds)
21:39:00FromDiscord<4zv4l> how do you make some field in an object private ?
21:39:40FromDiscord<Elegantbeef> Fields are by default private
21:51:07FromDiscord<jtv> async is low-rent manual threading where each thread gets to run as long as it wants until it yields 🙂
21:51:25FromDiscord<jtv> Oh whoops, that's old and not relevant anymore, lol, thanks discord
21:52:30PMunch@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:37FromDiscord<jtv> Right, it's time slicing the thread you're running in yourself
21:54:50FromDiscord<jtv> Great for GIL-locked environments
21:55:14FromDiscord<jtv> A dubious abstraction elsewhere
21:57:41FromDiscord<Yepoleb> i treat it as an abstraction for select, it works quite well for that
22:01:08PMunchSame
22:02:06FromDiscord<Yepoleb> threads don't scale well for high network loads
22:02:56PMunchThreads don't scale well full stop
22:03:59PMunchI mean for ultimate performance you run one async dispatcher per thread and distribute you work over a couple threads
22:04:30PMunchAssuming 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:57FromDiscord<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:20FromDiscord<eyes> In reply to @PMunch "@jtv, important distinction though": okay this is what i thought!
23:25:29FromDiscord<eyes> i dont really understand why it is considered threading then
23:27:33FromDiscord<eyes> okay im dying
23:27:39FromDiscord<eyes> is there some way to "kill" a thread?
23:27:59FromDiscord<eyes> I guess just let the thread object go out of scope?
23:35:15FromDiscord<Yepoleb> In reply to @eyes "is there some way": not really, regular termination is often the only option
23:35:28FromDiscord<eyes> interesting
23:35:48FromDiscord<eyes> okay thanks
23:36:31FromDiscord<Yepoleb> common methods are to set a variable that is regularly checked in the inner loop of the thread
23:36:50FromDiscord<Yepoleb> or to close the socket the thread is waiting on for example
23:39:23FromDiscord<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:07FromDiscord<Elegantbeef> Orc/arc do not have seperate heaps
23:43:10FromDiscord<Elegantbeef> You also can manually manage shared heap memory
23:45:34om3gashared heap is the best solution
23:50:53FromDiscord<eyes> beans
23:51:16FromDiscord<eyes> i really dont want to dive into something like that, im only just learning the language
23:51:33FromDiscord<eyes> im still hoping for the async solution to work out
23:58:56FromDiscord<Yepoleb> In reply to @eyes "how could you share": i'd share a pointer
23:59:07FromDiscord<Yepoleb> ideally to an atomic variable