<< 10-01-2023 >>

00:00:04FromDiscord<jmgomez> Is there a way to provide a path to the std without modifying the sources?
00:35:10FromDiscord<! Nilts> `staticRead` is reading from the path of the module, not from the path of the main file, resulting in many headaches. How would i change this functionality
00:40:21FromDiscord<! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4kMe
00:45:18*syl quit (Ping timeout: 256 seconds)
00:45:58*syl joined #nim
00:51:33*termer quit (Remote host closed the connection)
00:51:53*termer joined #nim
00:58:54FromDiscord<pyolyokh> I wouldn't expect it to be a catchable exception. Maybe it's not one.
00:59:48FromDiscord<amadan> sent a code paste, see https://paste.rs/Ema
01:22:31*ltriant quit (Ping timeout: 256 seconds)
01:54:20FromDiscord<Elegantbeef> @pmp-p anywho i'm rewriting this in more idiomatic Nim to see if i can help any
02:08:35FromDiscord<pmp-p> In reply to @Elegantbeef "<@334096250897170433> anywho i'm rewriting": for now that works https://wyz.fr/9K-2D but sure if anyone can improve it, it's the way to green threading on browser
02:08:52FromDiscord<pmp-p> i got lost in asyncdispatch
02:09:05FromDiscord<pmp-p> (edit) "asyncdispatch" => "asyncdispatch, iterators seems way easier"
02:09:48*estiquelapice quit (Ping timeout: 272 seconds)
02:11:36FromDiscord<Elegantbeef> Wait strformat supports that `=` syntax? 😄
02:11:53FromDiscord<pmp-p> i was so happy to see that 🙂
02:12:09FromDiscord<Elegantbeef> TIL
02:12:52FromDiscord<Elegantbeef> Not using pylib makes your code much more readable
02:13:13FromDiscord<Elegantbeef> Also you can do `var ctx = ContextRef()`
02:14:06FromDiscord<Elegantbeef> Also `block` doesnt do anything btw
02:14:11FromDiscord<Elegantbeef> It's the same as no code being there
02:14:21FromDiscord<Elegantbeef> I mean it's the same as the code without indent
02:14:43FromDiscord<pmp-p> yeah i removed it
02:16:33FromDiscord<pmp-p> with that https://wyz.fr/8J-KL i should be able to have toplevel green threads, this is just enough for SDL games
02:16:58FromDiscord<Elegantbeef> Me going "Who needs green threads, make all the code blocking!" 😄
02:17:13FromDiscord<pmp-p> and browser will kill ya ...
02:17:31FromDiscord<pmp-p> though they extend the timeout recently
02:17:34FromDiscord<pmp-p> (edit) "extend" => "extended"
02:17:34FromDiscord<Elegantbeef> Browser schnauzer
02:18:14FromDiscord<Elegantbeef> Also i doubt you'll use it but `args: ptr UncheckedArray[cstring]` is more correct
02:18:22FromDiscord<Elegantbeef> Pointless code reviews aside, nice that this works for you
02:19:57*estiquelapice joined #nim
02:21:23FromDiscord<pmp-p> In reply to @Elegantbeef "Also you can do": does not work it get tasking.nim(13, 21) Error: expected type, but got: ContextRef()
02:21:34FromDiscord<Elegantbeef> `=` not `:`
02:21:42*ltriant joined #nim
02:21:59FromDiscord<Elegantbeef> instead of `var ctx: ContextRef; new(ctx)` you can just do `var ctx = ContextRef()`
02:22:11FromDiscord<pmp-p> yeah it works
02:22:30FromDiscord<Elegantbeef> But remember you should call `NimMain` for that to work properly
02:22:57FromDiscord<pmp-p> hmm that could be a problem with reactor
02:23:10FromDiscord<pmp-p> i don't exactly where NimMain is going
02:23:31FromDiscord<pmp-p> _initialize() is calling wasm ctors, and then nothing
02:23:38FromDiscord<pmp-p> all gets manual
02:23:45FromDiscord<Elegantbeef> NimMain should be called once before any code is ran so you can just `once: NimMain()` inside the main before your code runs
02:24:18FromDiscord<pmp-p> ok
02:25:09FromDiscord<Elegantbeef> Since nim allows top level code, you need that call for initialising any top level variables
02:28:01FromDiscord<pmp-p> added it to setup()
02:28:10FromDiscord<pmp-p> looks fine with wasi
02:28:53FromDiscord<pmp-p> now adding a "nimweb" compile command to define reactor
02:55:19FromDiscord<pmp-p> it's alive ! https://wyz.fr/3W-89
02:55:49FromDiscord<Elegantbeef> we did it
02:56:05FromDiscord<pmp-p> nim is impressive
02:56:51FromDiscord<pmp-p> i tried with rust i was not impressed at all
02:57:22FromDiscord<pmp-p> ( and i neved did it )
02:57:53FromDiscord<pmp-p> now the horrible part is writing the javascript polyfill
02:58:11FromDiscord<Elegantbeef> just write it in nim 😛
02:58:16FromDiscord<pmp-p> lol
02:59:32FromDiscord<pmp-p> there are about 50 system calls to implement that's a bit too much for me, i started a few days ago
03:00:45FromDiscord<pmp-p> there's one in rust here https://runno.dev/wasi
03:01:30FromDiscord<Elegantbeef> Oh that's nifty
03:02:14FromDiscord<pmp-p> and i know it works https://media.discordapp.net/attachments/371759389889003532/1062204695420076143/shot-2023-01-10_1673319707.png
03:03:28FromDiscord<pmp-p> maybe just have to ask nicely into adding reactor support
03:06:31FromDiscord<pmp-p> problem with reactor model nobody thought to add the "loop" automatic call
03:06:39FromDiscord<pmp-p> i can't find any doc about that
03:10:05FromDiscord<Elegantbeef> No clue about any of that stuff
03:10:06FromDiscord<Elegantbeef> I'm the oddest wasm enthusiast
03:10:32FromDiscord<pmp-p> reading https://github.com/WebAssembly/WASI/issues/13 i think someone forgot to fill in some documentation 😄
03:10:49FromDiscord<pmp-p> or it's left as an exercise to the reader ...
03:11:49FromDiscord<pmp-p> i would choose "loop" because of ardunio but browser is "requestAnimationFrame"
03:11:55FromDiscord<pmp-p> (edit) "ardunio" => "arduino"
03:12:58FromDiscord<pmp-p> well loop has a better carbon fooprint :p
03:20:54*arkurious quit (Quit: Leaving)
04:17:18FromDiscord<scipio> In reply to @ShalokShalom "<@376004371256836096> My default answer": Read the article! And I want to thank you for mentioning it to me because it was a real eye opener! I had only briefly learned about Godot, but the way it's designed, its workflow and integrated into various languages etc etc makes a lot of sense, and indeed reading this article about using a game engine for "UI first development" is very novel!
04:18:39FromDiscord<scipio> I mentioned egui in Rust (which itself is inspired by Dear Imgui) which is an immediate UI: that's basically the exact same thing as Godot, the author of the article is not literally using the words "immediate UI" but it's that
04:21:37*azimut quit (Remote host closed the connection)
04:22:15*azimut joined #nim
04:27:08FromDiscord<Elegantbeef> Godot is more of a retained GUI than imgui
05:02:26*azimut quit (Ping timeout: 255 seconds)
05:53:09*xet7 joined #nim
06:19:21*xet7 quit (Remote host closed the connection)
06:21:43*xet7 joined #nim
06:47:43FromDiscord<ShalokShalom> In reply to @cow "re: this, a lot": It is slightly touched. And Araq is intentionally be a dick, as so often ↵↵Its just part of his attitude, and one huge reason, why Nim is ultimately just second to my favorite languages
06:49:14FromDiscord<ShalokShalom> In reply to @scipio "Read the article! And": ❤️ I am fascinated by it myself, in this way. Godot is just a godsend, from so many perspectives 🙂 ↵↵Now we just need to realize proper support 😀
07:02:49FromDiscord<ShalokShalom> sent a long message, see https://paste.rs/Syw
07:05:13*kenran joined #nim
07:08:49*kenran quit (Remote host closed the connection)
07:12:52FromDiscord<ShalokShalom> https://youtu.be/1QNxLNMq3Uw?t=1570
07:35:21*junaid_ joined #nim
07:41:59*junaid_ quit (Remote host closed the connection)
07:43:27*PMunch joined #nim
08:02:43*jjido joined #nim
08:33:50*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
09:04:02*jjido joined #nim
09:05:56*jjido quit (Client Quit)
09:24:47*ltriant quit (Ping timeout: 264 seconds)
09:36:12*junaid_ joined #nim
09:55:36*junaid_ quit (Remote host closed the connection)
10:00:03*jmdaemon quit (Ping timeout: 260 seconds)
10:19:45*azimut joined #nim
11:05:25*ltriant joined #nim
11:16:16*argonica joined #nim
11:26:13*jjido joined #nim
11:27:39*jjido quit (Client Quit)
11:39:03PMunchHmm, it's a bit annoying that we have such severely limited introspection in Nim
11:40:33FromDiscord<ShalokShalom> We talked recently about DTrace and how it could be used for Nim
11:40:44FromDiscord<ShalokShalom> Did you try this?
11:41:20*jmdaemon joined #nim
11:41:24FromDiscord<ShalokShalom> In case you mean this type of introspection.
11:41:41FromDiscord<federico3> without the www↵(@cow)
12:05:20*jmdaemon quit (Ping timeout: 268 seconds)
12:05:31*genpaku quit (Read error: Connection reset by peer)
12:08:43*genpaku joined #nim
12:13:33PMunch@ShalokShalom, not quite I was more thinking about e.g. getting all the specialized versions of a base type and things like that
12:14:06FromDiscord<ShalokShalom> Yeah, this used to be my second guess 😛
12:14:25FromDiscord<ShalokShalom> Well Araq announced that they will improve nimsuggest
12:14:40FromDiscord<ShalokShalom> You could suggest this as well
12:15:36PMunchAraq is against the idea
12:15:50PMunchOr at least he has been
12:17:20FromDiscord<Phil> In reply to @federico3 "without the www (<@909724322401255464>)": Wait, how can a certificate be only valid for `nimble.directory` but not `www.nimble.directory`?↵I admit I didn't look super deep into it, but when I set my stuff up with certbot and letsencrypt on nginx it was basically immediately covering both `aldrune.com` and `www.aldrune.com`
12:18:43FromDiscord<pyolyokh> certs have a list of domains. If www. isn't in there, the cert doesn't work for it. There's no automatic inclusion of subdomains
12:18:47FromDiscord<ShalokShalom> maybe a specific feature of letsencrypt
12:19:41FromDiscord<Rika> Not really a feature, just how the tool works
12:20:23FromDiscord<federico3> correct. I might add the www but it's really uncommon that people use it↵(@pyolyokh)
12:20:39FromDiscord<Phil> Let me check my nginx conf, might be that I forward immediately from aldrune.com to www.aldrune.com
12:20:52FromDiscord<Phil> but even then there would be a cert check for aldrune.com, no?
12:21:11FromDiscord<pyolyokh> you can use the openssl cli command to see the exact domains in your cert.
12:21:47FromDiscord<jmgomez> In reply to @PMunch "<@208199869301522432>, not quite I": you mean at comp time or runtime?
12:22:02FromDiscord<Phil> Ohhhhhhh no I see it now
12:22:22FromDiscord<Phil> The way I set it up is that `aldrune.com` connects under HTTP and forwards you to `www.aldrune.com` which connects unter HTTPS
12:22:44FromDiscord<Phil> And my cert only covers `www.aldrune.com`
12:22:46FromDiscord<pyolyokh> something like `openssl x509 -in {file} -text` . I'd call auto-adding www. a feature, with the history of people who've bought certs, belatedly realized it didn't apply to www., and then changing their whole website to non-www avoid buying another cert.
12:22:56PMunch@jmgomez, comp time
12:23:21FromDiscord<Phil> God damn I forget about http server config so damn quickly it's bonekrs
12:23:24FromDiscord<Phil> (edit) "bonekrs" => "bonkers"
12:23:37FromDiscord<hmmm> does scanf consume the input after a first pass? I have a working scanf on the start of my input string, now I want to loop it to check the next tokens in the string. Halp broskis!
12:24:42FromDiscord<ShalokShalom> In reply to @Isofruit "God damn I forget": do you know the Caddy server?
12:25:03FromDiscord<ShalokShalom> It makes dealing with this kind of stuff easier
12:25:04PMunchI don't think scanf consumes anything, typically in C you'd just iterate your pointer
12:25:22FromDiscord<jmgomez> In reply to @PMunch "<@726017160115126333>, comp time": It would be great if there were at least something similar to locals but where you can introspect a whole module. It can be done with a plugin but AFAIK the plugin API is closed or doenst work without modifying the compiler
12:25:26FromDiscord<Rika> In reply to @ShalokShalom "It makes dealing with": I don’t think it’s an issue of making the config
12:25:47FromDiscord<hmmm> In reply to @PMunch "I don't think scanf": i c munchie
12:26:23PMunch@jmgomez, I mean you could create a special kind of import which ran `parseStmt(readFile())` and just spit out a normal import..
12:26:29PMunchBut it's an ugly hack..
12:27:12PMunchI just want the best of both worlds from inheritance and object variants
12:27:17FromDiscord<Phil> In reply to @ShalokShalom "do you know the": I know apache and nginx, I'm not about to learn a third HTTP Server for reverse proxy
12:27:26FromDiscord<jmgomez> yeah but that woudlnt give you symbols, will it?
12:27:30FromDiscord<ShalokShalom> haha 😄
12:27:37FromDiscord<ShalokShalom> it has encypt build in
12:27:40FromDiscord<ShalokShalom> and it way easier 😛
12:27:46FromDiscord<Rika> In reply to @Isofruit "I know apache and": I sure hope you don’t still use Apache
12:27:50PMunchI want the equivalent of the object variant enum but the extendability of inherited objects
12:28:06FromDiscord<ShalokShalom> I sure hope you dont still use nginx XD
12:28:06PMunch@jmgomez, eh there are ways you could do it
12:28:09FromDiscord<Rika> In reply to @ShalokShalom "and it way easier": It’s not easier if it’s another thing to learn, furthermore for no reason
12:28:14FromDiscord<Phil> In reply to @Rika "I sure hope you": Not anymore, made the jump to nginx for learning purposes when I jumped from django to prologue
12:28:17FromDiscord<Rika> There is no issue with nginx
12:28:28FromDiscord<ShalokShalom> In reply to @Rika "It’s not easier if": sure, thats true
12:28:35FromDiscord<ShalokShalom> In reply to @Rika "There is no issue": other than its complexity
12:28:43FromDiscord<Phil> And I'm not aware of anything egregiously wrong with Apache either
12:28:44PMunchMy point is that it is technically possible, but it would be a lot nicer to have something built in
12:28:49FromDiscord<Rika> I am not about to argue with you, given your track record
12:28:55FromDiscord<ShalokShalom> just its complexity ^^
12:29:18FromDiscord<ShalokShalom> http server should be accessible for our grandma's
12:29:28FromDiscord<ShalokShalom> sorry 😛
12:29:57FromDiscord<ShalokShalom> didnt meant to be mean
12:31:45FromDiscord<Phil> I'd argue that nginx in principle is fairly easy. It's when you do non-easy things with it that nginx also becomes non-easy.↵Like letting nginx solely handle an upload and never forward that to prologue so the httpserver there never has to deal with large files, so you only forward the name of the file you just uploaded etc.
12:32:05FromDiscord<Phil> Or requiring auth for serving files via nginx
12:32:46FromDiscord<Phil> To this day I've been too lazy to actually implement that last one for the images hosted on my webserver
12:33:27FromDiscord<ShalokShalom> 🤐
12:35:34FromDiscord<ShalokShalom> Complexity of config files can be fairly easy compared
12:38:01*ltriant quit (Ping timeout: 268 seconds)
12:38:09PMunchHmm, I'm getting errors in my Firefox console that the Nim documentation can't load dochack.js, and darkmode doesn't work any longer..
12:40:08FromDiscord<pyolyokh> WFM
12:41:40FromDiscord<pyolyokh> dochack.js comes from nim-lang.org, so any cert issues you'd notice. maybe you have an old firefox and HTTP/3 isn't working for you.
12:42:04PMunchI'm on Arch, so pretty new Firefox
12:42:25PMunchThis is the error I get: Content Security Policy: The page’s settings blocked the loading of a resource at https://nim-lang.org/docs/dochack.js (“script-src”).
12:42:36PMunchFrom this site: https://nim-lang.org/docs/os.html
12:44:53FromDiscord<hmmm> ha! munchie I could use parseUntil to keep track of the position in the string right?
12:47:11PMunchYes, parseUntil is one way of doing it
12:54:05FromDiscord<huantian> In reply to @PMunch "Hmm, I'm getting errors": Dark mode in general or the auto detection
12:59:17PMunchDark mode in general
12:59:22PMunchClicking the switch does nothing
13:04:54FromDiscord<ShalokShalom> In reply to @PMunch "Hmm, I'm getting errors": Probably an add on?
13:05:05FromDiscord<ShalokShalom> Did you try without them on
13:06:02*Guest77 joined #nim
13:07:02*Guest77 quit (Client Quit)
13:18:10PMunchHaha, it was a JavaScript disabler that I had activated by accident
13:23:29*ltriant joined #nim
13:29:39*dilithium joined #nim
13:29:42*argonica quit (Remote host closed the connection)
13:31:49*ltriant quit (Ping timeout: 256 seconds)
13:46:40FromDiscord<ShalokShalom> Add ons are most often behind such issues 😀
13:47:16FromDiscord<ShalokShalom> Particularly if it doesnt replicate on other browsers as in this case
14:15:03*dilithium quit (Quit: Leaving)
14:15:24*argonica joined #nim
14:29:00*junaid_ joined #nim
14:29:33FromDiscord<Ras> sent a code paste, see https://play.nim-lang.org/#ix=4kOq
14:30:00FromDiscord<Ras> (edit) "https://play.nim-lang.org/#ix=4kOq" => "https://play.nim-lang.org/#ix=4kOr"
14:33:17FromDiscord<enthus1ast> and this c.sys stuff what is this?
14:34:48*junaid_ quit (Remote host closed the connection)
14:35:13FromDiscord<auxym> In reply to @Ras "I've defined a few": I think you might have to add return type annotations to your templates (can be `untyped`)
14:35:21PMunchYup
14:35:44PMunchThese templates doesn't return anything, so Nim complains that you have to use the result of the template within the template itself (or discard it)
14:35:50PMunchThe error could definitely be better though..
14:37:14FromDiscord<Ras> In reply to @enthus1ast "and this c.sys stuff": those are procs that correspond to the instructions in the CPU i'm emulating
14:37:19FromDiscord<Ras> In reply to @auxym "I think you might": that did the trick, thanks!
14:37:54FromDiscord<pyryrin> what does `{.cdecl.}` do
14:38:15FromDiscord<enthus1ast> it uses the default c compiler calling convention
14:38:18*argonica quit (Remote host closed the connection)
14:38:32FromDiscord<pyryrin> what does that mean
14:38:56PMunchIt's basically "declare this as if it was declared in C"
14:39:01FromDiscord<enthus1ast> https://en.wikipedia.org/wiki/Calling_convention
14:40:03FromDiscord<pyryrin> why is it used? i don't see the point
14:40:11FromDiscord<pyryrin> (edit) "why" => "when"
14:41:14FromDiscord<enthus1ast> this has to do with how the low level return value or parameter to a procedure call's are handled
14:42:20FromDiscord<Rika> its generally important when doing FFI
14:42:28FromDiscord<Rika> otherwise there isnt much reason to concern about it
14:42:52*ltriant joined #nim
14:43:33FromDiscord<enthus1ast> and some libs/systems use that one some use the other one
14:44:02FromDiscord<enthus1ast> https://nim-lang.org/docs/manual.html#types-procedural-type
14:45:19PMunch@pyryrin, short answer is "if you're not sure what it does, you probably don't have to worry about it"
14:45:41FromDiscord<enthus1ast> or you wonder why you'r wrapper is not working ;)
14:46:01PMunchWell the answer to that question is simple: use Futhark
14:46:15PMunchIt adds the correct calling convention
14:46:38FromDiscord<enthus1ast> is Futhark tested on windows btw?
14:47:01PMunchNot by me, don't have any Windows machines. But I believe other people have run it on Windows
14:47:14PMunchSomeone at least contributed installation instructions :P
14:47:51*ltriant quit (Ping timeout: 260 seconds)
14:53:55*junaid_ joined #nim
15:06:14*PMunch quit (Quit: Leaving)
15:10:45*junaid_ quit (Remote host closed the connection)
15:13:24*argonica joined #nim
15:27:47FromDiscord<4zv4l> wouldn't it be a good idea to add RAII to Nim ?↵so it closes socket or file handler when getting out of scope ?
15:28:32FromDiscord<4zv4l> or does ARC does that ?
15:28:37FromDiscord<4zv4l> (edit) "does" => "do"
15:33:05FromDiscord<auxym> I think ARC could do it if you implement the `=destroy` hook, but I don't think it's implemented in the stdlib currently
15:35:38FromDiscord<cow> In reply to @Isofruit "Wait, how can a": that's not the issue, the problem is that the web server is serving a different certificate for www. than without
15:36:02*azimut quit (Ping timeout: 255 seconds)
15:36:04FromDiscord<cow> and the www. is for a completely different domain
15:36:27FromDiscord<cow> but yes you can have different certs for subdomains
15:36:32*azimut joined #nim
15:36:41*arkurious joined #nim
15:38:42FromDiscord<4zv4l> In reply to @auxym "I think ARC *could*": do you think that will be implemented or that's not in the plan to omit writing `.close` for each possible type ?
15:40:04FromDiscord<4zv4l> also is it me or `AcceptAddr` only write the `IP` address to the variable ? without the port ? why ?
15:55:33FromDiscord<sOkam!> When would you pick an object variant instead of separate objects with inheritance... or viceversa?
16:01:37*kenran joined #nim
16:08:19*kenran quit (Remote host closed the connection)
16:08:41*kenran joined #nim
16:11:37*junaid_ joined #nim
16:15:55*kenran quit (Remote host closed the connection)
16:16:05*junaid_ quit (Remote host closed the connection)
16:16:17*kenran joined #nim
16:16:20*kenran quit (Remote host closed the connection)
16:16:42*kenran joined #nim
16:33:58FromDiscord<pyolyokh> the main difference is that inheritance can be extended at random, with older code not having to care, while object variants are defined in one place and users generally care, because exhaustive cases are used.
16:37:39*kenran quit (Remote host closed the connection)
16:44:28*ltriant joined #nim
16:46:38FromDiscord<cow> with inheritance, dynamic dispatch is handled by nim, while with variants, you have to dispatch yourself
16:53:19*ltriant quit (Ping timeout: 268 seconds)
17:00:46FromDiscord<Mustache Man> when looking around at new career opportunities, I'm seeing a trend: startups prefer python. this is.. surprising to me. it's being used for everything under the sun now. and don't get me started on all the golang demand. i'm flabbergasted, gone are the C# and Java jobs of yesteryear. what does Nim lack that Python and Go have? is it Python's assortment of libraries, and Golang's backing from Google? is it Nim's immaturity?
17:02:28FromDiscord<Mustache Man> At what point does it become reasonable to suggest, "hey let's use Nim on this new project" ?
17:15:12FromDiscord<sOkam!> @pyolyokh @cow which, in practical terms, means?
17:17:11FromDiscord<pyolyokh> sent a long message, see http://ix.io/4kPi
17:17:29FromDiscord<cow> In reply to @sOkam! "<@803214225002463283> <@909724322401255464> which, ": variants: you have to have case statements everytime you want a function to act on all different kinds↵inheritance: the method based on runtime type gets called in the first place↵↵I personally always use variants, but in some cases inheritance would reduce the amount of spaghetti I do around type variants I guess
17:19:20FromDiscord<pyolyokh> In reply to @sOkam! "<@803214225002463283> <@909724322401255464> which, ": not much, without me just repeating myself, more emphatically.↵↵But I'll do that anyway: because variants are defined in one place and users generally care about changes to that definition, it's easier for the compiler to keep your program coherent. If you add a new payment method, you have to update all the places that have to know about the new payment met
17:19:25FromDiscord<sOkam!> yeah, i have code using both. the question is specifically about when to use each, because I struggle to see the benefits and downsides of each, other than the many case lists
17:20:40FromDiscord<sOkam!> do you both mean that its just a case of being explicit about it or not, and have the same exact behavior in the end?
17:22:24FromDiscord<Mustache Man> In reply to @pyolyokh "it's not an 'assortment'": Good answers, thank you. One other thing I'm wondering - if I suggested to use Nim professionally, and people start asking questions about developer resources and/or "what are the gotchyas?" then I feel like I'd be hosed, because I simply don't know what I don't know. wondering what dark corners of the language I need to dive into to move from beginner to intermediate with Nim
17:22:37FromDiscord<cow> for me, I like the explicitness personally, so I keep using that one yes
17:22:52FromDiscord<cow> I'm not sure if one is faster than the other
17:22:56FromDiscord<cow> both have to runtime check the type
17:23:21FromDiscord<pyolyokh> sent a long message, see https://paste.rs/dem
17:23:34FromDiscord<ShalokShalom> In reply to @sOkam! "yeah, i have code": You can shorten the variants
17:23:35FromDiscord<ShalokShalom> https://github.com/andreaferretti/patty#constructing-variant-objects
17:28:26*Jjp137 quit (Ping timeout: 246 seconds)
17:31:33FromDiscord<morgan> neat
17:32:06*Jjp137 joined #nim
17:37:43FromDiscord<pyolyokh> sent a long message, see http://ix.io/4kPm
17:38:43FromDiscord<sOkam!> sent a long message, see http://ix.io/4kPn
17:39:27*PMunch joined #nim
17:41:34FromDiscord<pyolyokh> there are minor things, like people wanting to use OOP more, or people preferring explicit imports, or people preferring the stdlib to run everything through C++/D/Rust iterators, but a blocker's probably going to be pedestrian complaints above.
17:41:37FromDiscord<sOkam!> a LOT of people will just blindly say "oh, you use a weird language that nobody else uses, just because"... and reject the language without knowing a single word about it
17:41:50FromDiscord<Mustache Man> 🙏
17:42:09FromDiscord<sOkam!> that, and the formatting freedom that pyol mentioned, are probably the stupidest reasons that will gotcha
17:43:06FromDiscord<pyolyokh> sent a long message, see http://ix.io/4kPo
17:43:16FromDiscord<Mustache Man> What i've seen regarding Nim's OOP approach is really refreshing and powerful without adding any bizarre keywords or boilerplate
17:43:34FromDiscord<pyolyokh> (edit) "http://ix.io/4kPo" => "http://ix.io/4kPp"
17:43:56FromDiscord<sOkam!> the next level of oop in nim is realizing how little you need it in this lang
17:44:11FromDiscord<Mustache Man> In reply to @pyolyokh "and likewise there are": this makes me think of using Spring for microservices haha
17:45:04FromDiscord<Mustache Man> yeah Java made OOP an industry standard in all the wrong ways 😿
17:45:15FromDiscord<pyolyokh> I think the best way to get Nim into a job is for some code to have already been written in Nim that's useful to the job, that you can then extend. "Let's use this thing. It's good and it's written in a reasonable language." is easier to sell that "Let's everyone become developers in this new language."
17:45:22FromDiscord<Mustache Man> now we get beaten over the head with design patterns instead of functional programming concepts
17:46:40FromDiscord<sOkam!> want a class? make a file, create a type struct, create the functions, import from some other file. done↵true for 99% of the programming situations. and it makes the code much cleaner↵if you really really really need the inheritance, then its there. but for most cases it will be irrelevant due to nim's syntax
17:47:36FromDiscord<Mustache Man> In reply to @pyolyokh "I think the best": I like that idea. Speaking from my own experience, 3rd party PaaS/SaaS suck
17:48:06FromDiscord<Mustache Man> they're slow, expensive, and don't deliver what they claim to and/or won't build new features that they agreed to initially
17:49:57FromDiscord<Mustache Man> Would be difficult to predict what might be useful ahead of time, however
17:56:00*jmdaemon joined #nim
18:08:49*Figworm quit (Quit: Figworm)
18:09:47*jmdaemon quit (Ping timeout: 264 seconds)
18:22:04*jmdaemon joined #nim
18:28:08*jmdaemon quit (Ping timeout: 260 seconds)
18:38:35*jmdaemon joined #nim
18:49:54*ltriant joined #nim
18:54:52*ltriant quit (Ping timeout: 252 seconds)
18:58:14*lnxw37 quit (Ping timeout: 260 seconds)
18:59:13*TakinOver joined #nim
19:03:07FromDiscord<iffy (Matt Haggard)> How do I get a string value to stick on a compileTime ref object. For example, in this code the name is set, but lost after the macro finishes\: https://gist.github.com/iffy/3adcc3345499d16962bdfad94c47d0ce The sequence of the ref object doesn't seem to have the problem.
19:11:24*kenran joined #nim
19:18:31FromDiscord<0ffh> sent a code paste, see https://play.nim-lang.org/#ix=4kPN
19:21:29*ltriant joined #nim
19:22:20*xet7 quit (Quit: Leaving)
19:26:49*ltriant quit (Ping timeout: 260 seconds)
19:27:48FromDiscord<DeLannoy> How do I prevent a nim executable from closing right after it was open?
19:27:52FromDiscord<hotdog> In reply to @0ffh "Shouldn't these two snippets": eventQueue[0] should be eventQueue[^1] no?
19:28:04FromDiscord<hotdog> In reply to @DeLannoy "How do I prevent": Is this on windows?
19:28:32FromDiscord<DeLannoy> yes
19:28:41FromDiscord<DeLannoy> (edit) "open?" => "opened up?"
19:29:10FromDiscord<0ffh> In reply to @hotdog "eventQueue[0] should be eventQueue[^1]": My understanding is, the smallest element is sorted to the front.
19:29:15*jmdaemon quit (Ping timeout: 260 seconds)
19:29:39FromDiscord<0ffh> So, no. The event with the smallest eventTime should be at [0], shoudln't iz?
19:29:54FromDiscord<0ffh> (edit) "shoudln't iz?" => "shouldn't it?"
19:30:26FromDiscord<0ffh> But then again, my understanding might be wrong, I'll check
19:30:47FromDiscord<hotdog> In reply to @0ffh "My understanding is, the": Ah right
19:30:50*TakinOver quit (Ping timeout: 255 seconds)
19:31:05FromDiscord<hotdog> In reply to @DeLannoy "yes": There is a compiler flag iirc
19:32:58FromDiscord<0ffh> In reply to @hotdog "Ah right": I checked, should be at [0]. Doesn't even compile with [^1].
19:33:11FromDiscord<hotdog> Have you defined `<` @0ffh
19:33:25FromDiscord<!!sharpcdf!!> Would it be ok to de init and re init illwill several times within an app? For instance if I made a prompt function that used it, but I didn't want to use it for the rest of the app
19:33:53FromDiscord<!!sharpcdf!!> And also is it fine to do clear() on every update?
19:34:03FromDiscord<0ffh> In reply to @hotdog "Have you defined `<`": It's a tuple, the first element is time as an int, so that should dominate the comparison operation.
19:34:19FromDiscord<DeLannoy> In reply to @hotdog "There is a compiler": Sorry but I couldn't find it on the doc page 😦
19:34:48FromDiscord<hotdog> In reply to @0ffh "It's a tuple, the": Just checking if you had manually defined one
19:35:21FromDiscord<0ffh> In reply to @hotdog "Just checking if you": Nah, it's an anonymous tuple anyways, so couldn't even. 😁
19:36:33FromDiscord<0ffh> The funny thing is, poping the event from the queue and re-inserting if it's not time works, but not peeking and poping when it's time does not.
19:36:39FromDiscord<0ffh> It's a mystery.
19:37:09*FromDiscord quit (Remote host closed the connection)
19:37:22*FromDiscord joined #nim
19:43:45FromDiscord<hotdog> In reply to @0ffh "Nah, it's an anonymous": It would just be `proc `<`(a, b: tuple[eventTime:int,event:Event]): bool`
19:43:48FromDiscord<0ffh> sent a long message, see https://paste.rs/3er
19:44:03FromDiscord<0ffh> (edit) "long message," => "code paste," | "http://ix.io/4kPU" => "https://play.nim-lang.org/#ix=4kPT"
19:44:29FromDiscord<0ffh> (edit) "https://play.nim-lang.org/#ix=4kPT" => "https://play.nim-lang.org/#ix=4kPV"
19:44:47FromDiscord<hotdog> In reply to @0ffh "OOF! Found the bug.": Nice 🎉
19:45:05FromDiscord<0ffh> In reply to @hotdog "Nice 🎉": Is that a bug should submit?
19:46:02FromDiscord<hotdog> In reply to @0ffh "Is that a bug": Not sure without seeing the full code
19:46:06FromDiscord<hotdog> See if you can narrow it down a bit
19:47:58FromDiscord<0ffh> In reply to @hotdog "See if you can": Okay, so I'll make a minimal example and post it in this channel again?↵(Not right now, probably, but tomorrow at the latest.)
19:50:52FromDiscord<hotdog> In reply to @DeLannoy "Sorry but I couldn't": Sorry I don't really use windows so I can't say for sure. Have you tried the various `--app` options? like `--app:gui`
19:53:12*ltriant joined #nim
19:56:33FromDiscord<hotdog> In reply to @0ffh "Okay, so I'll make": Can you try it with this template: `template peek[T](q:HeapQueue[T]): lent T = q[0]` @0ffh
19:58:19*ltriant quit (Ping timeout: 260 seconds)
20:03:25FromDiscord<0ffh> In reply to @hotdog "Can you try it": Yup, that fixes it!↵I am impress, son! 🎉 ↵Through what black magic did you come up with the idea?
20:04:34FromDiscord<0ffh> (edit) "it!↵I" => "it! 🎉 ↵I" | "🎉" => "😁 "
20:05:24*jmdaemon joined #nim
20:10:22*TakinOver joined #nim
20:15:44FromDiscord<hotdog> In reply to @0ffh "Yup, that fixes it!": I looked at the signature of ``[]`` in heapqueue
20:20:17FromDiscord<0ffh> In reply to @hotdog "I looked at the": Nifty! 😎 ↵It seems I should use the source link in the documentation more often! 😂
20:20:44FromDiscord<hotdog> In reply to @iffy (Matt Haggard) "How do I get": It's the order of evaluation I suppose, try emitting `static: m.name = "foobar"` from the macro
20:24:47*ltriant joined #nim
20:25:44*jmdaemon quit (Ping timeout: 260 seconds)
20:29:46*ltriant quit (Ping timeout: 268 seconds)
20:41:24FromDiscord<iffy (Matt Haggard)> I don't think it's the order. I think the object is being passed by value to macros (instead of by reference). And it's "passed" by reference to static blocks. Here's more playing\: https://gist.github.com/iffy/dedf70ffe43744f1fa244d4d403d6ed3↵(@hotdog)
20:41:50FromDiscord<System64 ~ Flandre Scarlet> I absolutely love how rich is the stdlib↵It lets you do a ton of things without any effort!
20:42:47FromDiscord<iffy (Matt Haggard)> Yes, emitting `static: m.name = "foobar"` from the macro works. But I'm writing a typedef macro, and the AST doesn't allow emitting static within that. e.g. `type MyType {.mymacro.}`
20:47:02*TakinOver quit (Ping timeout: 268 seconds)
20:50:03FromDiscord<jos> does anybody know how to take a ref object and pass it to an FFI as a pointer safely
20:50:07FromDiscord<jos> that should be possible right
20:50:10FromDiscord<jos> like just an opaque handle to a ref object
20:51:03FromDiscord<jos> sent a code paste, see https://play.nim-lang.org/#ix=4kQa
20:51:19FromDiscord<jos> so i need to first leak fontTexture onto the heap, because i don't want it cleaned up by GC
20:51:23FromDiscord<jos> and maybe something else i'm missing?
20:51:25FromDiscord<jos> how do i do that
20:53:43ZevvGC_ref it
20:54:09FromDiscord<demotomohiro> @jos https://nim-lang.org/docs/system.html#GC_ref%2Cref.T
20:54:38FromDiscord<jos> i'm trying that, but something is maybe going wrong when i cast it back
20:54:39Zevvor alloc() it instead of new()
20:54:47Zevvit's not GC managed
20:54:50Zevvin that case
20:54:55FromDiscord<jos> `type Texture = ref object` btw
20:55:00FromDiscord<jos> and i'm using ORC
20:55:10FromDiscord<jos> i think
20:55:16FromDiscord<jos> i think that might be an issue
20:55:25FromDiscord<jos> does alloc work with ref types?
20:55:33Zevvnope, you get a ptr
20:56:02FromDiscord<jos> is there a way to get a ptr to a ref object then? that won't be moved
20:56:55Zevvit'll never get moved, but it might get GC'ed if you don't keep it around
20:56:58Zevvthing[].addr
20:57:35FromDiscord<jos> weird.. i can use cast[pointer](thing) or cast[pointer](thing[].addr) and both of those work
20:57:52FromDiscord<jos> but i would have thought i had to use cast[pointer](thing.addr)
20:58:24FromDiscord<demotomohiro> They are same thing. ref types are actually pointers.
20:59:22FromDiscord<demotomohiro> thing.addr is an address of a pointer.
20:59:31Zevvthey are not the same
20:59:38Zevvand thing.addr should not work
20:59:38FromDiscord<jos> they're even pointers when they're on the stack?
20:59:42FromDiscord<jos> ohhh
20:59:44Zevvyou get hte address of the ptr
20:59:46FromDiscord<jos> i see
21:00:26FromDiscord<demotomohiro> And `thing[].addr` is an address of a thing that ref type points to.
21:00:58Zevvjos: https://play.nim-lang.org/#ix=4kQe
21:01:00FromDiscord<jos> makes sense, thanks!
21:01:26FromDiscord<jos> out of curiosity are ref types on the stack always pointers to heap allocated data?
21:01:33FromDiscord<jos> even after optimization
21:01:52FromDiscord<jos> In reply to @Zevv "jos: https://play.nim-lang.org/#ix=4kQe": thanks this helps
21:01:53Zevvwhat kind of optimization are you thinking of
21:02:05Zevvrefs are always on the heap
21:02:55FromDiscord<Elegantbeef> Due to their semantics they cannot safely live on the stack
21:02:55FromDiscord<Elegantbeef> Ref types only point to heap data
21:03:21FromDiscord<jos> so even if i just like do something like
21:04:09FromDiscord<jos> that's making a heap allocation
21:04:10FromDiscord<jos> sent a code paste, see https://play.nim-lang.org/#ix=4kQg
21:04:25FromDiscord<Elegantbeef> Yes
21:04:27FromDiscord<jos> i mean it makes sense once you start using the other features or have multiple refs to the same object
21:04:31FromDiscord<Elegantbeef> `ref` is a heap allocated type due to it's semantics
21:04:33FromDiscord<jos> but i was wondering if in trivial cases like that it would be optimized
21:04:37FromDiscord<jos> don't some languages do that
21:04:55FromDiscord<Elegantbeef> I doubt it
21:05:12FromDiscord<Elegantbeef> Aside from the allocation there is like 0 reason to 'optimise it'
21:05:18ZevvI probably posted https://zevv.nl/nim-memory/ here before
21:05:37FromDiscord<Elegantbeef> If you want it stack allocated you make a stack version and a ref version and use the stack version where you need
21:05:44*jmdaemon joined #nim
21:05:50FromDiscord<Elegantbeef> Otherwise you can do `let x = typeof(Vec3()[])(x: 1, y: 2, z: 3)`
21:06:07FromDiscord<jos> interesting
21:06:49FromDiscord<Elegantbeef> Like i said though aside from allocation there isnt any reason to optimise heap usage
21:07:05ZevvA general guideline could be 'put it on the stack unless you need to put it on the heap'
21:07:06FromDiscord<Elegantbeef> So if you allocate once the overhead isnt much better
21:07:13FromDiscord<Elegantbeef> Yep
21:07:21FromDiscord<Elegantbeef> If you need reference semantics you use ref
21:07:25FromDiscord<Elegantbeef> People seem to complicate it for some reason
21:07:35FromDiscord<jos> i guess it's kind of like a generational gc
21:07:44FromDiscord<jos> is why i thought it might be a thing
21:07:45Zevvoh happens to me often as well, I just think too reffy, make my objects ref by default
21:08:25Zevvits easier, you can pass refs around and things are mutable without having to 'var' the args, things like that
21:09:32Zevvit's easier, but not optimal; your code might be slightly slower and larger due to indirect addressing, your heap is prone to fragmentation, etc
21:09:57*TakinOver joined #nim
21:12:34FromDiscord<Elegantbeef> Yea I forgot to specify when storing data that could be contiguous heap would add overhead
21:12:51FromDiscord<Elegantbeef> You also introduce nilable types, which is sinful!
21:14:58Zevvi love me some nillables; it's like an option[T] for grownups
21:21:01*TakinOver quit (Ping timeout: 252 seconds)
21:22:57*ltriant joined #nim
21:28:10*ltriant quit (Ping timeout: 272 seconds)
21:34:52FromDiscord<jos> is there a way to enable non nullable types by default?
21:35:04FromDiscord<jos> like stuff like that init pragma and friends too
21:35:05Zevvthat was tried, somewhere in 2018
21:35:09FromDiscord<jos> i would like to enforce that across my whole codebase
21:35:24Zevvbut that failed
21:37:10Zevvnot sure what the state of this is: https://nim-lang.org/docs/manual_experimental_strictnotnil.html
21:47:28FromDiscord<Saint> What's the best way to get a 'slice' of a json object, sort of like how you do it in pandas
21:47:55FromDiscord<Saint> If I get a json response object with a bunch of data but I only want a couple fields, what would be the cleanest way to get an object with just those fields
21:48:14FromDiscord<Saint> Sorta like how pandas can do df[['col1', 'col2']]
21:57:15*xet7 joined #nim
22:02:46*PMunch quit (Quit: leaving)
22:03:01FromDiscord<Elegantbeef> Manually grab the fields you want after parsin
22:09:59*ltriant joined #nim
22:10:42FromDiscord<Saint> Yeah
22:24:51*kenran quit (Remote host closed the connection)
22:52:37*xet7 quit (Quit: Leaving)
23:18:41FromDiscord<auxym> @Saint we have https://scinim.github.io/Datamancer/datamancer.html in Nim if you want something like pandas. you'd have to convert your json object to a datamancer dataframe yourself though
23:19:53FromDiscord<Saint> This is very cool thanks @auxym
23:35:26FromDiscord<voidwalker> nim forum doesn't save message text draft, right ? I was writing a long post and clicked a link accidentally 😦