00:00:04 | FromDiscord | <jmgomez> Is there a way to provide a path to the std without modifying the sources? |
00:35:10 | FromDiscord | <! 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:21 | FromDiscord | <! 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:54 | FromDiscord | <pyolyokh> I wouldn't expect it to be a catchable exception. Maybe it's not one. |
00:59:48 | FromDiscord | <amadan> sent a code paste, see https://paste.rs/Ema |
01:22:31 | * | ltriant quit (Ping timeout: 256 seconds) |
01:54:20 | FromDiscord | <Elegantbeef> @pmp-p anywho i'm rewriting this in more idiomatic Nim to see if i can help any |
02:08:35 | FromDiscord | <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:52 | FromDiscord | <pmp-p> i got lost in asyncdispatch |
02:09:05 | FromDiscord | <pmp-p> (edit) "asyncdispatch" => "asyncdispatch, iterators seems way easier" |
02:09:48 | * | estiquelapice quit (Ping timeout: 272 seconds) |
02:11:36 | FromDiscord | <Elegantbeef> Wait strformat supports that `=` syntax? 😄 |
02:11:53 | FromDiscord | <pmp-p> i was so happy to see that 🙂 |
02:12:09 | FromDiscord | <Elegantbeef> TIL |
02:12:52 | FromDiscord | <Elegantbeef> Not using pylib makes your code much more readable |
02:13:13 | FromDiscord | <Elegantbeef> Also you can do `var ctx = ContextRef()` |
02:14:06 | FromDiscord | <Elegantbeef> Also `block` doesnt do anything btw |
02:14:11 | FromDiscord | <Elegantbeef> It's the same as no code being there |
02:14:21 | FromDiscord | <Elegantbeef> I mean it's the same as the code without indent |
02:14:43 | FromDiscord | <pmp-p> yeah i removed it |
02:16:33 | FromDiscord | <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:58 | FromDiscord | <Elegantbeef> Me going "Who needs green threads, make all the code blocking!" 😄 |
02:17:13 | FromDiscord | <pmp-p> and browser will kill ya ... |
02:17:31 | FromDiscord | <pmp-p> though they extend the timeout recently |
02:17:34 | FromDiscord | <pmp-p> (edit) "extend" => "extended" |
02:17:34 | FromDiscord | <Elegantbeef> Browser schnauzer |
02:18:14 | FromDiscord | <Elegantbeef> Also i doubt you'll use it but `args: ptr UncheckedArray[cstring]` is more correct |
02:18:22 | FromDiscord | <Elegantbeef> Pointless code reviews aside, nice that this works for you |
02:19:57 | * | estiquelapice joined #nim |
02:21:23 | FromDiscord | <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:34 | FromDiscord | <Elegantbeef> `=` not `:` |
02:21:42 | * | ltriant joined #nim |
02:21:59 | FromDiscord | <Elegantbeef> instead of `var ctx: ContextRef; new(ctx)` you can just do `var ctx = ContextRef()` |
02:22:11 | FromDiscord | <pmp-p> yeah it works |
02:22:30 | FromDiscord | <Elegantbeef> But remember you should call `NimMain` for that to work properly |
02:22:57 | FromDiscord | <pmp-p> hmm that could be a problem with reactor |
02:23:10 | FromDiscord | <pmp-p> i don't exactly where NimMain is going |
02:23:31 | FromDiscord | <pmp-p> _initialize() is calling wasm ctors, and then nothing |
02:23:38 | FromDiscord | <pmp-p> all gets manual |
02:23:45 | FromDiscord | <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:18 | FromDiscord | <pmp-p> ok |
02:25:09 | FromDiscord | <Elegantbeef> Since nim allows top level code, you need that call for initialising any top level variables |
02:28:01 | FromDiscord | <pmp-p> added it to setup() |
02:28:10 | FromDiscord | <pmp-p> looks fine with wasi |
02:28:53 | FromDiscord | <pmp-p> now adding a "nimweb" compile command to define reactor |
02:55:19 | FromDiscord | <pmp-p> it's alive ! https://wyz.fr/3W-89 |
02:55:49 | FromDiscord | <Elegantbeef> we did it |
02:56:05 | FromDiscord | <pmp-p> nim is impressive |
02:56:51 | FromDiscord | <pmp-p> i tried with rust i was not impressed at all |
02:57:22 | FromDiscord | <pmp-p> ( and i neved did it ) |
02:57:53 | FromDiscord | <pmp-p> now the horrible part is writing the javascript polyfill |
02:58:11 | FromDiscord | <Elegantbeef> just write it in nim 😛 |
02:58:16 | FromDiscord | <pmp-p> lol |
02:59:32 | FromDiscord | <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:45 | FromDiscord | <pmp-p> there's one in rust here https://runno.dev/wasi |
03:01:30 | FromDiscord | <Elegantbeef> Oh that's nifty |
03:02:14 | FromDiscord | <pmp-p> and i know it works https://media.discordapp.net/attachments/371759389889003532/1062204695420076143/shot-2023-01-10_1673319707.png |
03:03:28 | FromDiscord | <pmp-p> maybe just have to ask nicely into adding reactor support |
03:06:31 | FromDiscord | <pmp-p> problem with reactor model nobody thought to add the "loop" automatic call |
03:06:39 | FromDiscord | <pmp-p> i can't find any doc about that |
03:10:05 | FromDiscord | <Elegantbeef> No clue about any of that stuff |
03:10:06 | FromDiscord | <Elegantbeef> I'm the oddest wasm enthusiast |
03:10:32 | FromDiscord | <pmp-p> reading https://github.com/WebAssembly/WASI/issues/13 i think someone forgot to fill in some documentation 😄 |
03:10:49 | FromDiscord | <pmp-p> or it's left as an exercise to the reader ... |
03:11:49 | FromDiscord | <pmp-p> i would choose "loop" because of ardunio but browser is "requestAnimationFrame" |
03:11:55 | FromDiscord | <pmp-p> (edit) "ardunio" => "arduino" |
03:12:58 | FromDiscord | <pmp-p> well loop has a better carbon fooprint :p |
03:20:54 | * | arkurious quit (Quit: Leaving) |
04:17:18 | FromDiscord | <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:39 | FromDiscord | <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:08 | FromDiscord | <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:43 | FromDiscord | <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:14 | FromDiscord | <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:49 | FromDiscord | <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:52 | FromDiscord | <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:03 | PMunch | Hmm, it's a bit annoying that we have such severely limited introspection in Nim |
11:40:33 | FromDiscord | <ShalokShalom> We talked recently about DTrace and how it could be used for Nim |
11:40:44 | FromDiscord | <ShalokShalom> Did you try this? |
11:41:20 | * | jmdaemon joined #nim |
11:41:24 | FromDiscord | <ShalokShalom> In case you mean this type of introspection. |
11:41:41 | FromDiscord | <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:33 | PMunch | @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:06 | FromDiscord | <ShalokShalom> Yeah, this used to be my second guess 😛 |
12:14:25 | FromDiscord | <ShalokShalom> Well Araq announced that they will improve nimsuggest |
12:14:40 | FromDiscord | <ShalokShalom> You could suggest this as well |
12:15:36 | PMunch | Araq is against the idea |
12:15:50 | PMunch | Or at least he has been |
12:17:20 | FromDiscord | <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:43 | FromDiscord | <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:47 | FromDiscord | <ShalokShalom> maybe a specific feature of letsencrypt |
12:19:41 | FromDiscord | <Rika> Not really a feature, just how the tool works |
12:20:23 | FromDiscord | <federico3> correct. I might add the www but it's really uncommon that people use it↵(@pyolyokh) |
12:20:39 | FromDiscord | <Phil> Let me check my nginx conf, might be that I forward immediately from aldrune.com to www.aldrune.com |
12:20:52 | FromDiscord | <Phil> but even then there would be a cert check for aldrune.com, no? |
12:21:11 | FromDiscord | <pyolyokh> you can use the openssl cli command to see the exact domains in your cert. |
12:21:47 | FromDiscord | <jmgomez> In reply to @PMunch "<@208199869301522432>, not quite I": you mean at comp time or runtime? |
12:22:02 | FromDiscord | <Phil> Ohhhhhhh no I see it now |
12:22:22 | FromDiscord | <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:44 | FromDiscord | <Phil> And my cert only covers `www.aldrune.com` |
12:22:46 | FromDiscord | <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:56 | PMunch | @jmgomez, comp time |
12:23:21 | FromDiscord | <Phil> God damn I forget about http server config so damn quickly it's bonekrs |
12:23:24 | FromDiscord | <Phil> (edit) "bonekrs" => "bonkers" |
12:23:37 | FromDiscord | <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:42 | FromDiscord | <ShalokShalom> In reply to @Isofruit "God damn I forget": do you know the Caddy server? |
12:25:03 | FromDiscord | <ShalokShalom> It makes dealing with this kind of stuff easier |
12:25:04 | PMunch | I don't think scanf consumes anything, typically in C you'd just iterate your pointer |
12:25:22 | FromDiscord | <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:26 | FromDiscord | <Rika> In reply to @ShalokShalom "It makes dealing with": I don’t think it’s an issue of making the config |
12:25:47 | FromDiscord | <hmmm> In reply to @PMunch "I don't think scanf": i c munchie |
12:26:23 | PMunch | @jmgomez, I mean you could create a special kind of import which ran `parseStmt(readFile())` and just spit out a normal import.. |
12:26:29 | PMunch | But it's an ugly hack.. |
12:27:12 | PMunch | I just want the best of both worlds from inheritance and object variants |
12:27:17 | FromDiscord | <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:26 | FromDiscord | <jmgomez> yeah but that woudlnt give you symbols, will it? |
12:27:30 | FromDiscord | <ShalokShalom> haha 😄 |
12:27:37 | FromDiscord | <ShalokShalom> it has encypt build in |
12:27:40 | FromDiscord | <ShalokShalom> and it way easier 😛 |
12:27:46 | FromDiscord | <Rika> In reply to @Isofruit "I know apache and": I sure hope you don’t still use Apache |
12:27:50 | PMunch | I want the equivalent of the object variant enum but the extendability of inherited objects |
12:28:06 | FromDiscord | <ShalokShalom> I sure hope you dont still use nginx XD |
12:28:06 | PMunch | @jmgomez, eh there are ways you could do it |
12:28:09 | FromDiscord | <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:14 | FromDiscord | <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:17 | FromDiscord | <Rika> There is no issue with nginx |
12:28:28 | FromDiscord | <ShalokShalom> In reply to @Rika "It’s not easier if": sure, thats true |
12:28:35 | FromDiscord | <ShalokShalom> In reply to @Rika "There is no issue": other than its complexity |
12:28:43 | FromDiscord | <Phil> And I'm not aware of anything egregiously wrong with Apache either |
12:28:44 | PMunch | My point is that it is technically possible, but it would be a lot nicer to have something built in |
12:28:49 | FromDiscord | <Rika> I am not about to argue with you, given your track record |
12:28:55 | FromDiscord | <ShalokShalom> just its complexity ^^ |
12:29:18 | FromDiscord | <ShalokShalom> http server should be accessible for our grandma's |
12:29:28 | FromDiscord | <ShalokShalom> sorry 😛 |
12:29:57 | FromDiscord | <ShalokShalom> didnt meant to be mean |
12:31:45 | FromDiscord | <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:05 | FromDiscord | <Phil> Or requiring auth for serving files via nginx |
12:32:46 | FromDiscord | <Phil> To this day I've been too lazy to actually implement that last one for the images hosted on my webserver |
12:33:27 | FromDiscord | <ShalokShalom> 🤐 |
12:35:34 | FromDiscord | <ShalokShalom> Complexity of config files can be fairly easy compared |
12:38:01 | * | ltriant quit (Ping timeout: 268 seconds) |
12:38:09 | PMunch | Hmm, 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:08 | FromDiscord | <pyolyokh> WFM |
12:41:40 | FromDiscord | <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:04 | PMunch | I'm on Arch, so pretty new Firefox |
12:42:25 | PMunch | This 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:36 | PMunch | From this site: https://nim-lang.org/docs/os.html |
12:44:53 | FromDiscord | <hmmm> ha! munchie I could use parseUntil to keep track of the position in the string right? |
12:47:11 | PMunch | Yes, parseUntil is one way of doing it |
12:54:05 | FromDiscord | <huantian> In reply to @PMunch "Hmm, I'm getting errors": Dark mode in general or the auto detection |
12:59:17 | PMunch | Dark mode in general |
12:59:22 | PMunch | Clicking the switch does nothing |
13:04:54 | FromDiscord | <ShalokShalom> In reply to @PMunch "Hmm, I'm getting errors": Probably an add on? |
13:05:05 | FromDiscord | <ShalokShalom> Did you try without them on |
13:06:02 | * | Guest77 joined #nim |
13:07:02 | * | Guest77 quit (Client Quit) |
13:18:10 | PMunch | Haha, 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:40 | FromDiscord | <ShalokShalom> Add ons are most often behind such issues 😀 |
13:47:16 | FromDiscord | <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:33 | FromDiscord | <Ras> sent a code paste, see https://play.nim-lang.org/#ix=4kOq |
14:30:00 | FromDiscord | <Ras> (edit) "https://play.nim-lang.org/#ix=4kOq" => "https://play.nim-lang.org/#ix=4kOr" |
14:33:17 | FromDiscord | <enthus1ast> and this c.sys stuff what is this? |
14:34:48 | * | junaid_ quit (Remote host closed the connection) |
14:35:13 | FromDiscord | <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:21 | PMunch | Yup |
14:35:44 | PMunch | These 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:50 | PMunch | The error could definitely be better though.. |
14:37:14 | FromDiscord | <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:19 | FromDiscord | <Ras> In reply to @auxym "I think you might": that did the trick, thanks! |
14:37:54 | FromDiscord | <pyryrin> what does `{.cdecl.}` do |
14:38:15 | FromDiscord | <enthus1ast> it uses the default c compiler calling convention |
14:38:18 | * | argonica quit (Remote host closed the connection) |
14:38:32 | FromDiscord | <pyryrin> what does that mean |
14:38:56 | PMunch | It's basically "declare this as if it was declared in C" |
14:39:01 | FromDiscord | <enthus1ast> https://en.wikipedia.org/wiki/Calling_convention |
14:40:03 | FromDiscord | <pyryrin> why is it used? i don't see the point |
14:40:11 | FromDiscord | <pyryrin> (edit) "why" => "when" |
14:41:14 | FromDiscord | <enthus1ast> this has to do with how the low level return value or parameter to a procedure call's are handled |
14:42:20 | FromDiscord | <Rika> its generally important when doing FFI |
14:42:28 | FromDiscord | <Rika> otherwise there isnt much reason to concern about it |
14:42:52 | * | ltriant joined #nim |
14:43:33 | FromDiscord | <enthus1ast> and some libs/systems use that one some use the other one |
14:44:02 | FromDiscord | <enthus1ast> https://nim-lang.org/docs/manual.html#types-procedural-type |
14:45:19 | PMunch | @pyryrin, short answer is "if you're not sure what it does, you probably don't have to worry about it" |
14:45:41 | FromDiscord | <enthus1ast> or you wonder why you'r wrapper is not working ;) |
14:46:01 | PMunch | Well the answer to that question is simple: use Futhark |
14:46:15 | PMunch | It adds the correct calling convention |
14:46:38 | FromDiscord | <enthus1ast> is Futhark tested on windows btw? |
14:47:01 | PMunch | Not by me, don't have any Windows machines. But I believe other people have run it on Windows |
14:47:14 | PMunch | Someone 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:47 | FromDiscord | <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:32 | FromDiscord | <4zv4l> or does ARC does that ? |
15:28:37 | FromDiscord | <4zv4l> (edit) "does" => "do" |
15:33:05 | FromDiscord | <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:38 | FromDiscord | <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:04 | FromDiscord | <cow> and the www. is for a completely different domain |
15:36:27 | FromDiscord | <cow> but yes you can have different certs for subdomains |
15:36:32 | * | azimut joined #nim |
15:36:41 | * | arkurious joined #nim |
15:38:42 | FromDiscord | <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:04 | FromDiscord | <4zv4l> also is it me or `AcceptAddr` only write the `IP` address to the variable ? without the port ? why ? |
15:55:33 | FromDiscord | <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:58 | FromDiscord | <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:38 | FromDiscord | <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:46 | FromDiscord | <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:28 | FromDiscord | <Mustache Man> At what point does it become reasonable to suggest, "hey let's use Nim on this new project" ? |
17:15:12 | FromDiscord | <sOkam!> @pyolyokh @cow which, in practical terms, means? |
17:17:11 | FromDiscord | <pyolyokh> sent a long message, see http://ix.io/4kPi |
17:17:29 | FromDiscord | <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:20 | FromDiscord | <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:25 | FromDiscord | <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:40 | FromDiscord | <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:24 | FromDiscord | <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:37 | FromDiscord | <cow> for me, I like the explicitness personally, so I keep using that one yes |
17:22:52 | FromDiscord | <cow> I'm not sure if one is faster than the other |
17:22:56 | FromDiscord | <cow> both have to runtime check the type |
17:23:21 | FromDiscord | <pyolyokh> sent a long message, see https://paste.rs/dem |
17:23:34 | FromDiscord | <ShalokShalom> In reply to @sOkam! "yeah, i have code": You can shorten the variants |
17:23:35 | FromDiscord | <ShalokShalom> https://github.com/andreaferretti/patty#constructing-variant-objects |
17:28:26 | * | Jjp137 quit (Ping timeout: 246 seconds) |
17:31:33 | FromDiscord | <morgan> neat |
17:32:06 | * | Jjp137 joined #nim |
17:37:43 | FromDiscord | <pyolyokh> sent a long message, see http://ix.io/4kPm |
17:38:43 | FromDiscord | <sOkam!> sent a long message, see http://ix.io/4kPn |
17:39:27 | * | PMunch joined #nim |
17:41:34 | FromDiscord | <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:37 | FromDiscord | <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:50 | FromDiscord | <Mustache Man> 🙏 |
17:42:09 | FromDiscord | <sOkam!> that, and the formatting freedom that pyol mentioned, are probably the stupidest reasons that will gotcha |
17:43:06 | FromDiscord | <pyolyokh> sent a long message, see http://ix.io/4kPo |
17:43:16 | FromDiscord | <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:34 | FromDiscord | <pyolyokh> (edit) "http://ix.io/4kPo" => "http://ix.io/4kPp" |
17:43:56 | FromDiscord | <sOkam!> the next level of oop in nim is realizing how little you need it in this lang |
17:44:11 | FromDiscord | <Mustache Man> In reply to @pyolyokh "and likewise there are": this makes me think of using Spring for microservices haha |
17:45:04 | FromDiscord | <Mustache Man> yeah Java made OOP an industry standard in all the wrong ways 😿 |
17:45:15 | FromDiscord | <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:22 | FromDiscord | <Mustache Man> now we get beaten over the head with design patterns instead of functional programming concepts |
17:46:40 | FromDiscord | <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:36 | FromDiscord | <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:06 | FromDiscord | <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:57 | FromDiscord | <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:07 | FromDiscord | <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:31 | FromDiscord | <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:48 | FromDiscord | <DeLannoy> How do I prevent a nim executable from closing right after it was open? |
19:27:52 | FromDiscord | <hotdog> In reply to @0ffh "Shouldn't these two snippets": eventQueue[0] should be eventQueue[^1] no? |
19:28:04 | FromDiscord | <hotdog> In reply to @DeLannoy "How do I prevent": Is this on windows? |
19:28:32 | FromDiscord | <DeLannoy> yes |
19:28:41 | FromDiscord | <DeLannoy> (edit) "open?" => "opened up?" |
19:29:10 | FromDiscord | <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:39 | FromDiscord | <0ffh> So, no. The event with the smallest eventTime should be at [0], shoudln't iz? |
19:29:54 | FromDiscord | <0ffh> (edit) "shoudln't iz?" => "shouldn't it?" |
19:30:26 | FromDiscord | <0ffh> But then again, my understanding might be wrong, I'll check |
19:30:47 | FromDiscord | <hotdog> In reply to @0ffh "My understanding is, the": Ah right |
19:30:50 | * | TakinOver quit (Ping timeout: 255 seconds) |
19:31:05 | FromDiscord | <hotdog> In reply to @DeLannoy "yes": There is a compiler flag iirc |
19:32:58 | FromDiscord | <0ffh> In reply to @hotdog "Ah right": I checked, should be at [0]. Doesn't even compile with [^1]. |
19:33:11 | FromDiscord | <hotdog> Have you defined `<` @0ffh |
19:33:25 | FromDiscord | <!!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:53 | FromDiscord | <!!sharpcdf!!> And also is it fine to do clear() on every update? |
19:34:03 | FromDiscord | <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:19 | FromDiscord | <DeLannoy> In reply to @hotdog "There is a compiler": Sorry but I couldn't find it on the doc page 😦 |
19:34:48 | FromDiscord | <hotdog> In reply to @0ffh "It's a tuple, the": Just checking if you had manually defined one |
19:35:21 | FromDiscord | <0ffh> In reply to @hotdog "Just checking if you": Nah, it's an anonymous tuple anyways, so couldn't even. 😁 |
19:36:33 | FromDiscord | <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:39 | FromDiscord | <0ffh> It's a mystery. |
19:37:09 | * | FromDiscord quit (Remote host closed the connection) |
19:37:22 | * | FromDiscord joined #nim |
19:43:45 | FromDiscord | <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:48 | FromDiscord | <0ffh> sent a long message, see https://paste.rs/3er |
19:44:03 | FromDiscord | <0ffh> (edit) "long message," => "code paste," | "http://ix.io/4kPU" => "https://play.nim-lang.org/#ix=4kPT" |
19:44:29 | FromDiscord | <0ffh> (edit) "https://play.nim-lang.org/#ix=4kPT" => "https://play.nim-lang.org/#ix=4kPV" |
19:44:47 | FromDiscord | <hotdog> In reply to @0ffh "OOF! Found the bug.": Nice 🎉 |
19:45:05 | FromDiscord | <0ffh> In reply to @hotdog "Nice 🎉": Is that a bug should submit? |
19:46:02 | FromDiscord | <hotdog> In reply to @0ffh "Is that a bug": Not sure without seeing the full code |
19:46:06 | FromDiscord | <hotdog> See if you can narrow it down a bit |
19:47:58 | FromDiscord | <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:52 | FromDiscord | <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:33 | FromDiscord | <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:25 | FromDiscord | <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:34 | FromDiscord | <0ffh> (edit) "it!↵I" => "it! 🎉 ↵I" | "🎉" => "😁 " |
20:05:24 | * | jmdaemon joined #nim |
20:10:22 | * | TakinOver joined #nim |
20:15:44 | FromDiscord | <hotdog> In reply to @0ffh "Yup, that fixes it!": I looked at the signature of ``[]`` in heapqueue |
20:20:17 | FromDiscord | <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:44 | FromDiscord | <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:24 | FromDiscord | <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:50 | FromDiscord | <System64 ~ Flandre Scarlet> I absolutely love how rich is the stdlib↵It lets you do a ton of things without any effort! |
20:42:47 | FromDiscord | <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:03 | FromDiscord | <jos> does anybody know how to take a ref object and pass it to an FFI as a pointer safely |
20:50:07 | FromDiscord | <jos> that should be possible right |
20:50:10 | FromDiscord | <jos> like just an opaque handle to a ref object |
20:51:03 | FromDiscord | <jos> sent a code paste, see https://play.nim-lang.org/#ix=4kQa |
20:51:19 | FromDiscord | <jos> so i need to first leak fontTexture onto the heap, because i don't want it cleaned up by GC |
20:51:23 | FromDiscord | <jos> and maybe something else i'm missing? |
20:51:25 | FromDiscord | <jos> how do i do that |
20:53:43 | Zevv | GC_ref it |
20:54:09 | FromDiscord | <demotomohiro> @jos https://nim-lang.org/docs/system.html#GC_ref%2Cref.T |
20:54:38 | FromDiscord | <jos> i'm trying that, but something is maybe going wrong when i cast it back |
20:54:39 | Zevv | or alloc() it instead of new() |
20:54:47 | Zevv | it's not GC managed |
20:54:50 | Zevv | in that case |
20:54:55 | FromDiscord | <jos> `type Texture = ref object` btw |
20:55:00 | FromDiscord | <jos> and i'm using ORC |
20:55:10 | FromDiscord | <jos> i think |
20:55:16 | FromDiscord | <jos> i think that might be an issue |
20:55:25 | FromDiscord | <jos> does alloc work with ref types? |
20:55:33 | Zevv | nope, you get a ptr |
20:56:02 | FromDiscord | <jos> is there a way to get a ptr to a ref object then? that won't be moved |
20:56:55 | Zevv | it'll never get moved, but it might get GC'ed if you don't keep it around |
20:56:58 | Zevv | thing[].addr |
20:57:35 | FromDiscord | <jos> weird.. i can use cast[pointer](thing) or cast[pointer](thing[].addr) and both of those work |
20:57:52 | FromDiscord | <jos> but i would have thought i had to use cast[pointer](thing.addr) |
20:58:24 | FromDiscord | <demotomohiro> They are same thing. ref types are actually pointers. |
20:59:22 | FromDiscord | <demotomohiro> thing.addr is an address of a pointer. |
20:59:31 | Zevv | they are not the same |
20:59:38 | Zevv | and thing.addr should not work |
20:59:38 | FromDiscord | <jos> they're even pointers when they're on the stack? |
20:59:42 | FromDiscord | <jos> ohhh |
20:59:44 | Zevv | you get hte address of the ptr |
20:59:46 | FromDiscord | <jos> i see |
21:00:26 | FromDiscord | <demotomohiro> And `thing[].addr` is an address of a thing that ref type points to. |
21:00:58 | Zevv | jos: https://play.nim-lang.org/#ix=4kQe |
21:01:00 | FromDiscord | <jos> makes sense, thanks! |
21:01:26 | FromDiscord | <jos> out of curiosity are ref types on the stack always pointers to heap allocated data? |
21:01:33 | FromDiscord | <jos> even after optimization |
21:01:52 | FromDiscord | <jos> In reply to @Zevv "jos: https://play.nim-lang.org/#ix=4kQe": thanks this helps |
21:01:53 | Zevv | what kind of optimization are you thinking of |
21:02:05 | Zevv | refs are always on the heap |
21:02:55 | FromDiscord | <Elegantbeef> Due to their semantics they cannot safely live on the stack |
21:02:55 | FromDiscord | <Elegantbeef> Ref types only point to heap data |
21:03:21 | FromDiscord | <jos> so even if i just like do something like |
21:04:09 | FromDiscord | <jos> that's making a heap allocation |
21:04:10 | FromDiscord | <jos> sent a code paste, see https://play.nim-lang.org/#ix=4kQg |
21:04:25 | FromDiscord | <Elegantbeef> Yes |
21:04:27 | FromDiscord | <jos> i mean it makes sense once you start using the other features or have multiple refs to the same object |
21:04:31 | FromDiscord | <Elegantbeef> `ref` is a heap allocated type due to it's semantics |
21:04:33 | FromDiscord | <jos> but i was wondering if in trivial cases like that it would be optimized |
21:04:37 | FromDiscord | <jos> don't some languages do that |
21:04:55 | FromDiscord | <Elegantbeef> I doubt it |
21:05:12 | FromDiscord | <Elegantbeef> Aside from the allocation there is like 0 reason to 'optimise it' |
21:05:18 | Zevv | I probably posted https://zevv.nl/nim-memory/ here before |
21:05:37 | FromDiscord | <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:50 | FromDiscord | <Elegantbeef> Otherwise you can do `let x = typeof(Vec3()[])(x: 1, y: 2, z: 3)` |
21:06:07 | FromDiscord | <jos> interesting |
21:06:49 | FromDiscord | <Elegantbeef> Like i said though aside from allocation there isnt any reason to optimise heap usage |
21:07:05 | Zevv | A general guideline could be 'put it on the stack unless you need to put it on the heap' |
21:07:06 | FromDiscord | <Elegantbeef> So if you allocate once the overhead isnt much better |
21:07:13 | FromDiscord | <Elegantbeef> Yep |
21:07:21 | FromDiscord | <Elegantbeef> If you need reference semantics you use ref |
21:07:25 | FromDiscord | <Elegantbeef> People seem to complicate it for some reason |
21:07:35 | FromDiscord | <jos> i guess it's kind of like a generational gc |
21:07:44 | FromDiscord | <jos> is why i thought it might be a thing |
21:07:45 | Zevv | oh happens to me often as well, I just think too reffy, make my objects ref by default |
21:08:25 | Zevv | its easier, you can pass refs around and things are mutable without having to 'var' the args, things like that |
21:09:32 | Zevv | it'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:34 | FromDiscord | <Elegantbeef> Yea I forgot to specify when storing data that could be contiguous heap would add overhead |
21:12:51 | FromDiscord | <Elegantbeef> You also introduce nilable types, which is sinful! |
21:14:58 | Zevv | i 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:52 | FromDiscord | <jos> is there a way to enable non nullable types by default? |
21:35:04 | FromDiscord | <jos> like stuff like that init pragma and friends too |
21:35:05 | Zevv | that was tried, somewhere in 2018 |
21:35:09 | FromDiscord | <jos> i would like to enforce that across my whole codebase |
21:35:24 | Zevv | but that failed |
21:37:10 | Zevv | not sure what the state of this is: https://nim-lang.org/docs/manual_experimental_strictnotnil.html |
21:47:28 | FromDiscord | <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:55 | FromDiscord | <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:14 | FromDiscord | <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:01 | FromDiscord | <Elegantbeef> Manually grab the fields you want after parsin |
22:09:59 | * | ltriant joined #nim |
22:10:42 | FromDiscord | <Saint> Yeah |
22:24:51 | * | kenran quit (Remote host closed the connection) |
22:52:37 | * | xet7 quit (Quit: Leaving) |
23:18:41 | FromDiscord | <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:53 | FromDiscord | <Saint> This is very cool thanks @auxym |
23:35:26 | FromDiscord | <voidwalker> nim forum doesn't save message text draft, right ? I was writing a long post and clicked a link accidentally 😦 |