00:06:20 | FromDiscord | <Array in ∀ Matrix> oh i must've just missed it then thanks |
00:55:33 | * | azimut quit (Remote host closed the connection) |
00:59:05 | * | azimut joined #nim |
01:14:09 | * | azimut quit (Remote host closed the connection) |
01:15:49 | * | azimut joined #nim |
01:39:13 | FromDiscord | <Leftbones> Is there a benefit to using result vs return? |
01:40:44 | FromDiscord | <Elegantbeef> There is no runtime benefit |
01:40:53 | FromDiscord | <Elegantbeef> The best thing is implicit, then result, then return imo but ymmv |
01:40:54 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4lsK |
02:17:14 | FromDiscord | <ted__> sent a code paste, see https://play.nim-lang.org/#ix=4lsQ |
02:18:12 | FromDiscord | <Elegantbeef> There is collect but you require the iteration |
02:18:30 | FromDiscord | <Elegantbeef> so it'd be like `var a = collect(for pair in foo=bar,baz,qux=wibble".parseConfig: pair)` |
02:18:31 | FromDiscord | <Rika> Doesn’t toSeq work or what |
02:18:40 | FromDiscord | <Elegantbeef> `toSeq` should |
02:18:57 | FromDiscord | <ted__> I tried `toSeq` and it didn't work, but maybe I did it wrong, let me try again |
02:19:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lsR |
02:20:06 | FromDiscord | <ted__> yep, I must have done it wrong, thanks! |
02:37:56 | FromDiscord | <scruz> sent a code paste, see https://play.nim-lang.org/#ix=4lsU |
02:39:00 | FromDiscord | <scruz> (edit) "https://play.nim-lang.org/#ix=4lsU" => "https://play.nim-lang.org/#ix=4lsV" |
02:54:57 | FromDiscord | <kots> Looks like inim, you can get it with nimble |
03:01:50 | * | xet7 quit (Ping timeout: 246 seconds) |
03:18:02 | * | azimut quit (Ping timeout: 255 seconds) |
03:36:34 | * | xet7 joined #nim |
03:48:25 | FromDiscord | <tfp> sent a code paste, see https://play.nim-lang.org/#ix=4lt6 |
03:48:30 | FromDiscord | <tfp> so seqs seem like non ref types |
03:48:43 | FromDiscord | <tfp> is there a way to them behave like ref types |
03:48:49 | FromDiscord | <tfp> i tried `var y = ref x` and `ref y = x` |
03:49:01 | FromDiscord | <tfp> basically what can i put on line 2 to make this behave how i expect it |
03:51:17 | FromDiscord | <Rika> X has to be a ref seq |
03:51:56 | FromDiscord | <tfp> if u use ref in an argument list u get the behavior that i want |
03:52:03 | FromDiscord | <tfp> is there no way to just do that on the stack? |
03:52:25 | FromDiscord | <Rika> No |
03:52:56 | FromDiscord | <Rika> Unless you want unsafe |
03:52:59 | FromDiscord | <Rika> Or experimental |
03:53:12 | FromDiscord | <tfp> weird |
03:53:21 | FromDiscord | <tfp> that makes sense to me as a feature |
03:54:00 | FromDiscord | <Rika> Safety is difficult to guarantee unless you add severe limitations to it iirc |
03:54:21 | FromDiscord | <tfp> yeah that makes sense |
03:54:25 | FromDiscord | <tfp> i guess you'd need a borrow checker basically |
03:54:32 | FromDiscord | <tfp> i think addr is fine then if i ever really do need to do this |
04:03:55 | FromDiscord | <Elegantbeef> In Nim `ref` is a heap allocated type, unlike C++'s references |
04:03:55 | FromDiscord | <Elegantbeef> Technically we could abuse a for loop and make an alias an explicit `for y in alias(x)` |
04:04:27 | FromDiscord | <tfp> even if you accept an arg via ref it's suddenly allocated on the heap? |
04:04:33 | FromDiscord | <tfp> that was the behavior i was trying to mimick on the stack |
04:05:43 | * | azimut joined #nim |
04:12:29 | FromDiscord | <Elegantbeef> Nim implicitly will pass arguments by reference if it's faster, but yes in Nim `ref T` is heap allocated |
04:12:29 | FromDiscord | <Elegantbeef> `var T` can be stack or heap allocated, it just has to be a mutable lvalue |
04:12:35 | * | crem quit (Read error: Connection reset by peer) |
04:13:23 | * | arkurious quit (Quit: Leaving) |
04:23:17 | FromDiscord | <Try2Cry> sent a long message, see http://ix.io/4ltb |
04:23:28 | FromDiscord | <Elegantbeef> think it emits es3 |
04:23:59 | FromDiscord | <Try2Cry> 3 !!!! https://media.discordapp.net/attachments/371759389889003532/1064761980486951013/image0.png |
04:28:49 | FromDiscord | <sOkam!> Can you think of a way to create this type of rb-tree without all the experimental crazyness? https://rosettacode.org/wiki/Algebraic_data_types#Nim |
04:30:10 | FromDiscord | <Elegantbeef> Do the same thing the fusion macro does manually |
04:33:11 | FromDiscord | <sOkam!> yeah, that's the question. how to do it without having to learn fusion to not use fusion |
04:35:52 | FromDiscord | <Elegantbeef> you can `expandMacros` on that case statement and see the generated code |
04:47:34 | FromDiscord | <Elegantbeef> https://en.wikipedia.org/wiki/Red%E2%80%93black_tree#Operations mostly documents the algorithims used |
04:47:35 | FromDiscord | <Elegantbeef> Might be able to find something else that is more educational |
05:32:08 | * | azimut quit (Ping timeout: 255 seconds) |
06:45:17 | * | mal`` quit (Quit: Leaving) |
07:02:52 | * | mal`` joined #nim |
07:53:23 | * | PMunch joined #nim |
08:05:25 | FromDiscord | <xoich (xoich)> hi, I have a s = seq[X] where X is an object. I want to modify s[^1] but I don't want to write s[^1] every time. How do I give a name to s[^1] without making X a ref object? |
08:06:00 | * | rockcavera quit (Remote host closed the connection) |
08:06:09 | FromDiscord | <Elegantbeef> `template lastElement: auto = s[^1]` |
08:06:51 | FromDiscord | <xoich (xoich)> @elegantbeef\:matrix.org that is cool, thanks, but can I assign it to a variable? |
08:07:24 | FromDiscord | <Elegantbeef> If you dont mind unsafe code you can `import std/decls` and do `var myVal{.byAddr.} = s[^1]` |
08:07:31 | FromDiscord | <pyolyokh> you mean, assign `s.lastElement` to a variable and modify that variable, without reference to `s`? Not without pointers or experimental viewtypes |
08:07:31 | FromDiscord | <Elegantbeef> But that's just an unsafe version of the template |
08:08:36 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4ltN |
08:09:13 | FromDiscord | <Elegantbeef> We also could make a for loop |
08:09:15 | FromDiscord | <xoich (xoich)> ok thanks, I thought it would have been possible safely |
08:09:23 | FromDiscord | <Elegantbeef> Nah it requires a borrow checker |
08:11:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ltP |
08:12:12 | FromDiscord | <Elegantbeef> But still isnt safe |
08:12:58 | FromDiscord | <xoich (xoich)> I'll just make X a ref |
08:13:13 | FromDiscord | <pyolyokh> for the requirement of "I don't want to write s[^1] every time", a template does it. You can even make a local template just where you're doing this |
08:13:14 | FromDiscord | <Elegantbeef> You really should only use `ref` if you want ref semantics not for aliasing |
08:14:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ltQ |
08:14:32 | FromDiscord | <Elegantbeef> Created a dangling pointer with just safe mechanisms of Nim |
08:15:26 | FromDiscord | <Elegantbeef> But it demonstrates quite nicely why a borrow checker is needed for this logic |
08:15:30 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4ltR |
08:16:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ltS |
08:17:32 | FromDiscord | <xoich (xoich)> @\_discord\_803214225002463283\:t2bot.io I haven't studied templates yet, so I'm not really sure how they work but that seems ok yes |
08:17:41 | FromDiscord | <Elegantbeef> It's just code subsitution |
08:17:54 | FromDiscord | <Elegantbeef> when you call `last` it pastes the code directly where you called it |
08:17:59 | FromDiscord | <Elegantbeef> So in this case it pastes `s[^1]` |
08:18:52 | FromDiscord | <pyolyokh> build with `--mm:orc --expandArc:tedious --expandArc:slick`, it's the exact same code |
08:18:55 | FromDiscord | <xoich (xoich)> ok but I see\: untyped there, does it have any consequences? |
08:19:06 | FromDiscord | <Elegantbeef> Nope |
08:19:11 | FromDiscord | <Elegantbeef> pyolyokh was just being lazy |
08:19:38 | FromDiscord | <Elegantbeef> It should be `template last: var int = s[^1]` |
08:20:25 | FromDiscord | <xoich (xoich)> ok sounds good |
08:29:47 | * | jjido joined #nim |
08:51:02 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
09:29:16 | FromDiscord | <pyryrin> When youre making a wrapper for a c library, when you importc a proc does it need to be made `{.cdecl.}`? |
09:30:45 | FromDiscord | <Elegantbeef> It should be |
09:30:50 | FromDiscord | <Elegantbeef> It should be whatever convention is used |
09:30:55 | FromDiscord | <pyolyokh> it needs to match the calling convention of the C function in the C library. That's usually going to be cdecl, "the same convention as the C compiler" |
09:50:43 | FromDiscord | <pyryrin> In reply to @pyolyokh "it needs to match": But why does ot need to match it? |
09:51:12 | FromDiscord | <Elegantbeef> Cause calling conventions change how arguments are passed to a procedure call |
09:51:42 | FromDiscord | <Elegantbeef> If the conventions do not match you may have incorrect behaviour on some platforms/backends |
09:51:49 | FromDiscord | <pyryrin> Oh |
09:52:13 | FromDiscord | <Elegantbeef> Nim does actually do `cdecl` implicitly on linux, but i think on windows it can use fastcall or cdecl depending |
09:52:21 | FromDiscord | <Elegantbeef> Cannot recall which OS actually to be honest |
09:52:46 | FromDiscord | <Elegantbeef> but it's implicitly `nimCall` to distinctly type it |
09:53:11 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lu7 |
09:53:39 | FromDiscord | <Elegantbeef> `exportC, dynlib` |
09:53:53 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export |
09:54:38 | FromDiscord | <Elegantbeef> Without `dynlib` it just assumes "We're giving the C type a name" |
09:55:06 | FromDiscord | <pyolyokh> tyty |
09:55:52 | FromDiscord | <pyolyokh> incidentally it's still N_LIB_PRIVATE with that, but the symbol now shows up with nm -D. weird |
09:56:04 | FromDiscord | <Elegantbeef> Shrug it works |
09:56:23 | FromDiscord | <pyolyokh> and it says it's NIMCALL ... |
09:56:37 | FromDiscord | <Elegantbeef> well you didnt annotate it `cdecl` |
09:56:45 | FromDiscord | <pyolyokh> but if I add cdecl to useit.nim it still works, so yeah I guess that doesn't matter on this platform |
09:58:09 | FromDiscord | <Elegantbeef> Yea MS only has fastcall |
09:58:21 | FromDiscord | <Elegantbeef> So sadly `cdecl` is a separation due to MS shenanigans |
09:58:31 | FromDiscord | <pyolyokh> I'm on x86_64 linux though |
09:58:54 | FromDiscord | <pyolyokh> ah, it might not be this platform but a function signature that simple. |
09:58:59 | FromDiscord | <Elegantbeef> Yea so you use cdecl, but the Nim compiler distinguishes it to `nimCall` to prevent silent windows issues |
09:59:17 | FromDiscord | <Elegantbeef> Since it defaults to fastcall there, but cdecl pretty much everywhere else |
09:59:17 | FromDiscord | <New> hi all. i have file, 1.5MB. How i can send this by using sockets? ↵At this moment i just base64 my output and sending it to client. on client side just recvLine and decode. |
09:59:46 | FromDiscord | <New> (edit) "decode." => "decode.↵Using this method allow me to send only 750_000 bytes" |
10:00:07 | FromDiscord | <Elegantbeef> So technically if only supporting linux(and mac?) there is no reason to use `cdecl` 😛 |
10:00:12 | FromDiscord | <Elegantbeef> Send it in chunks moving up |
10:00:19 | FromDiscord | <pyolyokh> that works, but it should also work to not base64 and just dump the bytes down the wire. Also, that shouldn't limit the size of the file at all. Perhaps you're trying to do it a single syscall? |
10:03:25 | FromDiscord | <New> In reply to @pyolyokh "that works, but it": How it looks like:↵i send string + "\n"↵server side looking what i sent, if this is in "list of commands" (like ls -la) - do command, base64 it (cause all output from this command have "\n" and i read only 1 line on client side) and send to client with "\n"↵e.g.: |
10:04:16 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lua |
10:04:40 | FromDiscord | <pyolyokh> but, maybe recvLine has an internal limit. The alternative to a limit is letting anyone DDOS you after all |
10:04:42 | FromDiscord | <New> (edit) "In reply to @pyolyokh "that works, but it": How it looks like:↵i send string + "\n"↵server side looking what i sent, if this is in "list of commands" (like ls -la) - do command, base64 it (cause all output from this command have "\n" and i read only 1 line on client side) and send to client with "\n"↵e.g.:" => "sent a long message, see http://ix.io/4lub" |
10:04:54 | FromDiscord | <pyolyokh> (edit) "DDOS" => "DOS" |
10:05:46 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4luc |
10:05:53 | FromDiscord | <New> In reply to @pyolyokh "but, maybe recvLine has": my server send all to me, but when i do second input, i catch previous part of file xD |
10:06:18 | FromDiscord | <pyolyokh> the default maxLength isn't enough for even 1MB |
10:06:49 | FromDiscord | <New> so how i can change it then? to 150MB for example |
10:07:04 | FromDiscord | <pyolyokh> it's a parameter, just pass your own limit |
10:07:09 | FromDiscord | <New> recvLine(maxLength = 150_000_000 ? |
10:07:16 | FromDiscord | <New> (edit) "150_000_000" => "150_000_000)" |
10:07:18 | FromDiscord | <pyolyokh> yeah |
10:09:49 | FromDiscord | <New> impressive. i done it but its not worked before i asked xD↵just change to other value (more then was, eg i typed 150_000_000, now 200_000_000 and all ok) |
10:09:59 | FromDiscord | <New> tnx! have a nice day |
10:10:09 | FromDiscord | <New> (edit) "change" => "changed" |
10:10:56 | FromDiscord | <New> (edit) "impressive. i done it but its not worked before i asked xD↵just changed to other value (more then ... was," added "it" |
10:13:39 | * | jjido joined #nim |
10:32:24 | FromDiscord | <arkanoid> Interesting blog post!↵↵https://verdagon.dev/blog/when-to-use-memory-safe-part-2 |
10:38:01 | FromDiscord | <planetis> I wonder how can you possibly keep the top-down approach in a gui setting |
10:38:07 | FromDiscord | <Rika> Didn’t expect Nim to need mentioned |
10:38:11 | FromDiscord | <Rika> (edit) "need" => "be" |
10:39:02 | FromDiscord | <pyolyokh> >Lobster is using borrowing and other static analysis techniques under the hood to eliminate a lot of reference counting overhead.↵why is Lobster called out for doing this but Nim isn't? Probably: Lobster links to what it does direct from the documentation, but Arc/Orc is described by blog posts |
10:39:29 | FromDiscord | <planetis> (edit) "setting" => "setting. Except making everything a monolithic piece of code." |
10:39:45 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
11:47:18 | * | jjido joined #nim |
12:01:06 | FromDiscord | <auxym> good point. When 2.0 is officially out, it might be a good idea to include a blurb on ORC prominently on the front page |
12:37:26 | FromDiscord | <伊弉冉の恵み> good morning, are there any other tutorias you would recommend besides Kiloneie's? |
12:38:41 | FromDiscord | <Saint> It seems that my projects config.nims is not overriding my ~/.config/nim/config.nims |
12:38:48 | FromDiscord | <Saint> But rather the other way around |
12:58:05 | FromDiscord | <hotdog> In reply to @伊弉冉の恵み "good morning, are there": You mean video tutorials? I’m not sure there are any. There are various written tutorials linked from https://nim-lang.org/documentation.html |
12:58:40 | FromDiscord | <伊弉冉の恵み> In reply to @hotdog "You mean video tutorials?": yeah video ones |
12:59:02 | FromDiscord | <伊弉冉の恵み> I was recommended Kiloneie's videos when I first joined the server |
12:59:04 | FromDiscord | <伊弉冉の恵み> and they're great |
12:59:30 | FromDiscord | <伊弉冉の恵み> just wondering if there are any other ones worth checking out |
13:01:11 | FromDiscord | <hotdog> They aren’t really tutorials, but there’s a lot of video content on the nim channel https://youtube.com/@nimprogramminglanguage3130 |
13:01:25 | FromDiscord | <hotdog> Mostly from the recent nim conferences |
13:01:33 | FromDiscord | <hotdog> @伊弉冉の恵み |
13:03:37 | FromDiscord | <fbpyr> depends on the topics I guess. I also liked these by dev on duty\: ↵https://yewtu.be/playlist?list=PLu-ydI-PCl0PqxiYXQMmLh7wjQKm5Cz-H |
13:03:37 | FromDiscord | <fbpyr> https://yewtu.be/playlist?list=PL9Yd0XwsGAqwSRuWrDXn2SP3N8snNx29W |
13:03:37 | FromDiscord | <fbpyr> and aoc by pmunch |
13:03:52 | FromDiscord | <伊弉冉の恵み> In reply to @hotdog "<@972362853879275551>": of those I am aware, but thanks anyway |
13:03:55 | FromDiscord | <Simran> hey, how are u all? |
13:04:29 | FromDiscord | <伊弉冉の恵み> what's yewtube though? |
13:05:48 | FromDiscord | <fbpyr> a user and privacy friendl front-end to youtube |
13:06:28 | FromDiscord | <fbpyr> links are interchangeable. 🙂 yewtu.be \<-\> youtu.be youtube.com .. |
13:07:28 | FromDiscord | <fbpyr> there are more a couple more of these invidious servers though\: ↵https://docs.invidious.io/instances/ |
13:08:13 | FromDiscord | <fbpyr> source code\: https://github.com/iv-org/invidious |
13:11:08 | FromDiscord | <fbpyr> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1064893298864566293): a user and privacy friendly front-end to youtube |
13:11:09 | FromDiscord | <fbpyr> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1064893720253693962): there are a couple more of these invidious servers though\: ↵https://docs.invidious.io/instances/ |
13:14:35 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
13:20:50 | FromDiscord | <choltreppe> is there a way to generate docs using the js backend? |
13:28:03 | FromDiscord | <Simran> hey, how are u ? |
13:46:11 | FromDiscord | <MadScientistCarl> The Nim style guide says the implementation of method dispatching in Nim is bad. Is it still true? |
13:47:39 | FromDiscord | <Rika> iirc |
13:47:41 | FromDiscord | <Rika> yes |
13:52:38 | FromDiscord | <MadScientistCarl> So I tried storing behavior proc directly as object fields instead of using methods. That makes modularization really hard, again due to the cyclic import limitation |
14:19:27 | * | azimut joined #nim |
14:24:00 | * | arkurious joined #nim |
14:26:30 | * | azimut quit (Remote host closed the connection) |
14:27:57 | * | azimut joined #nim |
14:31:54 | PMunch | @MadScientistCarl, it's not that bad |
14:32:13 | PMunch | If you're doing inheritance and all that jazz you should probably still use methods |
14:32:31 | PMunch | But if you don't need them or can restructure your program you should probably do that instead |
14:32:50 | PMunch | @choltreppe, `nim doc`? Or am I missing something |
14:39:56 | * | azimut quit (Quit: ZNC - https://znc.in) |
14:40:47 | * | azimut joined #nim |
14:45:54 | * | PMunch quit (Quit: Leaving) |
14:55:22 | FromDiscord | <choltreppe> In reply to @PMunch "<@705152179782025308>, `nim doc`? Or": when I use `nim doc` all the js backend specific things behind `when defined(js)` are not included in the docs. I mean I guess that makes sense. so my question is is there some parameter i can use to use the js backend for the docs |
15:05:23 | FromDiscord | <hotdog> In reply to @choltreppe "when I use `nim": IIRC you can just do -d:js |
15:06:20 | * | azimut quit (Ping timeout: 255 seconds) |
15:06:32 | FromDiscord | <pyolyokh> that'll get you defined(js), but docs aren't the only things testing that |
15:06:59 | * | azimut joined #nim |
15:06:59 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lvr |
15:07:00 | * | ofelas joined #nim |
15:19:44 | FromDiscord | <Scalpi> sent a code paste, see https://play.nim-lang.org/#ix=4lvx |
15:22:07 | FromDiscord | <choltreppe> In reply to @Scalpi "I couldn't find a": why not use `#[ your comment ]# example()`? |
15:23:30 | FromDiscord | <Scalpi> thanks? it work! |
15:23:36 | FromDiscord | <choltreppe> np |
15:25:52 | * | ofelas quit (Quit: WeeChat 3.8) |
15:27:19 | FromDiscord | <hotdog> In reply to @pyolyokh "that'll get you defined(js),": Ah right, it's just --backend:js |
15:27:44 | FromDiscord | <hotdog> @choltreppe |
15:30:54 | * | beholders_eye joined #nim |
15:32:46 | FromDiscord | <choltreppe> In reply to @hotdog "Ah right, it's just": ah thanks. that worked. |
15:38:50 | FromDiscord | <choltreppe> now I have the problem that it uses node.js and I use the DOM in my code which obviously doesnt exist in node. Any idea how to solve this? |
15:41:29 | FromDiscord | <huantian> don't use the DOM in your code if you're targeting node? |
15:43:03 | FromDiscord | <choltreppe> no im not targeting node. but `nim doc`seems to use node for the runnableExamples checking |
15:44:33 | FromDiscord | <huantian> ah i see |
15:44:43 | FromDiscord | <hotdog> @choltreppe try `--docCmd:skip` |
15:44:59 | FromDiscord | <hotdog> To skip runnableExamples checking |
15:45:26 | FromDiscord | <hotdog> If you want to test them in the browser you might have to get creative |
15:46:11 | FromDiscord | <choltreppe> thanks that will do for now |
15:46:32 | FromDiscord | <hotdog> You could also try something like https://www.npmjs.com/package/jsdom to let you test the runnableexamples with Node |
16:19:35 | * | beholders_eye quit (Ping timeout: 255 seconds) |
16:26:26 | FromDiscord | <Ayano> how do i convert a long to a byte array? |
16:28:21 | FromDiscord | <Ayano> how do i convert an int to byte array? |
16:39:17 | FromDiscord | <choltreppe> you could use `cast[array[sizeof(int), byte]](x)` |
16:49:15 | FromDiscord | <GoMpow2> how can i index a array ptr float64 ? |
16:49:34 | FromDiscord | <GoMpow2> a\: ptr float64↵a[5] doesn't work |
16:50:16 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4lvP |
16:50:22 | FromDiscord | <huantian> can't remember if you need the `ptr` in the `cast` |
16:50:31 | FromDiscord | <GoMpow2> thx |
16:52:12 | * | beholders_eye joined #nim |
16:54:49 | Amun-Ra | cast is ugly as |
16:57:29 | Amun-Ra | this is C way of converting long (that may be 32-bit or 64-bit): https://play.nim-lang.org/#ix=4lvQ |
17:01:22 | * | Figworm joined #nim |
17:32:39 | * | junaid_ joined #nim |
17:47:02 | FromDiscord | <auxym> In reply to @Amun-Ra "this is C way": nim `cast` generates unions in C |
17:47:04 | * | junaid_ quit (Remote host closed the connection) |
17:47:59 | FromDiscord | <auxym> because of strict aliasing stuff I assume. "fun" read: https://gist.github.com/shafik/848ae25ee209f698763cffee272a58f8 |
17:48:33 | FromDiscord | <auxym> so yeah, casting to ptr UncheckedArray in Nim is the correct way to access a C array for FFI, to the best of my knowledge |
18:02:03 | * | jmdaemon joined #nim |
18:03:07 | * | xet7 quit (Ping timeout: 256 seconds) |
18:16:03 | * | xet7 joined #nim |
18:24:16 | * | jmdaemon quit (Ping timeout: 256 seconds) |
18:25:36 | * | jmdaemon joined #nim |
19:04:28 | FromDiscord | <Saint> How do I pass a seq as varags to a proc? |
19:04:36 | FromDiscord | <Saint> Like explode or expand it or whatever |
19:04:41 | FromDiscord | <Saint> Not sure of the name for it |
19:04:48 | FromDiscord | <leorize> just pass it |
19:05:00 | FromDiscord | <Saint> Just pass a sequence? |
19:05:10 | FromDiscord | <Saint> In python you have to do i think |
19:05:10 | FromDiscord | <leorize> yep |
19:05:12 | FromDiscord | <Saint> Hmm |
19:05:13 | FromDiscord | <Saint> Okay |
19:05:43 | FromDiscord | <leorize> `varargs` is a slightly more special `openArray` in that it let you pass without an array/seq |
19:05:53 | FromDiscord | <leorize> but if you have one it works just like `openArray` |
19:06:05 | FromDiscord | <leorize> except when it's `echo` |
19:07:10 | * | jmdaemon quit (Ping timeout: 268 seconds) |
19:11:40 | FromDiscord | <Saint> Gotcha |
19:11:42 | FromDiscord | <Saint> Thank you! |
19:12:49 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix=4lws |
19:13:04 | FromDiscord | <Rika> Body needs wait for too |
19:13:07 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix=4lwt |
19:13:10 | FromDiscord | <Saint> Yeah why does it need wait? |
19:13:12 | FromDiscord | <Rika> Body field is not expected |
19:13:13 | FromDiscord | <Rika> Exported |
19:13:20 | FromDiscord | <Saint> What does that mean |
19:13:22 | FromDiscord | <Rika> Body proc is what you’re calling |
19:13:25 | FromDiscord | <Rika> Not the field |
19:13:31 | FromDiscord | <leorize> (idk why we show non-exported fields in docs tbh) |
19:13:31 | FromDiscord | <Saint> Oh I see |
19:14:03 | FromDiscord | <Saint> Wow.. how would I be able to tell that |
19:14:07 | FromDiscord | <Saint> From the docs |
19:14:13 | FromDiscord | <Rika> Asterisk |
19:14:25 | FromDiscord | <Rika> But I’d say it’s obscure as fuck |
19:14:39 | FromDiscord | <Recruit_main707> `body:` private↵`body:` public |
19:14:40 | FromDiscord | <Saint> Asterisk means what |
19:14:47 | FromDiscord | <Saint> Oh I see |
19:14:48 | FromDiscord | <Rika> Export |
19:14:51 | FromDiscord | <Rika> Yes |
19:15:03 | FromDiscord | <Saint> Yeah that is very hard to catch |
19:15:05 | FromDiscord | <Recruit_main707> same with functions and types in general |
19:15:10 | FromDiscord | <Saint> Is there some way to update the docs? |
19:15:26 | FromDiscord | <Saint> Could I possibly include a note even? |
19:15:35 | FromDiscord | <Rika> Doc generator would prolly need to be changed in that case |
19:15:58 | FromDiscord | <Saint> What about including an example |
19:16:00 | FromDiscord | <Rika> Note would need approval from others I assume but I would like to believe it would be accepted easily |
19:16:15 | FromDiscord | <Rika> I will have to leave now |
19:16:26 | FromDiscord | <Saint> Goodbye I will miss you |
19:16:52 | FromDiscord | <Saint> (edit) "Goodbye I will miss you" => "See ya!" |
19:40:16 | FromDiscord | <Phil> Erm... not necessarily a nim specific question, more one with the nim image on docker |
19:41:49 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lwE |
19:42:21 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lwF |
19:43:32 | FromDiscord | <Phil> Based on a first google this can happen all over the place for random ass reasons, none of which I understand, anyone had this before? |
19:43:50 | * | jjido joined #nim |
19:44:43 | * | jmdaemon joined #nim |
19:45:46 | FromDiscord | <leorize> try podman |
19:48:30 | FromDiscord | <Saint> https://media.discordapp.net/attachments/371759389889003532/1064994643340689459/image.png |
19:48:36 | FromDiscord | <Saint> https://news.ycombinator.com/item?id=34410187 |
19:53:41 | FromDiscord | <Phil> Can I use podman as a drop in replacement for docker-cli? Because if I have to put in another dozen hours of effort to get the pipelines working for something I fundamentally do not care about that much then that's a heavy suggestion. |
19:57:31 | FromDiscord | <Phil> Ugh, docker needed login credentials for some random reason |
19:59:00 | * | jmdaemon quit (Ping timeout: 272 seconds) |
19:59:53 | * | jmdaemon joined #nim |
20:00:24 | FromDiscord | <Phil> Alrighty, sqliteTests run in a docker container... now to get postgresTests to run which are bombing for some random ass reason |
20:07:24 | * | jmdaemon quit (Ping timeout: 256 seconds) |
20:15:05 | * | jmdaemon joined #nim |
20:39:32 | * | jmdaemon quit (Ping timeout: 272 seconds) |
20:49:43 | FromDiscord | <ted__> In reply to @Isofruit "This is for the": is there a reason that you're running `docker-compose` with `sudo`? there shouldn't be a need to run docker/docker-compose with a root user and I could see it causing issues like what you're seeing. I use `colima` (https://github.com/abiosoft/colima) for docker on mac and it's been solid |
20:50:35 | FromDiscord | <ShalokShalom> https://podman.io/whatis.html |
20:50:41 | FromDiscord | <Phil> Because installing docker in a manner that doesn't require sudo is extra effort that I haven't gone through |
20:50:43 | FromDiscord | <ShalokShalom> there are some voices, that its not entirely true |
20:50:50 | FromDiscord | <ShalokShalom> but they had been three years old |
20:50:57 | FromDiscord | <ShalokShalom> at this time |
20:51:56 | FromDiscord | <ted__> In reply to @Isofruit "Because installing docker in": my org has thousands of engineers all using colima and AFAIK none of them are using it as a super user, for 95% of people it's just `brew install colima docker docker-desktop` then `colima start` and you're good |
20:52:35 | FromDiscord | <ted__> the other 5% of people have messed up brew installations or are using testcontainers and need additional resources to be given to the lima engine underneath |
21:29:40 | * | azimut quit (Remote host closed the connection) |
21:30:58 | * | rockcavera joined #nim |
21:31:03 | * | azimut joined #nim |
21:53:32 | FromDiscord | <arne> my organization uses scala and docker |
22:15:12 | FromDiscord | <Leftbones> Not necessarily a Nim problem but why is reading special keys from `getch` so annoying 💀 |
22:16:17 | FromDiscord | <Elegantbeef> What character are you trying to read? |
22:16:27 | FromDiscord | <Leftbones> Stuff like delete, arrow keys, function keys, etc |
22:24:01 | FromDiscord | <Leftbones> On the ASCII table, arrow up is 72, but `getch` reads 0, for example |
22:24:28 | FromDiscord | <Leftbones> I don't have the greatest understanding of how `getch` works under the hood, but I managed to do this in the past, though it was a few years ago |
22:38:11 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
22:49:08 | FromDiscord | <Mustache Man> https://tenor.com/view/head-spinning-my-is-overwhelmed-gif-24700382↵> ↵> me realizing the technologies and stacks I've been using professionally for the past 10 years are no longer relevant to the job market |
22:50:29 | FromDiscord | <Mustache Man> feels like nobody's writing new software anymore, it's just data pipelines, migration to cloud, and devops |
22:51:30 | FromDiscord | <Mustache Man> so not having years of experience with python, go, and terraform is rather painful |
22:52:32 | FromDiscord | <Mustache Man> i wonder if this is how the previous generation of programmers felt when java showed up 🤔 |
22:54:32 | FromDiscord | <Leftbones> And then the java programmers when kotlin showed up |
22:55:33 | FromDiscord | <Mustache Man> i would love to work in kotlin, but it hasn't gained much mindshare. |
22:56:10 | FromDiscord | <Mustache Man> go & python are ubiquitous now |
22:56:55 | FromDiscord | <Leftbones> I can't seem to get into Go |
22:58:40 | FromDiscord | <Mustache Man> In reply to @Leftbones "I can't seem to": i guess i'm going to try, since at least at its core it has a similar purpose as nim |
22:58:52 | FromDiscord | <Mustache Man> syntactically it's gross |
22:59:01 | FromDiscord | <Leftbones> Yeah I am not a huge fan of the syntax but it's better than rust at least |
22:59:04 | FromDiscord | <Elegantbeef> Does Nim and Go have similar purpose? |
22:59:19 | FromDiscord | <Leftbones> I think Go presents itself as a systems language? Though I don't see many people treating it that way |
22:59:23 | FromDiscord | <Mustache Man> i feel like they do, right? small, light, GC |
22:59:26 | FromDiscord | <Elegantbeef> It doesnt |
22:59:34 | FromDiscord | <Leftbones> I might be thinking of something else |
22:59:36 | FromDiscord | <Leftbones> Oh, Zig |
22:59:43 | FromDiscord | <Elegantbeef> Odin? |
22:59:59 | FromDiscord | <Leftbones> Zig aspires to replace C/C++, which is ambitious, to say the least |
23:00:02 | FromDiscord | <Mustache Man> i have never even heard of these 😛 |
23:00:02 | FromDiscord | <Elegantbeef> Go has weird semantics like automatically raising data to heap if it needs it |
23:00:26 | FromDiscord | <Elegantbeef> It also has the dumbest time format string |
23:00:26 | FromDiscord | <Mustache Man> i've heard go doesn't have proper multithreading but idk if that's true |
23:00:54 | FromDiscord | <Elegantbeef> "We wrote the data on a board using 1..bleh and use that date for formatting, cause it's cool or something" |
23:01:07 | FromDiscord | <Mustache Man> it also has no while loops... ? and no inheritance.. just, some questionable decisions |
23:01:23 | FromDiscord | <Elegantbeef> Meh it has interfaces |
23:01:36 | FromDiscord | <Elegantbeef> It does have while though |
23:01:44 | FromDiscord | <Elegantbeef> `for x {}` |
23:02:01 | FromDiscord | <Mustache Man> dead |
23:02:28 | FromDiscord | <Elegantbeef> I think the worst part is there is no error handling in the language |
23:02:34 | FromDiscord | <Elegantbeef> So it's up to the programmer to decide what the error type/value is |
23:02:51 | FromDiscord | <Leftbones> In reply to @Leftbones "Is there a way": The other day I asked this, and I think I should explain better what I am trying to accomplish. I want to have a char enum `Key` with nice names like `Key.Delete` or `Key.Up` so when I'm reading from `getch` I don't have to go purely off of numbers, but of course I can't compare the output of `getch` with `Key` because they are different types. Any ideas or am I barking up a non-existent tree? |
23:03:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lxx |
23:03:56 | FromDiscord | <jtv> Go's a perfectly language but a missed opportunity to have a good static type system for my tastes. |
23:04:03 | FromDiscord | <jtv> (edit) "Go's a perfectly ... language" added "fine" |
23:04:21 | FromDiscord | <Leftbones> Oh and the only reason I want `Key` to be comparable to char, is because for letters I'd like to be able to check if the getch output is `a` or `A` without having to have `Key.A` and `Key.ShiftA` like Illwill does |
23:04:25 | FromDiscord | <Elegantbeef> There's quite a bit of it's language design i just disagree |
23:04:52 | FromDiscord | <Elegantbeef> Cause `myKey in {ShiftA, A}` is so hard |
23:05:07 | FromDiscord | <Elegantbeef> or `myKey in [ShiftA, A]` |
23:05:29 | FromDiscord | <Leftbones> I mean, yeah. It's just not the most elegant solution, in my opinion |
23:05:44 | FromDiscord | <Mustache Man> Go also uses C style pointer and address syntax.. wish they'd changed that.↵initializing an array like this though:↵myArray := [3]int{5, 4, 3} |
23:05:45 | FromDiscord | <jtv> Yeah, I agree, it goes too far out of its way to be close to C |
23:05:47 | FromDiscord | <Leftbones> There shouldn't need to be Keys for all the letters and their uppercase versions, since those are just chars |
23:06:00 | FromDiscord | <jtv> While making some weird departures like walrus tusks |
23:06:30 | FromDiscord | <Mustache Man> (edit) "Go also uses C style pointer and address syntax.. wish they'd changed that.↵initializing an array like this though:↵myArray := [3]int{5, 4, 3}" => "sent a code paste, see https://play.nim-lang.org/#ix=4lxy" |
23:06:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/bU2 |
23:06:42 | FromDiscord | <Leftbones> Maybe it's a minor nitpick, but I hate having to use `:=` in Go, honestly |
23:06:52 | FromDiscord | <Elegantbeef> Which is weird cause it's based off oberon↵(@jtv) |
23:06:57 | FromDiscord | <Elegantbeef> Yet it doesnt even work like oberon |
23:06:58 | FromDiscord | <jtv> Yeah, those are the walrus tusks |
23:07:06 | FromDiscord | <Leftbones> OH LOL |
23:07:08 | FromDiscord | <Leftbones> That's what you meant |
23:07:21 | FromDiscord | <Mustache Man> so like, Go is open source, and it's still this weird ugly mish-mash of languages |
23:07:34 | FromDiscord | <Elegantbeef> The bastards went "You know oberon has an export marker, let's copy the it by making it so if the first character is a capital character it's exported" |
23:07:35 | FromDiscord | <jtv> Every language is a mish-mash of lots of languages |
23:07:40 | FromDiscord | <Mustache Man> but i guess i'm gonna learn it because it's in demand |
23:07:49 | FromDiscord | <Elegantbeef> They did that export shit, whilst having unicode identifiers |
23:08:04 | FromDiscord | <Leftbones> I like it in a language where doing `var x: int = 1` and `var int := 1` mean the same thing |
23:08:11 | FromDiscord | <Mustache Man> In reply to @jtv "Every language is a": that's like saying there's no original art |
23:08:14 | FromDiscord | <Elegantbeef> So now if you look at chinese written Golang code it is like `T` followed by unicode chinese characters |
23:08:35 | FromDiscord | <jtv> Nim's got some things that I'd do differently synactically but minor in comparison. |
23:08:50 | FromDiscord | <jtv> Their FFI is also a huge PITA |
23:09:01 | FromDiscord | <Mustache Man> FFI? |
23:09:09 | FromDiscord | <Elegantbeef> Foreign function interface |
23:10:05 | FromDiscord | <Leftbones> I have no gripes with nim's syntax so far, I've only been writing nim for like 3 days, but it's very comfy so far |
23:10:11 | FromDiscord | <Leftbones> (edit) removed "so far" |
23:10:16 | FromDiscord | <Mustache Man> i think the one thing that gets me about most languages, including nim, is the liberal use of different brackets for different purposes |
23:11:08 | FromDiscord | <treeform> I am just glad I don't have to use these: ⟦ ⟧ ⟨ ⟩ ⟪ ⟫ ⟮ ⟯ ⟬ ⟭ ⌈ ⌉ ⌊ ⌋ ⦇ ⦈ ⦉ ⦊ |
23:11:21 | FromDiscord | <Leftbones> Since Nim seems to use them closer to how Python does, I don't necessarily have a problem with them |
23:11:25 | FromDiscord | <jtv> Well, I specifically don't like dictionaries being relegated to the library and literals being syntactic sugar. |
23:11:35 | FromDiscord | <Elegantbeef> The original Go generics were like `func MyProc(T)(a T){...}` |
23:11:50 | FromDiscord | <Elegantbeef> That proposal was fucking wild |
23:11:57 | FromDiscord | <Leftbones> I feel like the only real gripe I have read about Nim's syntax were about the indents, but idk if that's even a valid complaint honestly |
23:12:04 | FromDiscord | <Elegantbeef> It's not |
23:12:26 | FromDiscord | <Leftbones> I mean, if you take the brackets out of C++ and it's still readable, were the brackets really necessary |
23:12:26 | FromDiscord | <Mustache Man> people just complain about writing neat code, i guess |
23:12:33 | FromDiscord | <Elegantbeef> Any properly written code is indistinguishable from whitespace |
23:12:52 | FromDiscord | <Leftbones> Old traditions die hard, I guess. |
23:12:55 | FromDiscord | <Elegantbeef> And on top of it Nim's whitespace is much better than Python's for instance |
23:12:56 | FromDiscord | <Mustache Man> indeed, the best code is no code ahaha |
23:13:08 | FromDiscord | <Elegantbeef> Like python has that stupid C pre processor macro `\` feature |
23:13:28 | FromDiscord | <leorize> the tabs stuff bit people hard in python so probably some of them remember that |
23:13:38 | FromDiscord | <jtv> Yeah I remember that. I do think the one thing I'd change about generics is going back to the more original functional style where type variables were just written 't instead of having to overload [] |
23:13:39 | FromDiscord | <Elegantbeef> That's how bad their white space operates... you might have to tell the parser "You know this statement carrys on in the second line, but you should know that cause it's a binary operator" |
23:13:57 | FromDiscord | <jtv> Or at least consider them parameters and stick them w/ the formals |
23:14:11 | FromDiscord | <Elegantbeef> Nim has implicit generics |
23:14:12 | FromDiscord | <Elegantbeef> So i dont follow |
23:14:29 | FromDiscord | <Recruit_main707> talking about go i guess |
23:14:45 | FromDiscord | <jtv> Sure, when I need to disambiguate at a call site, I have to use foo[typeParams](non-type-Params) |
23:14:55 | FromDiscord | <jtv> I find the overloading of [] meh. |
23:15:06 | FromDiscord | <Elegantbeef> The thing i'd change with Go's generics is make them fucking monomorphic in more cases |
23:15:13 | FromDiscord | <leorize> the `[]` in nim does serve a purpose of allowing it to be omitted \:p |
23:15:46 | FromDiscord | <leorize> btw you can put the type inside `()`, in which case you always have to specify it |
23:16:01 | FromDiscord | <leorize> but it works if that's your jam |
23:16:15 | FromDiscord | <Elegantbeef> Nim's got some of the more friendly generic dispatch |
23:16:21 | FromDiscord | <jtv> They were forever omitted in every early functional language like ML. You just used them like: myfunc(x: 't, y: 't) ... |
23:16:44 | FromDiscord | <jtv> And they were generally inferred of course |
23:17:00 | FromDiscord | <huantian> I do like the security of polymorphic generics tho |
23:17:01 | FromDiscord | <Elegantbeef> `myFunc(x, y: auto)` |
23:17:21 | FromDiscord | <huantian> getting the error at the call site instead of the generics is sometimes annoying↵but ig that's why we have concepts |
23:17:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lxC |
23:17:35 | FromDiscord | <huantian> (edit) "getting the error at the call site instead of the generics is sometimes annoying↵but ig that's why we have concepts ... " added "to help with it a tad" |
23:17:44 | FromDiscord | <Elegantbeef> This sentence is funny↵(@huantian) |
23:17:51 | FromDiscord | <Elegantbeef> Generics are polymorphic, so uhhh 😛 |
23:17:53 | FromDiscord | <jtv> Yeah, I know, the call site is more my issue. |
23:18:05 | FromDiscord | <Elegantbeef> You mean the security of constrained generics |
23:18:12 | FromDiscord | <jtv> Parametric polymorphism vs. inclusion polymorphism vs ad hoc etc |
23:18:14 | FromDiscord | <huantian> yeah |
23:18:19 | FromDiscord | <huantian> big words me no understand |
23:18:20 | FromDiscord | <jtv> Casting is polymorphism too 🙂 |
23:18:44 | FromDiscord | <Elegantbeef> With new concepts the error messages should be capable of being nicer and more friendly |
23:19:14 | FromDiscord | <Elegantbeef> But really any procedure declared with a concept should check that the variable is only used in a place that matches the concept or with a proc that works generically |
23:21:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lxE |