00:18:01 | * | beholders_eye quit (Ping timeout: 240 seconds) |
00:54:01 | FromDiscord | <Dale> Andrew is really charismatic as well, hard not to like the guy |
00:55:35 | FromDiscord | <Dale> It's kinda weird to compare nim and zig though, they are polar opposites in many respects |
00:56:13 | FromDiscord | <Dale> Though I like them both a lot |
00:56:32 | FromDiscord | <Elegantbeef> They are both system languages, so they're not that opposite |
00:56:42 | FromDiscord | <Elegantbeef> One cares more about explicitly though |
00:57:13 | FromDiscord | <Dale> Well zig is all about no hidden control flow, nim goes the complete other way |
00:57:30 | FromDiscord | <Dale> Aesthetically they are very different |
00:57:56 | FromDiscord | <Dale> and in terms of feature uptake, they are pretty polarised also |
00:59:42 | FromDiscord | <Dale> Has anyone ever made a sizeable nim project without using any of the macro stuff? I was wondering how effective you can be without using them |
01:01:14 | * | koltrast_ joined #nim |
01:01:17 | FromDiscord | <Elegantbeef> https://github.com/treeform/pixie doesnt have any macros inside it's direct code |
01:01:20 | FromDiscord | <Elegantbeef> It's dependencies do have it |
01:01:35 | FromDiscord | <Elegantbeef> You obviously can write code like in Zig without macros all day long |
01:01:41 | * | koltrast quit (Ping timeout: 265 seconds) |
01:02:00 | FromDiscord | <Elegantbeef> Though `compTime` might require macros to be on parity with |
01:02:17 | FromDiscord | <Elegantbeef> I have an entire ECS that only uses 1 macro 😄 |
01:02:56 | FromDiscord | <Dale> Yeah, but nim does have some nice compile-time stuff anyways |
01:10:58 | FromDiscord | <Dale> Thanks for link to Pixie, I had seen it before (I mean, it's by treeform!) but I didn't know it had no macros |
01:14:36 | * | nanxiao joined #nim |
01:16:07 | FromDiscord | <Elegantbeef> It probably has templates and generics, but yea the there are no actual macros |
01:20:01 | * | genpaku quit (Remote host closed the connection) |
01:36:58 | FromDiscord | <Diogenes of Toronto> It has templates |
01:37:03 | FromDiscord | <Diogenes of Toronto> Just checked |
01:45:40 | FromDiscord | <Diogenes of Toronto> I feel like nim has long learning curve. It's not steep but I feel like there's just a lot to language. You don't need to use it all for it to be useful. |
01:56:24 | FromDiscord | <Elegantbeef> You call that a language, now this is a language |
01:57:36 | * | arkurious quit (Quit: Leaving) |
02:11:52 | FromDiscord | <PunchCake> I wonder why nim isnt used as much in mobile dev it has so much potential |
02:19:44 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rzx |
02:21:44 | FromDiscord | <Elegantbeef> It means an compiler error |
02:21:58 | FromDiscord | <Elegantbeef> If you want to see the actual error use a debug compiler as it says |
02:22:19 | FromDiscord | <Elegantbeef> but it looks like you're doing something that is causing the compiler to attempt to do `ord(SomeObject)` internally |
02:22:22 | FromDiscord | <Elegantbeef> Or there abouts |
02:22:48 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rzz |
02:23:26 | FromDiscord | <sOkam!> i imagine im doing something wrong with the type declaration |
02:23:44 | FromDiscord | <Elegantbeef> `N: static int` |
02:24:04 | FromDiscord | <Elegantbeef> No clue if you can alias using ranges like that |
02:24:11 | FromDiscord | <Elegantbeef> Might need to d o`Shape2D[range[3..255]]` |
02:24:29 | FromDiscord | <Elegantbeef> Likely the issue is that `3..255` is turned into a `Slice[int]` |
02:24:42 | FromDiscord | <sOkam!> range seems to solve it |
02:27:02 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rzA |
02:28:31 | FromDiscord | <Elegantbeef> You cannot alias this way |
02:28:39 | FromDiscord | <Elegantbeef> `N` is a type so it only accepts types |
02:28:40 | FromDiscord | <Elegantbeef> `2` is an integer |
02:29:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rzF |
02:29:44 | FromDiscord | <Elegantbeef> Now you can do `type Line = Shape2D(2)` and `type Line = Shape2D(range[3..255])` |
02:29:44 | FromDiscord | <Elegantbeef> Or even `Shape2D(bool)` |
02:30:31 | FromDiscord | <sOkam!> `array[bool?, ...]` ? how does that work? |
02:34:34 | * | xet7 quit (Quit: Leaving) |
02:37:40 | FromDiscord | <Elegantbeef> The same as `array[YouEnum, int]` |
02:37:50 | FromDiscord | <Elegantbeef> Nim supports ordinals in the first position of an array |
02:43:29 | FromDiscord | <sOkam!> ic |
02:47:49 | * | xet7 joined #nim |
02:48:39 | * | nanxiao quit (Quit: Client closed) |
03:36:35 | FromDiscord | <slime> 👀 |
03:37:15 | FromDiscord | <Elegantbeef> 👁️👁️ |
03:37:23 | FromDiscord | <slime> 🧐 |
03:44:04 | FromDiscord | <huantian> 😳 🥺 😏 |
03:52:48 | FromDiscord | <halc> sent a code paste, see https://play.nim-lang.org/#ix=4rzU |
03:53:33 | FromDiscord | <Elegantbeef> I mean concepts are typeclasses and not runtime interfaces |
03:53:55 | FromDiscord | <halc> what's that got to do with this? |
03:54:14 | FromDiscord | <halc> there's nothing dynamic going on here |
03:54:39 | FromDiscord | <Elegantbeef> Wait nevermind misread |
03:54:44 | FromDiscord | <Elegantbeef> Thought `container` was a concept |
03:55:04 | FromDiscord | <halc> it doesn't compile because the compiler can't figure out that the `x.draw()` call isn't a call to the generic `draw[T](cont: Container[T])` proc |
03:55:56 | FromDiscord | <halc> the concept isn't necessary btw, I just slapped it in there to illustrate why I'd want to write that kind of code |
03:56:07 | FromDiscord | <halc> but you can remove it and it still won't compile |
03:57:17 | FromDiscord | <halc> the workaround is to just choose a different name like `proc drawItems[T](cont: Container[T])` |
03:57:41 | FromDiscord | <halc> but that feels silly, I want name overloading to work lol |
03:57:47 | FromDiscord | <Elegantbeef> There you go `mixin` your concepts |
03:57:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rzW |
03:58:04 | FromDiscord | <halc> hm |
03:58:13 | FromDiscord | <halc> lemme see if that works with my real code |
03:58:17 | FromDiscord | <Elegantbeef> The solution is to use mixin |
03:58:32 | FromDiscord | <halc> I'll love you if it works |
03:58:54 | FromDiscord | <ElegantBeef> Matrix bridge is really being ap rick |
03:58:57 | FromDiscord | <Elegantbeef> I assume matrix bridge broke |
03:59:07 | FromDiscord | <Elegantbeef> Of course it should the compiler will now leave the symbol as open |
04:00:49 | FromDiscord | <Elegantbeef> You have `bind` and `mixin` the former forces that symbol to be closed, which means it uses the generic declaration, the other forces it open which means it uses the declaration and instantiation scope |
04:01:52 | * | fallback quit (Quit: IRCNow and Forever!) |
04:02:27 | FromDiscord | <halc> sent a code paste, see https://play.nim-lang.org/#ix=4rzZ |
04:02:27 | FromDiscord | <halc> I am very thankful |
04:05:00 | FromDiscord | <halc> I've used mixin before for templates, I still don't quite understand what it does tho lol |
04:05:48 | FromDiscord | <Elegantbeef> It works a bit different in templates |
04:05:53 | FromDiscord | <Elegantbeef> But i just described how it works for generics |
04:06:16 | FromDiscord | <Elegantbeef> by default the symbol is open if it's an overloaded symbol, and closed if it's not |
04:06:39 | FromDiscord | <Elegantbeef> so in your above case your `draw` was turned into a `nnkCloseSymChoice`, which means it only considered scope at procedure declaration |
04:15:22 | FromDiscord | <halc> so I guess the compiler decides it's a closed symbol because it's the same name as the proc's? |
04:15:36 | FromDiscord | <Elegantbeef> No cause there is no other overload |
04:16:13 | FromDiscord | <halc> ohhhhh |
04:16:17 | FromDiscord | <halc> I think I understand |
04:16:36 | FromDiscord | <halc> cause if I declare `TypeA` and `draw` first, it does compile |
04:16:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/3eF |
04:16:53 | FromDiscord | <Elegantbeef> our proc\ |
04:17:22 | FromDiscord | <Elegantbeef> if you add a `proc doThing(i: int) = discard` above the bleh declaration it'd then call yours |
04:17:27 | FromDiscord | <Elegantbeef> Cause it's an open symbol now |
04:18:10 | FromDiscord | <halc> ahh |
04:18:27 | FromDiscord | <halc> okay, okay, I think I actually get it, probably |
04:18:34 | FromDiscord | <Elegantbeef> You also can of course just explicitly state "i want this symbol open" with `mixin` 😄 |
04:19:53 | FromDiscord | <halc> so it isn't actually considered an overloaded symbol until I actually make it an overloaded symbol, makes sense |
04:27:39 | NimEventer | New thread by Naterlarsen: Screenshot works fine in own code but not over sockets., see https://forum.nim-lang.org/t/10032 |
04:57:13 | * | derpydoo quit (Quit: derpydoo) |
05:00:47 | FromDiscord | <Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rAb |
05:01:14 | FromDiscord | <Diogenes of Toronto> i guess this is a generic type? |
05:01:48 | FromDiscord | <ElegantBeef> This matrix bridge really pisses me off 😄 |
05:01:59 | FromDiscord | <Elegantbeef> Works fine |
05:02:00 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1088326761625944125/image.png |
05:02:00 | FromDiscord | <Elegantbeef> @huantian\: well thanks for accidently encouraging me to add negation querying https://github.com/beef331/nimtrest/blob/master/toys%20of%20toys/ecs.nim#L71-L80 |
05:02:06 | FromDiscord | <ElegantBeef> Yea `type Cmd[T] = object` and replace `type` with `T` |
05:02:28 | FromDiscord | <Diogenes of Toronto> thanks |
05:03:25 | FromDiscord | <ElegantBeef> But generics are not homogenous types so you may want to use an object variant |
05:03:52 | FromDiscord | <ElegantBeef> Assuming you have a limited number of possible values |
05:05:51 | FromDiscord | <Diogenes of Toronto> I am considering allowing enums and strings, bools, ints, and floats. |
05:14:14 | * | rmt joined #nim |
05:19:04 | * | nanxiao joined #nim |
05:30:49 | FromDiscord | <huantian> In reply to @Elegantbeef "<@300050030923087872>\: well thanks for": Haha np |
05:31:31 | FromDiscord | <Elegantbeef> I do wonder if any thing else needs to be added... the joys of making an ECS never have actually used one |
05:46:24 | * | derpydoo joined #nim |
05:49:56 | FromDiscord | <vmawz> sent a code paste, see https://play.nim-lang.org/#ix=4rAe |
05:50:20 | FromDiscord | <Elegantbeef> Not much to comment on |
05:50:28 | FromDiscord | <vmawz> took me about 10 tries lol |
05:50:51 | FromDiscord | <vmawz> kept getting errors about discard |
05:56:37 | * | advesperacit joined #nim |
06:15:14 | * | rockcavera quit (Remote host closed the connection) |
06:21:18 | FromDiscord | <Dudugz> If that token goes to a bot then it's not against the discord TOS, otherwise all the developers who made the APIs for the bots would be fined lol |
06:23:06 | * | nanxiao quit (Quit: Client closed) |
06:35:07 | FromDiscord | <Elegantbeef> "fined" |
06:35:07 | FromDiscord | <Elegantbeef> As if they do not just drop the hammer |
06:36:03 | * | nanxiao joined #nim |
06:39:24 | FromDiscord | <vmawz> In reply to @Dudugz "If that token goes": speaking of that, what's the best or most used nim discord wrapper |
06:41:29 | FromDiscord | <Elegantbeef> dimscord |
06:46:51 | * | azimut joined #nim |
06:56:18 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4rAt |
06:56:40 | FromDiscord | <huantian> That really needs to be better documented |
06:57:03 | FromDiscord | <Elegantbeef> cmon destructors do your thing please |
08:02:20 | FromDiscord | <ricafeal> sent a code paste, see https://play.nim-lang.org/#ix=4rAC |
08:02:38 | * | kenran joined #nim |
08:04:52 | FromDiscord | <{{N00nehere.username}}> if i'm working with a csv but the delimiter is not a comma, how can i change the default delimiter(in this case a ; ) |
08:05:40 | FromDiscord | <Elegantbeef> @ricafeal\: are you doing a release build in Nim? |
08:06:28 | FromDiscord | <Elegantbeef> Closely look at the `open` procedure from parsecsv |
08:09:07 | NimEventer | New question by DARSHAN KOIRALA: How to access elements of pointer array in Nim?, see https://stackoverflow.com/questions/75820514/how-to-access-elements-of-pointer-array-in-nim |
08:13:51 | FromDiscord | <ricafeal> sent a code paste, see https://play.nim-lang.org/#ix=4rAE |
08:14:57 | FromDiscord | <Elegantbeef> Take a look at zippy and see if it's any better |
08:15:08 | FromDiscord | <Elegantbeef> Or profile the Nim code |
08:20:15 | FromDiscord | <{{N00nehere.username}}> i just did a fresh install of nim and clang on windows but when compiling i get "string.h" file not found |
08:26:55 | * | nanxiao quit (Quit: Client closed) |
08:34:58 | FromDiscord | <ricafeal> sent a long message, see http://ix.io/4rAK |
08:35:23 | FromDiscord | <ricafeal> (edit) "http://ix.io/4rAK" => "http://ix.io/4rAL" |
08:36:27 | * | rmt quit (Ping timeout: 268 seconds) |
08:39:10 | * | nanxiao joined #nim |
08:39:16 | FromDiscord | <Elegantbeef> Well profile and PR somewhere 😄 |
08:40:30 | * | Notxor joined #nim |
08:54:58 | FromDiscord | <Dudugz> In that case wouldn't using the zip wrapper be better? |
08:55:17 | FromDiscord | <Dudugz> You just need to install zip on your machine and then you can use std/zip |
08:55:34 | FromDiscord | <Dudugz> I believe it has native support for file streaming |
08:55:46 | * | rmt joined #nim |
08:56:17 | FromDiscord | <Dudugz> I used zippy just because I'm dealing with zlib and I don't need something fancy. |
09:01:52 | FromDiscord | <Elegantbeef> Scroll up that was the start of their problem |
09:03:34 | FromDiscord | <Elegantbeef> Hence why i suggested profiling and making a PR to either Zippy or Zip depending on the work required |
09:04:39 | FromDiscord | <vmawz> how do you walk through folders, subfolders, files |
09:08:18 | FromDiscord | <ayex> @vmawz\: https://nim-lang.org/docs/os.html `walkdir` might interest you |
09:16:58 | * | nanxiao quit (Quit: Client closed) |
09:23:59 | * | nanxiao joined #nim |
10:01:16 | FromDiscord | <ricafeal> In reply to @Elegantbeef "Hence why i suggested": Thanks! |
10:09:45 | FromDiscord | <Kiloneie> Why did i have a mention/announcement icon for #main ? |
10:13:20 | * | kenran quit (Remote host closed the connection) |
10:13:39 | * | kenran joined #nim |
10:22:57 | * | nanxiao quit (Quit: Client closed) |
10:53:17 | * | nanxiao joined #nim |
11:05:36 | * | nanxiao quit (Quit: Client closed) |
11:23:34 | * | rmt quit (Ping timeout: 268 seconds) |
11:32:42 | * | Notxor quit (Remote host closed the connection) |
11:34:07 | * | Notxor joined #nim |
11:53:13 | FromDiscord | <System64 ~ Flandre Scarlet> sent a long message, see https://paste.rs/QSq |
11:56:39 | FromDiscord | <Andreas> In reply to @System64 "How to make an": maybe you want NAN-boxing ? this is used in many interpreters. |
11:57:17 | FromDiscord | <Andreas> (edit) "In reply to @System64 "How to make an": maybe you want NAN-boxing ? this is used in many interpreters. ... " added "So you end up with a Union-type that can carry anything." |
11:59:06 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Andreas "maybe you want NAN-boxing": What is NAN-Boxing? |
12:01:38 | FromDiscord | <Andreas> In reply to @System64 "What is NAN-Boxing?": https://leonardschuetz.ch/blog/nan-boxing/ explained here. It is found e.g. in the QuickJS-engine. |
12:06:03 | FromDiscord | <Andreas> In reply to @System64 "What is NAN-Boxing?": AFAIK in dynamic-land this concept is the best one can get. Compared to static-/ homogeneous-types they have some overhead in size and speed. |
12:07:19 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Andreas "AFAIK in dynamic-land this": Wait, types are bad in dynamic-land? |
12:09:54 | FromDiscord | <Andreas> In reply to @System64 "Wait, types are bad": ahh, no, but you pay a price for it. You get a unified type with a bit higher requirements in memory. Native-Nim-types will perform better and use less resources - but they are not dynamic.. |
12:13:14 | * | beholders_eye joined #nim |
12:14:27 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rBC |
12:17:58 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4rBE |
12:18:02 | FromDiscord | <sOkam!> --gc:none |
12:19:01 | FromDiscord | <demotomohiro> !eval let x: array[3, int] = [0, 1] |
12:19:06 | NimBot | Compile failed: /usercode/in.nim(1, 24) Error: type mismatch: got 'array[0..1, int]' for '[0, 1]' but expected 'array[0..2, int]' |
12:19:15 | * | nanxiao joined #nim |
12:20:11 | FromDiscord | <demotomohiro> !eval let x: array[3, int] = block: var ret: array[3, int]; ret[0] = 0; ret[1] = 1; ret |
12:20:15 | NimBot | Compile failed: /usercode/in.nim(1, 31) Error: nestable statement requires indentation |
12:21:08 | * | nanxiao quit (Client Quit) |
12:21:46 | FromDiscord | <sOkam!> @demotomohiro i can populate it with a for loop, ofc. but was wondering if I was missing something obvious in how to deal with arrays |
12:22:42 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Andreas "ahh, no, but you": And CPU too no? |
12:27:21 | FromDiscord | <Andreas> In reply to @System64 "And CPU too no?": sure, 'cos your types are bigger and you'll need to do typechecks all over your code - all the static-compiletime-guarantees are gone. Thats why dynamic-typed langs are typically a tad slower. Iterations on containers will be slower, e.g. because of typechecking. |
12:27:54 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Andreas "sure, 'cos your types": Ah alright, so why is it used in some languages? |
12:28:58 | FromDiscord | <Andreas> In reply to @System64 "Ah alright, so why": because for prototyping things having dynamic-types is great - look at Python/JS/Ruby et al.. |
12:30:14 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
12:35:41 | FromDiscord | <Andreas> In reply to @System64 "Oh alright": and everybd. want the-best-of-both-worlds. Python does it with fast-types via C-interop. NodeJS same way. And when i'm done with Nim+QuickJS you'll be able to use any Nim-Type - think of Arraymancer-Matrices - from Javascript.. |
12:37:17 | FromDiscord | <Andreas> (edit) "want" => "wants" |
12:43:31 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Andreas "and everybd. wants the-best-of-both-worlds.": This is interesting!↵Btw JS is... Weird... |
12:43:39 | * | derpydoo quit (Quit: derpydoo) |
12:44:45 | FromDiscord | <Andreas> In reply to @System64 "This is interesting! Btw": It's already there, thx to the `quickjs4nim`-project. I'm just adding some stuff to make the interop a bit easier.. |
12:45:12 | FromDiscord | <Andreas> (edit) "In reply to @System64 "This is interesting! Btw": It's already there, thx to the `quickjs4nim`-project. I'm just adding some stuff to make the interop a bit easier.. ... " added "And add some documentation 🙂" |
12:45:37 | FromDiscord | <System64 ~ Flandre Scarlet> is QuickJS fast? |
12:46:06 | FromDiscord | <Andreas> In reply to @System64 "This is interesting! Btw": i'd prefer Coffeescript - which than finally compiles to C-bytecode 🙂 |
12:46:15 | FromDiscord | <System64 ~ Flandre Scarlet> wait what?? |
12:49:13 | FromDiscord | <Andreas> In reply to @System64 "wait what??": QuickJS can trans-/compile Coffeescript -> ECMA-Javascript. and it can produce bytecode from that - so that you save the parsing-stage. And yes i assume it will be fast, fast enough. And when parts of the code are slow, well then there is nim to the rescue.. |
12:49:54 | FromDiscord | <System64 ~ Flandre Scarlet> Nim is very fast!↵Btw↵Would be cool to have Nim for the SEGA MegaDrive! |
12:50:09 | FromDiscord | <Andreas> (edit) "rescue.." => "rescue..↵This is true for all the languages that compile to JS - e.g. Civet, Nimba whatever" |
12:53:07 | FromDiscord | <System64 ~ Flandre Scarlet> Pretty sure its possible with the C interop |
12:56:05 | FromDiscord | <0ffh> In reply to @System64 "Nim is very fast!": Nim is very well suited for embedded systems, you can practially use it for ever platform you've got a C compiler for, as long as it's not absolutely tiny with next to no memory. |
12:56:43 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @0ffh "Nim is very well": the MegaDrive has 64kb of RAM |
12:57:27 | FromDiscord | <0ffh> In reply to @System64 "the MegaDrive has 64kb": I think that should work.↵Maybe ask in the #embedded channel. |
12:58:08 | FromDiscord | <0ffh> But 64k should be more than enough, I think. |
12:58:27 | FromDiscord | <Andreas> In reply to @System64 "the MegaDrive has 64kb": hm, quickJS needs 221-Kb at least, prbly. not gonna work there.. |
12:59:01 | FromDiscord | <Andreas> (edit) "In reply to @System64 "the MegaDrive has 64kb": hm, quickJS needs 221-Kb at least, prbly. not gonna work there.. ... " added "Maybe MRuby fits into 64Kb ?" |
13:01:52 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Andreas "hm, quickJS needs 221-Kb": I was talking about Nim |
13:05:41 | FromDiscord | <Andreas> In reply to @System64 "I was talking about": idk, maybe if one rips the parser-code from quickjs, than a bytecode-runner might fit into 64-Kb... embedded is not my priority. |
13:07:12 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Andreas "idk, maybe if one": Oh wait, 2 conversations are overlapping, woops↵I'm sorry, I confused you with 0ffh |
13:20:04 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @0ffh "I think that should": but wouldn't the GC take a lot of CPU? |
13:26:15 | FromDiscord | <0ffh> In reply to @System64 "but wouldn't the GC": Nah, not too much.↵Also, ARC and ORC are not GC in the same sense as e.g. the JVM's. |
13:27:50 | FromDiscord | <0ffh> They're reference counters, in the case of ORC with a cycle collector on top. So you'll only need ORC if you actually use data structures with cyclical references. |
13:31:17 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright↵When someone says "GC", I'm thinking to the JVM's one↵But isn't the JVM's one more powerful? |
13:31:33 | FromDiscord | <0ffh> In reply to @System64 "Oh alright When someone": Nope. |
13:33:21 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright↵I wonder how Nim would perform on a MegaDrive, but for that, it needs SGDK bindings for Nim and it will be an hard time |
13:34:12 | FromDiscord | <0ffh> The only difference I can think of is that Java can move objects, IIRC. If so, it could compact memory. But not all GCs of that kind do that. |
13:34:55 | FromDiscord | <0ffh> In reply to @System64 "Oh alright I wonder": Yeah bindings are a pain, but I think Nim has some tooling for that, though I haven't used it myself yet. |
13:35:22 | FromDiscord | <0ffh> You'd probably need to invest some work in that. |
13:39:10 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @0ffh "Yeah bindings are a": It's easy with Futhark, but I doubt Futhark will do a good job for that kind of bindings |
13:44:27 | * | beholders_eye quit (Ping timeout: 256 seconds) |
13:53:47 | * | nanxiao joined #nim |
13:59:07 | * | nanxiao quit (Quit: Client closed) |
14:15:01 | * | rockcavera joined #nim |
14:16:14 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4rBY |
14:30:27 | FromDiscord | <etra> In reply to @etra "this work without the": huh, apparently still initializes triangles? |
14:33:39 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rC4 |
14:33:53 | FromDiscord | <etra> OOH right |
14:33:59 | FromDiscord | <etra> static arrays are initialized with 0 in C |
14:34:02 | FromDiscord | <etra> I forgot about that |
14:34:13 | FromDiscord | <Yardanico> i mean specifically in Nim all value types are always zero-initialized |
14:34:17 | FromDiscord | <Yardanico> `{.noinit.}` prevents that |
14:34:26 | FromDiscord | <etra> yes, I put noinit but still got 0s |
14:34:33 | FromDiscord | <etra> but in C static arrays are initialized at 0 |
14:34:36 | FromDiscord | <Yardanico> In reply to @etra "yes, I put noinit": you just got lucky, you could get random data as well |
14:34:37 | FromDiscord | <etra> so it makes sense now |
14:34:41 | FromDiscord | <Yardanico> it depends on the compiler settings and stuff |
14:35:33 | FromDiscord | <etra> I guess, but since now is only _(officially C)_ the C spec requires static arrays to be 0 |
14:35:49 | FromDiscord | <etra> (edit) "_(officially C)_" => "_(officially)_ C" |
14:36:08 | FromDiscord | <Yardanico> but they're not static since they're runtime-initialized |
14:36:14 | FromDiscord | <Yardanico> I'm not good in C but aren't static arrays basically constant ones? |
14:36:42 | FromDiscord | <Yardanico> In Nim `let` means that the variable is initialized at runtime and its value can't be changed |
14:36:55 | FromDiscord | <Yardanico> ah, static as in allocated on the stack |
14:37:39 | FromDiscord | <etra> oh, since it was on main scope, it was static, I moved into a proc and now it's filled with garbage, as I hoped for! |
14:37:44 | FromDiscord | <etra> because that one is stack allocated |
14:38:59 | * | kenran quit (Remote host closed the connection) |
14:40:13 | FromDiscord | <etra> so my point of using `{.noinit.}` was to avoid unnecessary initializations and it was actually doing that, static arrays are initialized at compile time and so it was full of 0s, and if you do the same on a function it gets stack allocated which is full of garbage |
15:03:30 | FromDiscord | <lightninja> Hi all, any one have idea for what could be that `\x59\x6a\x49\x34\x4f\x44\x67\x77\x59\x6a\x67\x32\x4d\x6a\x52\x6b\x59\x54\x63\x32\x5a\x6d\x45\x35\x59\x54\x49\x32\x5a\x44\x51\x7a\x59\x7a\x4d\x34\x4d\x54` |
15:07:54 | FromDiscord | <0ffh> hex numbers |
15:08:38 | FromDiscord | <0ffh> looks like 2-digit hex numbers with a \x prefix per byte |
15:09:01 | FromDiscord | <lightninja> thanks |
15:09:09 | FromDiscord | <lightninja> _lightninja sends fireworks 🎆_ |
15:09:15 | FromDiscord | <0ffh> welcome |
15:13:30 | * | Notxor quit (Remote host closed the connection) |
15:15:04 | * | Notxor joined #nim |
15:31:05 | * | derpydoo joined #nim |
15:39:48 | FromDiscord | <Piqueiras> If I have to save a tridiagonal matrix (so only main diagonal and surrounding elements have to be stored) what would be best, an object with "size" parameter and 3 seqs, or try and do an object with a generic N and 3 static arrays of sizes N-1, N and N-1 |
15:39:56 | FromDiscord | <caravaggio> sorry if this is the wrong spot, other than semantics and syntax. what would u say differentiates nim from zig? |
15:41:33 | FromDiscord | <Piqueiras> In reply to @caravaggio "sorry if this is": idk maybe garbage collector |
15:41:53 | FromDiscord | <caravaggio> In reply to @Piqueiras "idk maybe garbage collector": i thought soo too, but u can turn it off in nim |
15:41:54 | FromDiscord | <caravaggio> right? |
15:42:02 | FromDiscord | <Piqueiras> yea |
15:42:24 | FromDiscord | <Piqueiras> like I havent even gotten into it but yea I think you can add your own |
15:44:55 | FromDiscord | <eyes> https://media.discordapp.net/attachments/371759389889003532/1088488554331656325/image.png |
15:44:59 | FromDiscord | <eyes> i am perplexed atm |
15:45:45 | FromDiscord | <eyes> in this image you can see the type definition for Options, ``bynmonthday`` is clearly ``Option[seq[number]]`` |
15:45:50 | FromDiscord | <Nerve> In reply to @caravaggio "sorry if this is": Nim forces memory considerations to the back and makes all other efforts to make business logic come to the forefront and make it pragmatically easy to write fast programs. It's a practical language without a hyper-focus on memory semantics like all the other systems languages. Its focus is on building feature-filled software. |
15:46:32 | * | kenran joined #nim |
15:46:34 | FromDiscord | <Nerve> If you want pointers, they're there. Otherwise, the RC and GC strategies are more than enough. |
15:48:40 | * | Notxor quit (Remote host closed the connection) |
15:48:58 | FromDiscord | <Nerve> sent a long message, see http://ix.io/4rCm |
15:49:08 | FromDiscord | <PunchCake> Does nim support async await or does it have another form of async? |
15:49:17 | FromDiscord | <caravaggio> In reply to @PunchCake "Does nim support async": yeah it does |
15:49:22 | FromDiscord | <PunchCake> Ok |
15:49:39 | FromDiscord | <caravaggio> In reply to @Nerve "The Rust and Zig": hmmm i always assumed memory safety = holding back on speed |
15:50:22 | * | Notxor joined #nim |
15:50:39 | FromDiscord | <eyes> not with rust |
15:50:49 | FromDiscord | <eyes> memory saftey = its hard to write in that language lol |
15:50:54 | FromDiscord | <eyes> (edit) "hard" => "harder" |
15:51:07 | FromDiscord | <PunchCake> Tbh nim gets its garbage collection right |
15:51:24 | FromDiscord | <caravaggio> safe rust still has some bottle necks |
15:51:34 | FromDiscord | <PunchCake> Unless your doing either embedded or os kernal dev you dont need manual memory management |
15:51:36 | FromDiscord | <Nerve> Yes, when we're talking about things like checking array bounds you will always pay a ~20% penalty over raw C code that doesn't check that stuff. But in the vast majority of cases, the benefits of not having to do any memory semantics in Nim vastly outweight the maybe 1.5x slowdown over the equivalent Rust code |
15:51:44 | FromDiscord | <spoon> it might just be me being bad at rust but its forced me to copy memory before for "safety" |
15:51:52 | FromDiscord | <Nerve> In reply to @caravaggio "hmmm i always assumed": Yes, when we're talking about things like checking array bounds you will always pay a ~20% penalty over raw C code that doesn't check that stuff. But in the vast majority of cases, the benefits of not having to do any memory semantics in Nim vastly outweight the maybe 1.5x slowdown over the equivalent Rust code |
15:52:11 | FromDiscord | <Nerve> We're not talking a 10-100x slowdown like Python |
15:52:17 | FromDiscord | <PunchCake> Bro i dont think its 1.5x slow down |
15:52:38 | FromDiscord | <PunchCake> Its probably like 0.9s |
15:52:46 | FromDiscord | <PunchCake> (edit) "0.9s" => "0.9x" |
15:52:50 | FromDiscord | <Nerve> Yeah in some cases Nim is faster |
15:52:58 | FromDiscord | <Nerve> MAX 1.5x |
15:53:01 | FromDiscord | <spoon> arent array bound checks performed at compiletime? |
15:53:07 | FromDiscord | <PunchCake> And its not even relevant now days as long as your not 30x slower than rust |
15:53:08 | FromDiscord | <spoon> well some |
15:53:24 | FromDiscord | <PunchCake> Since computers nowdays can go 1000x faster than computer back in the day |
15:53:43 | FromDiscord | <caravaggio> how does nim ffi compare to others? if i ffi to c , i get the best of both worlds? seen alot of ppl talk about various overheads online |
15:53:59 | FromDiscord | <Nerve> In reply to @caravaggio "how does nim ffi": 0 overhead and SUPER easy, you literally just write a function signature |
15:54:03 | FromDiscord | <Nerve> Hooking into C is trivial |
15:54:04 | FromDiscord | <spoon> nim has two-way FFI, most other languages dont |
15:54:17 | FromDiscord | <caravaggio> In reply to @Nerve "0 overhead and SUPER": okay i see thanks |
15:54:23 | FromDiscord | <caravaggio> In reply to @spoon "nim has two-way FFI,": u mean c and js? |
15:54:23 | FromDiscord | <PunchCake> Nim ffi is one of the fastest |
15:54:46 | FromDiscord | <spoon> In reply to @caravaggio "u mean c and": i mean that since it compiles directly to c, you can use nim code in a c program |
15:55:01 | FromDiscord | <PunchCake> And why does nim lack so many mobile gui libs? |
15:55:05 | FromDiscord | <Nerve> In reply to @caravaggio "okay i see thanks": Actually there is overhead for mismatching types, for example Nim strings and seqs have structures to help the memory semantics, sometimes they need to be copied when turning them into `cstring` or raw pointers |
15:55:12 | FromDiscord | <PunchCake> And is flutter bindings possible for nim? |
15:55:30 | FromDiscord | <Nerve> But that copying is automatic |
15:55:38 | FromDiscord | <spoon> is flutter dart? |
15:55:50 | FromDiscord | <caravaggio> yeah |
15:56:04 | FromDiscord | <Nerve> `string` and `cstring` conversion is just a method call, and getting a pointer to a `seq` is easy |
15:56:08 | FromDiscord | <PunchCake> In reply to @spoon "arent array bound checks": That wouldn't make much sense if you have a vector for example |
15:56:16 | FromDiscord | <caravaggio> In reply to @Nerve "Actually there is overhead": yeah but cstring is defualt to nim, right? |
15:56:19 | FromDiscord | <PunchCake> But a regular array would yeah |
15:56:58 | FromDiscord | <Nerve> In reply to @caravaggio "yeah but cstring is": `cstring` stands for "comatible string", it's the FFI type you use to interface with C/C++/Obj-C/JS |
15:57:03 | FromDiscord | <Nerve> (edit) ""comatible" => ""compatible" |
15:57:12 | FromDiscord | <Nerve> it doesn't literally mean a C-string |
15:57:28 | FromDiscord | <PunchCake> In reply to @spoon "is flutter dart?": Yes |
15:57:39 | FromDiscord | <caravaggio> In reply to @Nerve "it doesn't literally mean": oh makes sense |
15:57:55 | FromDiscord | <caravaggio> ill try ffi with js later tonight |
15:58:00 | FromDiscord | <caravaggio> want to see what i can do |
15:59:01 | FromDiscord | <Nerve> I should point out: If you ever interface with C, there is a `csize_t` type. Use it where C uses `size_t`. If you try to pick an unsigned int type and use that you WILL be sorry |
15:59:09 | FromDiscord | <spoon> In reply to @PunchCake "Yes": in that case i dont know, dart has its own gc and everything |
15:59:22 | FromDiscord | <PunchCake> Yeah |
15:59:31 | FromDiscord | <PunchCake> Why would its gc be an issue? |
16:03:09 | FromDiscord | <Gumbercules> In reply to @Nerve "I should point out:": You can just use int |
16:03:22 | FromDiscord | <Gumbercules> Int32 for cint |
16:03:59 | FromDiscord | <PunchCake> Oh wait |
16:04:00 | FromDiscord | <Yardanico> In reply to @Gumbercules "You can just use": `csize_t` exists specifically so that you can use `size_t` in Nim |
16:04:09 | FromDiscord | <Gumbercules> Int is the same |
16:04:20 | FromDiscord | <PunchCake> Do you guys think tauri bindings for nim would work? |
16:04:22 | FromDiscord | <Gumbercules> Is my point - you can just use int either way |
16:04:34 | FromDiscord | <Yardanico> In reply to @Gumbercules "Is my point -": it will probably work for most platforms, but better be safe anyway |
16:04:40 | FromDiscord | <Yardanico> why not just write the correct C function signature |
16:04:42 | FromDiscord | <Gumbercules> It's literally the same thing |
16:04:46 | FromDiscord | <Gumbercules> I do it all the time |
16:04:56 | FromDiscord | <Nerve> In reply to @Gumbercules "Is my point -": That is NOT a good idea |
16:05:01 | FromDiscord | <Yardanico> In reply to @Gumbercules "It's literally the same": it's not |
16:05:04 | FromDiscord | <Gumbercules> Why use a whole separate set of aliases when you can just use the built-in types? |
16:05:18 | FromDiscord | <Nerve> Different platforms alias `size_t` differently |
16:05:23 | FromDiscord | <Gumbercules> No |
16:05:24 | FromDiscord | <Yardanico> size_t is implementation defined technically, ofc it will work with "just" int or uint on popular platforms |
16:05:31 | FromDiscord | <Yardanico> https://en.cppreference.com/w/c/types/size_t |
16:05:36 | FromDiscord | <Gumbercules> It's 64 bits on 64 but machine |
16:05:40 | FromDiscord | <Yardanico> no? |
16:05:41 | FromDiscord | <Gumbercules> It's 32 on 31 |
16:05:44 | FromDiscord | <Gumbercules> 32 |
16:05:45 | FromDiscord | <Nerve> You don't know what you're talking about |
16:05:56 | FromDiscord | <Gumbercules> Yes I have no idea |
16:06:25 | FromDiscord | <Gumbercules> Even though Ive probably written more C and C++ interop code than anyone else herw |
16:06:30 | FromDiscord | <Gumbercules> (edit) "herw" => "here" |
16:06:30 | * | Notxor quit (Remote host closed the connection) |
16:06:52 | FromDiscord | <Yardanico> writing a lot of code doesn't mean you wouldn't make wrong assumptions |
16:06:52 | FromDiscord | <Rika> But that does not mean you are correct |
16:07:01 | FromDiscord | <Yardanico> size_t is clearly implementation-defined per the standard itself |
16:07:01 | FromDiscord | <Gumbercules> It's not an assumption |
16:07:06 | FromDiscord | <Gumbercules> Right |
16:07:13 | FromDiscord | <spoon> In reply to @PunchCake "Do you guys think": i know there are alternatives (neel and nimview) that use the native OS web renderer |
16:07:15 | FromDiscord | <Yardanico> again, it will work on popular platforms the way you want it to, but that doesn't make it _correct_ |
16:07:41 | FromDiscord | <Nerve> https://www.enseignement.polytechnique.fr/informatique/INF478/docs/Cpp/en/c/types/size_t.html |
16:07:59 | FromDiscord | <Nerve> It's implementation defined. There are scenarios where it might not be 64-bit on 64-bit platforms and assuming so is a mistake |
16:08:01 | FromDiscord | <Nerve> One I have made |
16:08:15 | FromDiscord | <PunchCake> In reply to @spoon "i know there are": Hm alright |
16:08:18 | FromDiscord | <Gumbercules> https://nim-lang.org/docs/system.html#csize_t |
16:08:30 | FromDiscord | <Gumbercules> Even though it's just an alias |
16:08:32 | FromDiscord | <Yardanico> In reply to @Gumbercules "https://nim-lang.org/docs/system.html#csize_t": yes, this literally uses importc |
16:08:34 | FromDiscord | <Yardanico> In reply to @Gumbercules "Even though it's just": it's not |
16:08:48 | FromDiscord | <Yardanico> `uint` is just for Nim to think it's uint, while it might actually be not it |
16:08:55 | FromDiscord | <Yardanico> otherwise there wouldn't be `importc` there |
16:09:00 | FromDiscord | <Gumbercules> What might else it be? |
16:09:16 | FromDiscord | <Yardanico> literally anything? |
16:09:21 | FromDiscord | <Nerve> In reply to @Gumbercules "What might else it": This entirely depends on the `types.h` at the root of the platform's C standard lib |
16:09:23 | FromDiscord | <Gumbercules> If it's not going to be. 32 or 64 but unsigned integer |
16:09:27 | FromDiscord | <Yardanico> the standard doesn't guarantee what size or type csize_t will be |
16:09:36 | FromDiscord | <Yardanico> it can be a struct even, the point is to abstract the actual size away |
16:09:48 | FromDiscord | <Gumbercules> This is ridiculous |
16:09:53 | FromDiscord | <Nerve> Yes, it is |
16:09:57 | FromDiscord | <Gumbercules> The Nim code then would break |
16:10:00 | FromDiscord | <Yardanico> yes, arguing about something that's clearly written in the standard is ridiculous |
16:11:21 | FromDiscord | <Gumbercules> All one has to do is look at how it's defined in whatever they are wrapping |
16:11:33 | FromDiscord | <Gumbercules> And mirror that in their Nim code |
16:11:39 | FromDiscord | <Gumbercules> Then there is no ambiguity |
16:12:08 | FromDiscord | <Nerve> `csize_t` also leaves no ambiguity |
16:12:22 | FromDiscord | <Nerve> AND you don't have to look at the platform implementation |
16:12:23 | FromDiscord | <Gumbercules> Uhhhhhh |
16:12:39 | FromDiscord | <Gumbercules> It certainly does, but whatever |
16:13:16 | FromDiscord | <Nerve> The goal is for interfacing Nim code to past the proper bit width to C `size_t` parameters. `csize_t` does that. |
16:13:24 | FromDiscord | <Nerve> (edit) "past" => "pass" |
16:14:05 | FromDiscord | <Gumbercules> I get that and you can do exactly the same thing without using csize_t and using the actual types |
16:14:38 | FromDiscord | <Nerve> And you can get the wrong. It depends on your implementation and stdlib. |
16:14:53 | FromDiscord | <Nerve> We've argued this ad naesuem so let's call it a difference it philosophy |
16:14:58 | FromDiscord | <Nerve> (edit) "naesuem" => "nausuem" |
16:15:01 | FromDiscord | <Gumbercules> My point ia |
16:15:06 | FromDiscord | <Nerve> (edit) "nausuem" => "nauseum" |
16:15:13 | FromDiscord | <Nerve> (edit) "it" => "in" |
16:15:33 | FromDiscord | <Gumbercules> I'd rather not have a ton of c_blah declarations in my code |
16:16:11 | FromDiscord | <Gumbercules> And it's quite simple to map these to Nim types if you know C which you should anyway if you're interoping with C |
16:16:45 | FromDiscord | <Gumbercules> Now anyone reading my code doesn't have to ask themselves wtf a cint or csize_t is |
16:16:48 | FromDiscord | <Nerve> ? If you only need it when defining the foreign function signature and when interfacing with that function, you only need those types in two places. You handle the conversion at the interface point |
16:17:32 | FromDiscord | <Gumbercules> Well there is no conversion usually only in the case of c_string |
16:17:41 | FromDiscord | <Gumbercules> (edit) "c_string" => "cstring" |
16:18:12 | FromDiscord | <Gumbercules> That's the only ctype that has to be used |
16:19:58 | FromDiscord | <Nerve> This is not advice you should be giving new Nim programmers. They should be converting all inputs to C functions to the compatible types, full stop. If they do what you say they'll start segfaulting everywhere as soon as they hit `-d:release` because they don't know how directly Nim types map to C types. |
16:20:27 | FromDiscord | <Gumbercules> New Nim programmers shouldn't be interoping with C |
16:20:49 | FromDiscord | <Nerve> So when should they? |
16:21:18 | FromDiscord | <Gumbercules> When they know the language and C |
16:21:36 | FromDiscord | <Gumbercules> They're going to segfault everywhere anyway if they don't |
16:21:41 | FromDiscord | <Nerve> What's your standard there? What is "know the language"? |
16:21:47 | FromDiscord | <PunchCake> In reply to @Gumbercules "They're going to segfault": xD |
16:22:06 | FromDiscord | <cloud> :nimGlow: |
16:22:07 | FromDiscord | <PunchCake> You know when i was a noob i intentionally tried to segfault C but didnt know how |
16:22:09 | FromDiscord | <PunchCake> Its ok |
16:22:15 | FromDiscord | <spoon> libraries frequently use c interop though, and leave the cint binding |
16:22:15 | FromDiscord | <cloud> Nim jumpscare |
16:22:19 | FromDiscord | <PunchCake> Just do int ptr = 0 |
16:22:31 | FromDiscord | <PunchCake> 100x speed boost in C |
16:22:33 | FromDiscord | <spoon> In reply to @cloud "Nim jumpscare": got me |
16:22:36 | FromDiscord | <Gumbercules> In reply to @spoon "libraries frequently use c": Sure and new Nim users ask all the time wtf is a cint |
16:23:00 | FromDiscord | <Gumbercules> Not many ask what an int32 is |
16:23:03 | FromDiscord | <PunchCake> Yeah what is that |
16:23:06 | FromDiscord | <PunchCake> Wtf is cint |
16:23:11 | FromDiscord | <spoon> easy then you say RTFM |
16:23:13 | FromDiscord | <Gumbercules> It's an int32 |
16:23:17 | FromDiscord | <spoon> :-) |
16:23:21 | FromDiscord | <PunchCake> Then why not use int |
16:23:21 | FromDiscord | <Nerve> In reply to @Gumbercules "Sure and new Nim": wtf is a long uint |
16:23:25 | FromDiscord | <PunchCake> And call it a day |
16:23:27 | FromDiscord | <Nerve> (edit) "long uint" => "`long uint`" |
16:23:38 | FromDiscord | <Gumbercules> Uint64 |
16:23:49 | FromDiscord | <Nerve> Nope, that depends on the PLATFORM |
16:23:54 | FromDiscord | <Nerve> `long uint` can be 32-bit |
16:24:13 | FromDiscord | <spoon> if you're interfacing with microcontrollers i imagine that's important |
16:24:23 | FromDiscord | <etra> iirc the only requirement of int/uint is it's at least 16 bit |
16:24:32 | FromDiscord | <Gumbercules> I don't use 32 bit machines but if I did I'd care |
16:24:42 | FromDiscord | <Nerve> I thought you said you know what you're talking about |
16:24:47 | FromDiscord | <PunchCake> xD |
16:24:50 | FromDiscord | <Gumbercules> And so would the person targeting them |
16:25:05 | FromDiscord | <spoon> cint is just for c compatibility since it'd handle the allocation the same as the c compiler |
16:25:10 | FromDiscord | <Gumbercules> Someone is grasping at straws here to try to make a point |
16:25:12 | FromDiscord | <spoon> or whatever platform |
16:25:17 | FromDiscord | <PunchCake> Tbh if your using a 32 bit machine in 2023 its your problem bro |
16:25:20 | FromDiscord | <Nerve> In reply to @Gumbercules "Someone is grasping at": You? |
16:25:22 | FromDiscord | <Gumbercules> No |
16:25:32 | FromDiscord | <PunchCake> As a dev im not supporting decade old hardware |
16:25:35 | FromDiscord | <Gumbercules> I've already explained my point multiple times |
16:25:48 | FromDiscord | <etra> In reply to @PunchCake "Tbh if your using": not all embedded devices are 64 bit though? |
16:25:49 | FromDiscord | <Gumbercules> It's better to know explicitly what types you're dealing wirh |
16:26:07 | FromDiscord | <PunchCake> In reply to @etra "not all embedded devices": Embedded is a whooole different story bro |
16:26:21 | FromDiscord | <Gumbercules> Rather than rely on some type that changes width depending on the platform |
16:26:25 | FromDiscord | <Nerve> In reply to @PunchCake "Tbh if your using": I work at a company that targets 16-bit microcontrollers, this stuff is still very relevant and platform-specific behavior of C types has to be studied here |
16:26:28 | FromDiscord | <PunchCake> Most embedded devices have 230kb of ram or somewhere around that @etra |
16:26:40 | FromDiscord | <PunchCake> So you can throw the gc out the window |
16:26:42 | FromDiscord | <Gumbercules> And if I worked at that |
16:26:47 | FromDiscord | <Rika> you'd care |
16:26:50 | FromDiscord | <Gumbercules> I'd worry about that as well |
16:26:51 | FromDiscord | <Rika> but you dont so you dont |
16:26:55 | FromDiscord | <Gumbercules> Right |
16:27:02 | FromDiscord | <PunchCake> In reply to @Nerve "I work at a": I am talking about consumer pc |
16:27:06 | FromDiscord | <Gumbercules> No one that does is not going to understand these things |
16:27:07 | FromDiscord | <PunchCake> Not this embedded bollocks |
16:27:19 | FromDiscord | <PunchCake> Embedded i would use C |
16:27:22 | FromDiscord | <PunchCake> Not nim |
16:27:25 | FromDiscord | <Rika> but that doesnt mean that what you do is correct for what everyone else does, its just that you're informed that what you're doing is correct for what you do |
16:27:32 | FromDiscord | <Gumbercules> Nor are they going to be writing correct code that does this kind of interop |
16:27:40 | FromDiscord | <spoon> reminds me i still need to try ratel on my esp32 |
16:27:45 | FromDiscord | <Rika> and those who are not informed (beginners) would follow you without knowing why its fine |
16:27:50 | FromDiscord | <Gumbercules> I get that Rika |
16:28:07 | FromDiscord | <Gumbercules> My advice is - use the correct Nim type not the C type |
16:28:12 | FromDiscord | <Rika> for |
16:28:15 | FromDiscord | <Gumbercules> It's clearer code |
16:28:19 | FromDiscord | <PunchCake> (If you dont want C interop) |
16:28:20 | FromDiscord | <0ffh> In reply to @PunchCake "Not nim": Meh, Nim is so much nicer than C, I'd use it wherever possible. |
16:28:35 | FromDiscord | <PunchCake> In reply to @0ffh "Meh, Nim is so": Ok the gc is a huge problem in embedded |
16:28:42 | FromDiscord | <spoon> cint etc is only for compatibility with c ffi, it shouldn't really be used otherwise |
16:28:43 | FromDiscord | <Gumbercules> I wasn't saying or advocating for usage of the incorrect type |
16:28:44 | FromDiscord | <0ffh> In reply to @PunchCake "Ok the gc is": Not ARC. |
16:28:50 | FromDiscord | <PunchCake> Even arc |
16:28:57 | FromDiscord | <Gumbercules> I'm also typing this all on a phone which is incredibly annoying |
16:28:59 | FromDiscord | <Nerve> In reply to @PunchCake "Ok the gc is": RC is not, it's deterministic |
16:29:04 | FromDiscord | <0ffh> In reply to @PunchCake "Even arc": Elaborate |
16:29:05 | FromDiscord | <PunchCake> Anything with any ref counting is a problem |
16:29:06 | FromDiscord | <Rika> In reply to @PunchCake "Even arc": have you hit this problem? |
16:29:18 | FromDiscord | <Nerve> Also if you stack allocate everything and turn off any AMM then you're fine for embedded |
16:29:22 | FromDiscord | <PunchCake> You need more memory to store the ref counts and keep track of stuff |
16:29:38 | FromDiscord | <Gumbercules> Unless cycles |
16:29:39 | FromDiscord | <Rika> In reply to @PunchCake "You need more memory": has it practically affected you? |
16:29:43 | FromDiscord | <Gumbercules> Then not so much |
16:29:55 | FromDiscord | <PunchCake> Bro any gc is a huge problem in embedded |
16:29:59 | FromDiscord | <spoon> arc is just the equivalent of inserting mallocs and frees |
16:30:13 | FromDiscord | <Piqueiras> uhmm quick question how to make all of them take same space? https://media.discordapp.net/attachments/371759389889003532/1088499953430712430/image.png |
16:30:13 | FromDiscord | <PunchCake> There is a reason why nobody uses exceptions or gcs in embedded |
16:30:15 | FromDiscord | <Nerve> Sorry, not just stack allocate, you might make a heap arena |
16:30:21 | FromDiscord | <Gumbercules> Is RAII GC? |
16:30:31 | FromDiscord | <Gumbercules> That's the real question |
16:30:35 | FromDiscord | <PunchCake> No |
16:30:42 | FromDiscord | <Gumbercules> Some would disagree |
16:30:44 | FromDiscord | <0ffh> In reply to @PunchCake "You need more memory": Even in embedded, most systems aren't like 4k RAM anymore. I've done embedded programming for a living. In the worst case, you can live in Nim without even Arc. |
16:30:45 | FromDiscord | <PunchCake> Nope |
16:30:47 | FromDiscord | <PunchCake> It isnt |
16:31:06 | FromDiscord | <PunchCake> In reply to @0ffh "Even in embedded, most": 200 kb of ram sounds like enough |
16:31:13 | FromDiscord | <PunchCake> But not enough to run a gc |
16:31:22 | FromDiscord | <Gumbercules> In reply to @PunchCake "It isnt": Why not? |
16:31:23 | FromDiscord | <spoon> even if arc affected you, you can just turn the gc off |
16:31:28 | FromDiscord | <spoon> or view the expandarc |
16:31:30 | FromDiscord | <etra> In reply to @Nerve "Also if you stack": AMM? |
16:31:33 | FromDiscord | <PunchCake> In reply to @Gumbercules "Why not?": I dont think you understand |
16:31:45 | FromDiscord | <PunchCake> With raii there is no gc scanning the program |
16:32:10 | FromDiscord | <Gumbercules> So? |
16:32:12 | FromDiscord | <PunchCake> Gc scanning takes memory |
16:32:15 | FromDiscord | <Gumbercules> RC is GC no? |
16:32:22 | FromDiscord | <PunchCake> BRO WTF IS RC |
16:32:27 | FromDiscord | <Gumbercules> Reference counting |
16:32:28 | FromDiscord | <Rika> reference counting? |
16:32:36 | FromDiscord | <PunchCake> In C? |
16:32:42 | FromDiscord | <PunchCake> Or cpp backend |
16:32:42 | FromDiscord | <Rika> dude i'm not so sure you know what the heck you're talking about anymore |
16:32:47 | FromDiscord | <Gumbercules> In any language |
16:33:16 | FromDiscord | <PunchCake> In cpp wouldnt work for embedded so im guessing C |
16:33:17 | FromDiscord | <Nerve> In reply to @etra "AMM?": Automatic memory management |
16:33:18 | FromDiscord | <PunchCake> Right? |
16:33:26 | FromDiscord | <Rika> what |
16:33:32 | FromDiscord | <PunchCake> Wdym what |
16:33:37 | FromDiscord | <PunchCake> Cpp sucks balls for embedded |
16:33:40 | FromDiscord | <PunchCake> Big balls |
16:33:56 | FromDiscord | <spoon> you know nim arc isn't an overheaded GC but a compiletime check, right? |
16:34:02 | FromDiscord | <PunchCake> No |
16:34:04 | FromDiscord | <PunchCake> I did not |
16:34:17 | FromDiscord | <PunchCake> Ok that changes a lot of what i was thinking |
16:34:45 | FromDiscord | <Gumbercules> wtf is going on here today |
16:34:48 | FromDiscord | <Gumbercules> ref counting is GC |
16:35:02 | FromDiscord | <PunchCake> I thought all nim gc was overhead gcs |
16:35:08 | FromDiscord | <Gumbercules> ref counting has overhead |
16:35:10 | FromDiscord | <Gumbercules> all GC has overhead |
16:35:20 | FromDiscord | <PunchCake> Then no gc works for embedded brooo |
16:35:26 | FromDiscord | <PunchCake> :nimRawr: |
16:35:31 | FromDiscord | <spoon> there's a blog post about it, it's deterministic scope-based reference counting |
16:35:47 | FromDiscord | <spoon> https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html |
16:35:50 | FromDiscord | <etra> In reply to @Nerve "I work at a": out of curiosity, do you use Nim for such devices? |
16:35:51 | FromDiscord | <Nerve> So is `std::unique_ptr` GC if it's a counted reference but you specify it manually? The behavior is the same |
16:35:57 | FromDiscord | <etra> (edit) "In reply to @Nerve "I work at a": out of curiosity, do you use Nim for such devices? ... " added "or have you used it?" |
16:35:58 | FromDiscord | <PunchCake> The thing is you wouldnt even use nim for embedded even if you can |
16:36:04 | FromDiscord | <PunchCake> Nearly all embedded devs know C |
16:36:05 | FromDiscord | <0ffh> In reply to @Gumbercules "ref counting is GC": Kind of, but I doesn't need to trace, and the refcounting is completely deterministic. That's a big plus for embedded. |
16:36:08 | FromDiscord | <PunchCake> But they dont know nim |
16:36:23 | FromDiscord | <Nerve> In reply to @etra "out of curiosity, do": I've used C for it but I'm proposing Nim since it worked quite well for another backend system |
16:36:40 | FromDiscord | <spoon> for personal projects i'd absolutely use nim |
16:36:45 | FromDiscord | <PunchCake> In reply to @Nerve "I've used C for": They wont like kt |
16:36:49 | FromDiscord | <PunchCake> (edit) "kt" => "it" |
16:36:53 | FromDiscord | <Gumbercules> unless you have cycles and then you need ARC and you're paying for m&s |
16:36:55 | FromDiscord | <Nerve> I want to test it on ARM/RISC-V but your microcontrollers are I believe 6502s |
16:36:56 | * | ixmpp quit (Ping timeout: 265 seconds) |
16:37:00 | FromDiscord | <Nerve> (edit) "your" => "our" |
16:37:01 | FromDiscord | <PunchCake> And it wont work too @Nerve |
16:37:05 | FromDiscord | <Gumbercules> err ORC rather |
16:37:12 | FromDiscord | <PunchCake> Its hard to find nim embedded devs |
16:37:18 | FromDiscord | <PunchCake> Easy to find C embedded devs |
16:37:20 | FromDiscord | <Gumbercules> just go to #embedded |
16:37:21 | FromDiscord | <etra> In reply to @PunchCake "Nearly all embedded devs": I think you should turn off a bit the assumptions about /all/ people |
16:37:33 | FromDiscord | <PunchCake> No |
16:37:42 | FromDiscord | <PunchCake> In this context its correct |
16:37:53 | FromDiscord | <PunchCake> Bro wtf are you doing if your an embedded dev and dont know C |
16:38:13 | FromDiscord | <Gumbercules> maybe they're writing assembly? |
16:38:21 | FromDiscord | <Gumbercules> and they never learned C? |
16:38:23 | FromDiscord | <spoon> since nim ARC often gets confused with other ARC models, should just rename it to DARC |
16:38:24 | FromDiscord | <PunchCake> Very rarely that ever happens |
16:38:31 | FromDiscord | <Gumbercules> did you do a study? |
16:38:36 | FromDiscord | <PunchCake> And thats why i saod nearly too |
16:38:42 | FromDiscord | <PunchCake> (edit) "saod" => "said" |
16:38:45 | FromDiscord | <Gumbercules> My father only knows assembly |
16:38:53 | FromDiscord | <PunchCake> My father too |
16:38:55 | FromDiscord | <Gumbercules> He doesn't program anymore or work on embedded devices but still |
16:38:55 | FromDiscord | <etra> In reply to @PunchCake "In this context its": well, good luck in life presenting everything you think it's correct as facts |
16:38:56 | FromDiscord | <PunchCake> 8088 asm |
16:39:15 | FromDiscord | <PunchCake> In reply to @etra "well, good luck in": So this bozo completely ignored the nearly part |
16:39:21 | FromDiscord | <System64 ~ Flandre Scarlet> Wait, so if you enable ARC, there is no garbage collector? It's like the compiler puts free() functions where it should? |
16:39:22 | FromDiscord | <Gumbercules> I'm sure there are lots of people that never bothered to learn C who still program |
16:39:33 | FromDiscord | <Gumbercules> lots of Forth programmers too probably |
16:39:41 | FromDiscord | <spoon> In reply to @Piqueiras "uhmm quick question how": how are you handling it now? |
16:39:43 | FromDiscord | <Gumbercules> In reply to @System64 "Wait, so if you": no there is still a GC |
16:39:49 | FromDiscord | <etra> In reply to @PunchCake "So this bozo completely": thanks for the unwanted name calling :^) |
16:39:51 | FromDiscord | <PunchCake> Bro wtf is going on here |
16:39:51 | FromDiscord | <Gumbercules> reference counting is a type of garbage colection |
16:39:53 | FromDiscord | <spoon> In reply to @System64 "Wait, so if you": yep |
16:39:58 | FromDiscord | <PunchCake> Im being misunderstood all the way |
16:39:59 | FromDiscord | <Gumbercules> there's just no mark and sweep garbage collection happening |
16:40:02 | FromDiscord | <spoon> In reply to @Gumbercules "reference counting is a": i'd just call it a bad name |
16:40:13 | FromDiscord | <Piqueiras> In reply to @spoon "how are you handling": just strformat and tabs lol |
16:40:20 | FromDiscord | <Gumbercules> I mean - it's just a different algorithm is what it boils down to |
16:40:22 | FromDiscord | <0ffh> In reply to @System64 "Wait, so if you": It adds a few increments, decrements, and conditional jumps. |
16:40:23 | FromDiscord | <PunchCake> @Gumbercules I said nearly all embedded devs know C |
16:40:40 | FromDiscord | <Gumbercules> I'm just saying I have no clue on the numbers |
16:40:41 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @0ffh "It adds a few": Oh alright↵Same for ORC? |
16:40:50 | FromDiscord | <Gumbercules> ORC has a m&s GC |
16:40:53 | FromDiscord | <Gumbercules> bolted on |
16:40:54 | FromDiscord | <Gumbercules> for cycles |
16:41:01 | FromDiscord | <0ffh> In reply to @System64 "Oh alright Same for": No, orc needs to trace for cycles. |
16:41:02 | FromDiscord | <System64 ~ Flandre Scarlet> But what happens if you allocate stuff at runtime? |
16:41:13 | FromDiscord | <Gumbercules> you allocate stuff at runtime? |
16:41:17 | FromDiscord | <spoon> In reply to @Gumbercules "I mean - it's": did you read the blog post? |
16:41:25 | FromDiscord | <Gumbercules> In reply to @spoon "did you read the": I mean these things aren't unique to Nim |
16:41:31 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Gumbercules "you allocate stuff at": yeah↵Like malloc() or calloc() in C |
16:41:35 | FromDiscord | <PunchCake> In reply to @Gumbercules "you allocate stuff at": Ever heard of heap allocs? |
16:41:46 | FromDiscord | <Gumbercules> it was a rhetorical question |
16:41:53 | FromDiscord | <Gumbercules> like - the eprson asked - what happens when you do this? |
16:42:00 | FromDiscord | <Gumbercules> and I was jokingly saying - you do this...? |
16:42:01 | FromDiscord | <PunchCake> What does rhetorical mean? |
16:42:06 | FromDiscord | <Gumbercules> wasn't meant to be answered |
16:42:10 | FromDiscord | <PunchCake> Oh |
16:42:11 | FromDiscord | <PunchCake> My fault |
16:42:14 | FromDiscord | <Gumbercules> all good |
16:42:29 | FromDiscord | <PunchCake> You do any embedde dev gumber? |
16:42:33 | FromDiscord | <PunchCake> (edit) "embedde" => "embedded" |
16:42:45 | FromDiscord | <Gumbercules> In reply to @PunchCake "You do any embedded": No - my github is here: https://github.com/zacharycarter |
16:42:54 | FromDiscord | <Gumbercules> and https://github.com/Tail-Wag-Games/frag |
16:43:17 | * | arkurious joined #nim |
16:43:26 | FromDiscord | <PunchCake> In reply to @Gumbercules "No - my github": Oh nice your the creator of the nukelar bindigs |
16:43:30 | FromDiscord | <PunchCake> (edit) "bindigs" => "bindings" |
16:43:31 | FromDiscord | <Gumbercules> @System64 ~ Flandre Scarlet reference counting and mark and sweep will both automatically manage memory for you |
16:43:41 | FromDiscord | <Gumbercules> if you're manually allocating memory, you need to manually free it |
16:43:44 | FromDiscord | <PunchCake> Would like to say thanks for making it i liked it a lot and i used it a lot |
16:44:04 | FromDiscord | <Gumbercules> I just recently updated them |
16:44:17 | FromDiscord | <PunchCake> Keep at it bro |
16:44:18 | FromDiscord | <Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/thirdparty/nuklear.nim |
16:44:36 | FromDiscord | <Gumbercules> eh - I just work on my own project now - not trying to contribute anything anywhere |
16:44:46 | FromDiscord | <Gumbercules> but I mean, my project is FOSS so - people can do what they want with any of it |
16:44:46 | FromDiscord | <PunchCake> Did you do it by hand or did you use automatic bindings? |
16:45:08 | FromDiscord | <Gumbercules> I used c2nim - there was some manual work which could be easily automated but I'm lazy |
16:45:28 | FromDiscord | <Gumbercules> https://github.com/Tail-Wag-Games/frag/tree/master/thirdparty |
16:45:47 | FromDiscord | <Gumbercules> there are quite a few libraries I've written wrappers for in this project |
16:46:02 | FromDiscord | <Gumbercules> I'm currently integrating https://github.com/jrouwe/JoltPhysics with my project |
16:46:48 | FromDiscord | <Gumbercules> @System64 ~ Flandre Scarlet the primary difference between the two is mark and sweep is a scanning GC: https://www.geeksforgeeks.org/mark-and-sweep-garbage-collection-algorithm/ |
16:47:10 | FromDiscord | <PunchCake> Want a good project? |
16:47:10 | FromDiscord | <System64 ~ Flandre Scarlet> So mark and sweep is like Java? |
16:47:14 | FromDiscord | <PunchCake> Bring nim to godot engine |
16:47:29 | FromDiscord | <Gumbercules> whereas reference counting is a GC with a different deterministic algorithm, however it can't handle cycles: https://www.tutorialspoint.com/explain-in-detail-about-reference-counting-garbage-collection-in-javascript |
16:47:43 | FromDiscord | <Gumbercules> In reply to @PunchCake "Bring nim to godot": I vehemently dislike the Godot engine and its dev team |
16:47:54 | FromDiscord | <Gumbercules> In reply to @System64 "So mark and sweep": Yes Java uses some mark and sweep algo |
16:48:10 | FromDiscord | <Gumbercules> Swift for instance, uses atomic reference counting |
16:48:17 | FromDiscord | <spoon> In reply to @Gumbercules "I vehemently dislike the": that's why i found a way to download their software without paying >:) |
16:48:31 | FromDiscord | <Phil> ... aren't there already godot bindings? |
16:48:38 | FromDiscord | <Phil> I swear I saw a project |
16:48:39 | FromDiscord | <spoon> there are, just not for godot 4 |
16:48:43 | FromDiscord | <Gumbercules> I think so - probably just not the newest version |
16:48:47 | FromDiscord | <Gumbercules> but really, F Godot |
16:48:51 | FromDiscord | <Gumbercules> that Juan dude, ugh |
16:48:57 | FromDiscord | <PunchCake> In reply to @Gumbercules "I vehemently dislike the": Why tho? |
16:48:58 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Gumbercules "Yes Java uses some": and is there a GC with no overhead? |
16:48:59 | FromDiscord | <spoon> godot 4 replaced their FFI model |
16:49:00 | FromDiscord | <Gumbercules> they are expert handwavers |
16:49:20 | FromDiscord | <PunchCake> What foes that mean |
16:49:25 | FromDiscord | <Gumbercules> In reply to @System64 "and is there a": Not really no - I mean, manual memory management is always going to perform better than automatic |
16:49:25 | FromDiscord | <PunchCake> They're scumbags? |
16:49:29 | FromDiscord | <Gumbercules> No |
16:49:38 | FromDiscord | <Gumbercules> it means when it comes to explaining why they make certain design decisions |
16:50:00 | FromDiscord | <Gumbercules> they come up with some bullshit excuse and then expect people to accept it as a good one |
16:50:06 | FromDiscord | <spoon> sent a code paste, see https://paste.rs/yq8 |
16:50:21 | FromDiscord | <Gumbercules> `the use of gestures and insubstantial language meant to impress or convince.` |
16:50:59 | FromDiscord | <Nerve> In reply to @Gumbercules "Not really no -": If something like ARC or Rust's borrow checker inserts destruction logic at the end of any owning scope like one should do when manually managing memory using something like `std::unique_ptr`, then...what's the difference? |
16:50:59 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @spoon "from the blog post:": Oh alright↵And what about an auto-free? I've heard the V programming language will have this thing |
16:51:11 | FromDiscord | <spoon> it's still a "planned" feature |
16:51:15 | FromDiscord | <spoon> i think |
16:51:22 | FromDiscord | <Nerve> (edit) "one should do" => "happens" |
16:51:28 | FromDiscord | <Gumbercules> In reply to @Nerve "If something like ARC": You're still using a general purpose allocator |
16:51:36 | FromDiscord | <PunchCake> Arc leaks |
16:51:40 | FromDiscord | <PunchCake> So its no use |
16:51:42 | FromDiscord | <PunchCake> Orc is good |
16:51:51 | FromDiscord | <spoon> In reply to @PunchCake "Arc leaks": proof? evidence? |
16:51:54 | FromDiscord | <spoon> 🤨 |
16:51:59 | FromDiscord | <PunchCake> Literally the nim site |
16:52:09 | FromDiscord | <Gumbercules> you can't decide to perform a specific allocation with a specific allocator - you can if you patch `system/alloc` |
16:52:26 | FromDiscord | <Gumbercules> so no arenas, no temp allocators, etc.... |
16:52:31 | FromDiscord | <PunchCake> Look |
16:52:31 | FromDiscord | <PunchCake> https://media.discordapp.net/attachments/371759389889003532/1088505568408371250/Screenshot_20230323_195224_Chrome.jpg |
16:52:34 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PunchCake "Arc leaks": it leaks if you use cycles |
16:52:45 | FromDiscord | <spoon> In reply to @PunchCake "": 1.4.0???! |
16:52:46 | FromDiscord | <Nerve> In reply to @Gumbercules "You're still using a": https://forum.nim-lang.org/t/8225#52979 |
16:52:49 | FromDiscord | <Nerve> It's designed to be constant time |
16:52:59 | FromDiscord | <spoon> we're on 1.6.10 |
16:53:04 | FromDiscord | <PunchCake> In reply to @System64 "it leaks if you": Which is useless for me |
16:53:07 | FromDiscord | <PunchCake> Just use orc bruh |
16:53:07 | FromDiscord | <System64 ~ Flandre Scarlet> Wait it even have the Go GC?? |
16:53:15 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "have" => "has" |
16:53:16 | FromDiscord | <PunchCake> Yes for interop |
16:53:21 | FromDiscord | <PunchCake> I think |
16:53:31 | FromDiscord | <System64 ~ Flandre Scarlet> is the Go GC good? |
16:53:37 | FromDiscord | <PunchCake> No |
16:53:39 | FromDiscord | <PunchCake> Its so bad |
16:53:43 | FromDiscord | <Gumbercules> In reply to @Nerve "It's designed to be": can still beat that with an arena and dishing out memory |
16:53:58 | FromDiscord | <spoon> 😭 this guy trollin |
16:54:00 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PunchCake "Its so bad": Why? |
16:54:09 | FromDiscord | <PunchCake> What do you mean why? Have you trird go? |
16:54:17 | FromDiscord | <System64 ~ Flandre Scarlet> Yeah, it's good |
16:54:25 | FromDiscord | <PunchCake> Do you know the huge overhead ffi because of it |
16:55:01 | FromDiscord | <spoon> go gc is only really a problem when you're serving millions of customers and performance spikes down for garbage collector cycles |
16:55:18 | FromDiscord | <PunchCake> Yeah and thats where go runs anyways you genius |
16:55:20 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PunchCake "Do you know the": Ah yeah, C interop is PAIN |
16:55:41 | FromDiscord | <PunchCake> In reply to @System64 "Ah yeah, C interop": Oh yeah boi |
16:55:50 | FromDiscord | <PunchCake> I like nim because it goes fast |
16:55:52 | FromDiscord | <PunchCake> And is easy |
16:56:01 | FromDiscord | <PunchCake> And has a billion gcs to choose from |
16:56:06 | FromDiscord | <PunchCake> And can compile to javascript |
16:57:23 | FromDiscord | <Нудл> guys, how to download faster-than-requests the last version? |
16:57:35 | FromDiscord | <Нудл> so need |
16:58:24 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PunchCake "I like nim because": Yeah it's very fast!↵I guess you can do DSP stuff with it too |
16:58:28 | FromDiscord | <Gumbercules> In reply to @Nerve "https://forum.nim-lang.org/t/8225#52979": The larger point is, being able to choose an allocation algorithm on a per-allocation basis is going to yield advantages when it comes to maximizing space and time |
16:58:37 | FromDiscord | <PunchCake> In reply to @System64 "Yeah it's very fast!": Dont see why not |
16:58:39 | FromDiscord | <Gumbercules> And avoiding fragmentation |
16:58:50 | FromDiscord | <PunchCake> Dsp as in digital signal processing right @System64 ~ Flandre Scarlet |
16:59:00 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PunchCake "Dsp as in digital": Yeah |
16:59:10 | FromDiscord | <PunchCake> Yup nim would be plenty fast |
16:59:13 | FromDiscord | <System64 ~ Flandre Scarlet> for VST, synthesizers, filters, ... |
16:59:14 | FromDiscord | <Нудл> In reply to @Нудл "guys, how to download": answer please |
16:59:23 | FromDiscord | <PunchCake> Bro stop begging for answers |
16:59:32 | FromDiscord | <System64 ~ Flandre Scarlet> What if we replace Python by Nim? |
16:59:58 | FromDiscord | <PunchCake> It would be bad |
17:00:06 | FromDiscord | <PunchCake> Since python ecosystems depends on what |
17:00:08 | FromDiscord | <PunchCake> Python |
17:00:11 | FromDiscord | <PunchCake> Who knew |
17:00:20 | FromDiscord | <spoon> ??? |
17:00:33 | FromDiscord | <PunchCake> ???? |
17:00:43 | FromDiscord | <System64 ~ Flandre Scarlet> Python is slow, so better to use Nim instead |
17:00:46 | FromDiscord | <PunchCake> Wait i misread |
17:00:49 | FromDiscord | <PunchCake> xD |
17:00:57 | FromDiscord | <PunchCake> If you can use nim instead of python then do it |
17:01:08 | FromDiscord | <PunchCake> If you want try bindings tensorflow to nim |
17:01:10 | * | beholders_eye joined #nim |
17:01:16 | FromDiscord | <PunchCake> That would be great |
17:01:20 | FromDiscord | <spoon> python for AI is just a slow interface for calling C code |
17:01:25 | FromDiscord | <Нудл> uhh, guys, please, im so want to try it |
17:01:29 | FromDiscord | <spoon> why even use python for AI |
17:01:34 | FromDiscord | <PunchCake> In reply to @spoon "python for AI is": Its not slow |
17:01:44 | FromDiscord | <Нудл> faster-than-requests |
17:02:00 | FromDiscord | <PunchCake> Benchmarks prove that calling c from python is as fast as just using the regular C |
17:02:00 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PunchCake "If you want try": Is it possible?? |
17:02:07 | FromDiscord | <PunchCake> Why not |
17:02:13 | FromDiscord | <spoon> python over there being 10x slower than lua |
17:02:23 | FromDiscord | <PunchCake> Tensorflow is in C++ |
17:02:49 | FromDiscord | <spoon> you know most popular python libraries use a C FFI, including scipi, tensorflow, numpy, etc |
17:02:58 | FromDiscord | <PunchCake> Yes |
17:03:03 | FromDiscord | <PunchCake> Bring it over to lua then |
17:03:37 | FromDiscord | <PunchCake> The thing is that python is so balls deep into ai that there is no hope for other langs to take its place |
17:03:41 | FromDiscord | <Нудл> @PunchCake do u know how to download faster-than-requests& |
17:03:43 | FromDiscord | <Gumbercules> In reply to @Нудл "faster-than-requests": I don't even know what you're referring to |
17:03:51 | FromDiscord | <spoon> In reply to @Нудл "faster-than-requests": the python library? |
17:03:56 | FromDiscord | <Нудл> yup |
17:04:05 | FromDiscord | <Gumbercules> pip |
17:04:12 | FromDiscord | <PunchCake> And primarily because ai devs are more intrested in theory than the actual language so they want something thats dead easy to use |
17:04:21 | FromDiscord | <spoon> sir this is the nim server |
17:04:22 | FromDiscord | <Нудл> In reply to @Gumbercules "pip": dont download, im tryed |
17:04:27 | FromDiscord | <Gumbercules> This is off-topic |
17:04:28 | FromDiscord | <Нудл> with 2 devices |
17:04:37 | FromDiscord | <Gumbercules> In reply to @Нудл "dont download, im tryed": This isn't a python help channel |
17:04:38 | FromDiscord | <PunchCake> In reply to @spoon "sir this is the": I thought this was taco bell bro |
17:04:47 | FromDiscord | <PunchCake> Wheres my burrito at |
17:04:55 | FromDiscord | <Gumbercules> This chat is getting out of control |
17:04:59 | FromDiscord | <PunchCake> xD |
17:05:05 | FromDiscord | <spoon> In reply to @PunchCake "I thought this was": the poor taco bell drive through employee when i sit there holding up the line explaining GC |
17:05:06 | FromDiscord | <Gumbercules> Main is for questions related to Nim development only |
17:05:13 | FromDiscord | <PunchCake> In reply to @spoon "the poor taco bell": XD |
17:05:24 | FromDiscord | <Gumbercules> So let's everyone limit conversation to that |
17:05:30 | FromDiscord | <PunchCake> me explaining to the taco bell employee why arc gc leaks: |
17:05:42 | FromDiscord | <Andreas> In reply to @PunchCake "The thing is that": we should at least try.. |
17:05:51 | FromDiscord | <Gumbercules> Off topic |
17:05:55 | FromDiscord | <Нудл> In reply to @Gumbercules "This isn't a python": its a yours product? right? |
17:06:04 | FromDiscord | <PunchCake> In reply to @Andreas "we should at least": Resources would be better allocated elsewhere |
17:06:06 | FromDiscord | <Gumbercules> Off topic |
17:06:08 | FromDiscord | <Нудл> Why not help? |
17:06:11 | FromDiscord | <PunchCake> First we need a gui lib for mobile bruh |
17:06:25 | FromDiscord | <Gumbercules> Don't make me ping mods |
17:06:28 | FromDiscord | <PunchCake> Blyat |
17:06:46 | * | ixmpp joined #nim |
17:06:56 | FromDiscord | <Andreas> In reply to @PunchCake "Resources would be better": "AI" gives magic propaganda points.. |
17:07:00 | FromDiscord | <Нудл> Mmm naxui |
17:07:02 | FromDiscord | <Нудл> okey |
17:07:07 | FromDiscord | <Нудл> thanks |
17:07:13 | FromDiscord | <Нудл> good product |
17:07:17 | FromDiscord | <Нудл> very good |
17:07:26 | FromDiscord | <PunchCake> In reply to @Нудл "Mmm naxui": Lmao russia? |
17:07:28 | FromDiscord | <Нудл> ахуенный |
17:07:30 | FromDiscord | <Нудл> пиздатый |
17:07:35 | FromDiscord | <Gumbercules> <@&371760044473319454> |
17:07:39 | FromDiscord | <PunchCake> No i dont speak much russian nor can i read |
17:07:42 | FromDiscord | <spoon> oh wait i take back what i said about 1.6.10 we on 1.6.12 when this happen |
17:07:47 | FromDiscord | <PunchCake> I just know a few things |
17:07:51 | FromDiscord | <PunchCake> Long live russia tbh |
17:10:09 | FromDiscord | <Gumbercules> Probably wasn't a great idea to choose all European mods |
17:10:16 | FromDiscord | <PunchCake> lol |
17:10:30 | FromDiscord | <PunchCake> Why you calling the cops on us bro |
17:10:40 | FromDiscord | <PunchCake> Your like the neighbour who calls the cops on a party |
17:10:43 | FromDiscord | <Gumbercules> Because this is dumb and not what main is for |
17:10:45 | FromDiscord | <Phil> What are you talking about? The man was banned before I could even get to it |
17:10:53 | FromDiscord | <PunchCake> What man? |
17:10:54 | FromDiscord | <PunchCake> Who |
17:10:57 | FromDiscord | <Phil> His messages were merely not deleted |
17:11:08 | FromDiscord | <Gumbercules> Enforcing mains rules I mean Phil |
17:11:33 | FromDiscord | <Gumbercules> It's been drivel in here the past 30+ minutes |
17:11:43 | FromDiscord | <eyes> bruh |
17:11:51 | FromDiscord | <eyes> can we get threads in this chat |
17:11:56 | FromDiscord | <PunchCake> No |
17:12:01 | FromDiscord | <Phil> No, also offtopic question |
17:12:27 | FromDiscord | <PunchCake> bruh |
17:12:27 | FromDiscord | <eyes> im trying to ask an unrelated question which people should be able to answer whenever they want, not just right after i send it |
17:12:39 | FromDiscord | <eyes> In reply to @Isofruit "No, also offtopic question": exactly why i want threads lol |
17:12:52 | FromDiscord | <eyes> only reason i can think of for no threads is matrix/irc bridges |
17:12:55 | * | kenran quit (Remote host closed the connection) |
17:16:11 | FromDiscord | <eyes> anyways my question is: could somebody please clone https://github.com/the-argus/rrule_nim and run ``nimble test`` and help me debug this little error |
17:16:36 | FromDiscord | <pietroppeter> In reply to @Gumbercules "It's been drivel in": It is kind of hard to see what was the topic in here, one thing for sure faster-than-requests is a Python library made in Nim to prove that you can easily make fast Python libraries using Nim, so that part (even if not clearly articulated) I would say is on topic |
17:17:15 | FromDiscord | <eyes> sent a code paste, see https://play.nim-lang.org/#ix=4rCG |
17:17:17 | FromDiscord | <eyes> on the ``ttr = Parser...`` line |
17:17:28 | FromDiscord | <pietroppeter> https://github.com/juancarlospaco/faster-than-requests |
17:18:55 | FromDiscord | <Rika> In reply to @eyes "i have this function:": `rules = ...` |
17:19:10 | FromDiscord | <eyes> BRUH |
17:19:13 | FromDiscord | <eyes> nimlsp moment |
17:19:41 | FromDiscord | <eyes> thank you |
17:19:56 | FromDiscord | <eyes> i really should start making issues for all the shit i find with nimlsp |
17:20:36 | FromDiscord | <Rika> its an issue of nimsuggest more of |
17:21:07 | FromDiscord | <eyes> what is the difference between nimlsp and nimsuggest? |
17:21:19 | FromDiscord | <eyes> i guess uh wait |
17:21:21 | FromDiscord | <Phil> nimsuggest is the core utility everything uses to analyze your nim code |
17:21:33 | FromDiscord | <eyes> included in the nim-lang/nim code? |
17:21:46 | FromDiscord | <Phil> I'd need to check if it's in the same repo or not, but basically it's a core utility |
17:21:50 | FromDiscord | <eyes> yeah okay |
17:22:17 | FromDiscord | <spoon> nimlsp uses nimsuggest as the backend |
17:22:36 | FromDiscord | <eyes> yeah that makes sense |
17:22:51 | FromDiscord | <Phil> It is the thing that analyzes code and spits out what's wrong with it or what suggestions it can provide.↵Everything else just manages communication with whatever code turns that into showing up in a GUI |
17:22:53 | FromDiscord | <eyes> just an lsp implementation for nimsuggest |
17:23:10 | FromDiscord | <eyes> interesting |
17:23:34 | FromDiscord | <Phil> https://github.com/nim-lang/Nim/tree/devel/nimsuggest↵There you go, part of the core compiler repo |
17:23:46 | FromDiscord | <eyes> im amazed that a lsp made by the language developers could have so many flaws |
17:23:59 | FromDiscord | <Phil> And uses the compiler itself for analysis |
17:24:03 | FromDiscord | <eyes> yeah |
17:24:13 | FromDiscord | <eyes> im getting an error rn which just directly conflicts with the compiler error |
17:24:19 | FromDiscord | <Rika> its very new and its more of the suggestion backend with the flas |
17:24:21 | FromDiscord | <Rika> (edit) "flas" => "flaws" |
17:24:29 | FromDiscord | <Gumbercules> In reply to @pietroppeter "It is kind of": I wasn't aware, thanks for the info |
17:25:55 | FromDiscord | <jmgomez> In reply to @eyes "im amazed that a": Most people use nimsuggest directly |
17:26:16 | FromDiscord | <jmgomez> AFAIK they didnt develop the lsp. Did they? |
17:26:20 | FromDiscord | <spoon> i use nimlsp in neovim |
17:26:28 | FromDiscord | <Gumbercules> Nimsuggest has the flaws |
17:26:34 | FromDiscord | <spoon> it told me symbols from raylib didn't exist |
17:26:57 | FromDiscord | <jmgomez> Yeah, and the lsp has its own flaws too. I used it for a bit but it's kind of abandoned |
17:27:00 | FromDiscord | <Gumbercules> Nimlap uses nimsuggest |
17:27:14 | FromDiscord | <jmgomez> Im planning to do something about the editor soon, as soon as I get the VM thing usable |
17:27:58 | FromDiscord | <Gumbercules> Well the maintainer hangs out with the numskull crowd |
17:28:13 | FromDiscord | <Gumbercules> Nimskull |
17:28:30 | FromDiscord | <jmgomez> I will do one for NUE and as a byproduct make it usable for Nim too. It mainly will be a companion for NimSuggest |
17:28:45 | FromDiscord | <jmgomez> Cant really release NUE without proper discovery tools.. |
17:28:47 | FromDiscord | <Gumbercules> Should just fix nimsuggest |
17:29:18 | FromDiscord | <jmgomez> I think that's beyond my current skills. I can wait until Araq fixes IC but in the meantime I think I can do something about it |
17:29:49 | FromDiscord | <jmgomez> So it will be just a layer on top of nimsuggest that wont understand macros etc. |
17:30:28 | FromDiscord | <Gumbercules> I don't know what the underlying issue with them suggest is All I know is it launches way too many processes and it leaks |
17:30:44 | FromDiscord | <Gumbercules> But I assume one should be able to hook it up to Val grind or address sanitizer or something and find the leak fairly easily |
17:30:53 | FromDiscord | <Gumbercules> I just don't know if people have tried |
17:31:12 | FromDiscord | <Gumbercules> I don't really use it so.... |
17:31:23 | FromDiscord | <Gumbercules> I also wouldn't look to incremental compilation as some savior because it might not ever arrive |
17:31:58 | FromDiscord | <jmgomez> What I know is that IC may help because all is "cached" so it doesnt have to do the rediscovery again and again. Yeah, that's why I want to do something about it |
17:32:25 | FromDiscord | <spoon> that and treesitter grammar |
17:33:36 | FromDiscord | <Gumbercules> I don't even have Nim suggest built on my machine because the last time I tried sometime in the past week or so, it failed to build on Windows |
17:33:51 | FromDiscord | <Gumbercules> Maybe if I ever have a spare moment I will try again and see if I can find the leak |
17:33:54 | FromDiscord | <jmgomez> In reply to @Gumbercules "I don't even have": it works fine for me though |
17:33:58 | FromDiscord | <Gumbercules> It can't be that hard... |
17:34:09 | FromDiscord | <Gumbercules> Well I tried to compile some random devel version |
17:34:14 | FromDiscord | <jmgomez> I think it's mostly the extension opening too many instances |
17:34:19 | FromDiscord | <Gumbercules> Whatever was head on that given day |
17:34:29 | FromDiscord | <Gumbercules> I don't think so at least not the leak |
17:34:49 | FromDiscord | <Gumbercules> I think it still leaks even in other editors |
17:35:21 | FromDiscord | <jmgomez> Dunno, didnt really look into it. TBH what bothers me is that it's slow, sometimes doesnt suggest and the order of things is messed up |
17:36:04 | FromDiscord | <jmgomez> That's said for me the tooling is good enough, but I cant expect other people to feel the same. Especially those unfamiliar with Nim |
17:36:47 | FromDiscord | <Gumbercules> Most people want refactoring tools like you'd find in intelliJ or resharper |
17:37:02 | FromDiscord | <Gumbercules> Which Nim is pretty far away from |
17:37:21 | FromDiscord | <jmgomez> haha lol, yes. I think something at the average C++ level can be neat |
17:37:34 | FromDiscord | <Gumbercules> We're often dealing with people coming from higher level languages not lower so expecting them to know how a C compiler tool chain functions is a bit of a stretch |
17:37:47 | FromDiscord | <Gumbercules> They want easy mode |
17:41:03 | FromDiscord | <Gumbercules> There were all these attempts in the past to make Nim tooling - Nim's wrapper around GDB, a couple of IDEs / Editors, a REPL, etc... |
17:41:41 | FromDiscord | <Gumbercules> they have all been abandoned and the community didn't pick any of them up |
17:43:00 | FromDiscord | <jmgomez> 😦 |
17:43:41 | FromDiscord | <Gumbercules> Dogfooding is hard |
17:44:36 | FromDiscord | <Gumbercules> And so is convincing people to spend time developing tools against a moving target - but now that Nim seems to be on more stable footing, maybe it's time to reinvest energy in this area |
17:44:43 | FromDiscord | <Gumbercules> I'm just not sure what people want - beyond a working nimsuggest |
17:45:33 | FromDiscord | <Andreas> In reply to @Gumbercules "And so is convincing": right so, lets compile nimsuggest/nimlsp to WASM and use Lapce with nim.. |
17:45:59 | FromDiscord | <Gumbercules> I can't tell if you're being serious or not haha |
17:46:26 | FromDiscord | <Andreas> In reply to @Gumbercules "I can't tell if": TBH i tried Lapce and its a snappy one.. |
17:46:41 | FromDiscord | <Gumbercules> I didn't even know what it was - I don't think this is going to really solve anything though |
17:46:53 | FromDiscord | <Gumbercules> besides having another editor to write Nim code in - and then losing support for the VSCode extension |
17:47:09 | FromDiscord | <Gumbercules> The problem isn't lack of an editor - it's lack of language tooling |
17:47:09 | FromDiscord | <spoon> all i want besides that is treesitter grammar, i know a few small editors/projects that are waiting on nim treesitter grammars to be complete to include syntax highlighting |
17:47:34 | FromDiscord | <Andreas> In reply to @Gumbercules "The problem isn't lack": what tooling is missing ? |
17:48:22 | FromDiscord | <Gumbercules> In reply to @Andreas "what tooling is missing": Well - for one, a working version of Nimsuggest that doesn't spawn an insane number of processes and leak like a sieve |
17:48:41 | FromDiscord | <Gumbercules> Every time I use Nimsuggest and I want to re-compile Nim, it's a giant PITA |
17:49:07 | FromDiscord | <Gumbercules> I'd also venture that people would like more refactoring tools |
17:49:11 | FromDiscord | <Andreas> In reply to @Gumbercules "Well - for one,": true, but it got beeter since nimlsp controls nimsuggest.. |
17:49:17 | FromDiscord | <Gumbercules> Basically the environment needs to be able to parse and understand Nim code better |
17:50:10 | FromDiscord | <Andreas> In reply to @Gumbercules "Basically the environment needs": my impression was, that nimsuggest struggles most when macros come into play. It would be nice to be able to deactivate that. |
17:50:22 | FromDiscord | <Phil> In reply to @Gumbercules "I'm just not sure": In tooling? |
17:50:27 | FromDiscord | <Gumbercules> In reply to @Isofruit "In tooling?": Yes |
17:50:31 | FromDiscord | <Gumbercules> In reply to @Andreas "my impression was, that": I has no idea |
17:51:34 | FromDiscord | <spoon> i gtg but here is an example of an editor waiting for treesitter grammar↵https://github.com/helix-editor/helix/issues/3117↵and a plugin↵https://github.com/nvim-treesitter/nvim-treesitter/issues/3011 |
17:52:34 | FromDiscord | <Andreas> In reply to @spoon "i gtg but here": add Zed to the list |
17:52:55 | FromDiscord | <Gumbercules> https://gist.github.com/Aerijo/df27228d70c633e088b0591b8857eeef |
17:53:19 | FromDiscord | <Phil> sent a long message, see http://ix.io/4rCO |
17:54:22 | FromDiscord | <Gumbercules> Seems like some of this is out of scope for the language development team itself though |
17:54:24 | FromDiscord | <Phil> And then one thing that is special for each code area which would be better testing tooling |
17:54:30 | FromDiscord | <Gumbercules> Besides faster compile times |
17:54:37 | FromDiscord | <Phil> Yeah fair |
17:54:40 | FromDiscord | <Phil> Ohh! |
17:54:44 | FromDiscord | <Phil> Nimpretty improvements |
17:54:47 | FromDiscord | <Gumbercules> Ah yeah |
17:54:49 | FromDiscord | <Gumbercules> Nimpretty blows |
17:54:56 | FromDiscord | <Gumbercules> that's a good one |
17:54:56 | FromDiscord | <Phil> An actual propper linter |
17:55:46 | FromDiscord | <Andreas> In reply to @Isofruit "And then one thing": how about the `testing with balls`-thinggy ? |
17:56:29 | FromDiscord | <Phil> In reply to @Andreas "how about the `testing": for the basics std/unittest is adequate, but I wish we had ways to make it easier to test your owlkettle, jester or prologue application |
17:56:41 | FromDiscord | <Phil> For a propper test I have to compile the project, start the server and then use a client to poke the server |
17:57:05 | FromDiscord | <Gumbercules> Sounds like Nim needs a mock http server |
17:57:06 | FromDiscord | <Phil> Test-tooling that would make the entire part that compiles and starts the server (and corresponding database) easier would be really nice |
17:58:00 | FromDiscord | <Phil> I still have no clue how I'll end up testing owlkettle tbh other than the backend |
17:58:02 | FromDiscord | <Andreas> In reply to @Isofruit "Test-tooling that would make": i would use the `tearup/teardown`-sections - isn't that enough.. |
17:58:17 | FromDiscord | <jmgomez> I would add more support for the NimVM as standalone application. In the sense of being able to bind anything easily |
17:58:45 | FromDiscord | <Phil> In reply to @Andreas "i would use the": You can absolutely do that there, but you still have to first write the code that does all the things |
17:58:50 | FromDiscord | <jmgomez> That would be a game changer. Im in the midle of preparing a demo and it's really a game changer |
17:59:10 | FromDiscord | <jmgomez> like 100<ms iteration times |
17:59:36 | FromDiscord | <Phil> sent a long message, see http://ix.io/4rCS |
18:00:37 | FromDiscord | <Gumbercules> I think this kind of stuff is better framed as - what tooling does prologue need? |
18:00:46 | FromDiscord | <Gumbercules> or insert web dev framework name |
18:00:52 | FromDiscord | <Phil> In reply to @Gumbercules "I think this kind": It's an issue ... yeah that, |
18:01:01 | FromDiscord | <Phil> If I used jester I'd say the same thing |
18:01:11 | FromDiscord | <Phil> And I believe it might also be true for owlkettle |
18:01:14 | FromDiscord | <Gumbercules> But this is also one of the problems |
18:01:23 | FromDiscord | <Gumbercules> at one point, the dev team got bored of building actual tooling |
18:01:31 | FromDiscord | <Gumbercules> and thought it'd be a good idea to try and write an ORM |
18:01:41 | FromDiscord | <Gumbercules> or a snake game etc |
18:02:01 | FromDiscord | <Gumbercules> or web forums |
18:02:02 | FromDiscord | <Andreas> In reply to @Isofruit "I had to write": sure, buts that has not been not too much work, i'd doubt a framework could provide such stuff.. |
18:02:08 | * | derpydoo quit (Quit: derpydoo) |
18:02:19 | FromDiscord | <Phil> I mean, it's not like it's insanely hard to do all of that without the tooling, but it'd be nice if there were some way to make it easier |
18:04:05 | * | derpydoo joined #nim |
18:04:34 | FromDiscord | <Gumbercules> ops are always a pain |
18:04:59 | FromDiscord | <Gumbercules> In my almost two decades of web dev experience - you're either using something like Docker these days or mocking stuff |
18:05:31 | FromDiscord | <Gumbercules> if you're using docker - you don't need to write any code to launch your database sidecar |
18:05:49 | FromDiscord | <Gumbercules> and often - people are using some sort of library that provides migrations for their database to handle the creation of the actual database / tables etc |
18:06:16 | FromDiscord | <Gumbercules> they're also using some unit testing library that allows them to standup and teardown their schema between test runs |
18:06:45 | FromDiscord | <Gumbercules> if you want a good example of a good web framework - look at Elixir and Phoenix |
18:07:33 | FromDiscord | <Gumbercules> https://www.phoenixframework.org/ |
18:07:47 | FromDiscord | <jmgomez> In reply to @Gumbercules "if you want a": played with it back in the day. WOuldnt be cool Nim bindings for the erlang vm? 😄 |
18:08:26 | FromDiscord | <Andreas> In reply to @jmgomez "played with it back": there has been smth. published already.. |
18:08:29 | FromDiscord | <Gumbercules> why not just write a BEAM backend for Nim? |
18:08:47 | FromDiscord | <jmgomez> In reply to @Andreas "there has been smth.": oh really? |
18:08:55 | FromDiscord | <jmgomez> In reply to @Gumbercules "why not just write": Dunno, sounds like more work? |
18:09:02 | FromDiscord | <Gumbercules> Possibly, I'm not sure |
18:09:04 | FromDiscord | <jmgomez> but yeah, that would be killer |
18:09:06 | FromDiscord | <Andreas> In reply to @Gumbercules "why not just write": 'cos that'll take decades 🙂 |
18:09:09 | FromDiscord | <Gumbercules> No |
18:09:15 | FromDiscord | <Gumbercules> https://github.com/llaisdy/beam_languages |
18:09:54 | FromDiscord | <Gumbercules> I don't think you'd end up with something that had the selling points of Erlang or Elixir either |
18:10:20 | FromDiscord | <Gumbercules> Mostly because those languages are designed to take advantaege of BEAM's architecture. Nim is not |
18:10:26 | FromDiscord | <Gumbercules> I think Zevv is trying to do something similar with Nim |
18:10:32 | FromDiscord | <Dimi> Hey. I have a quick question. How can I access and update variable from main thread and spawned thread. I'm asking because my variable if flagged with {.threadvar.} has its own value for every thread and {.global.} pragma also doesn't help |
18:10:42 | FromDiscord | <Dimi> (edit) "Hey. I have a quick question. How can I access and update variable from main ... thread" added "the" |
18:10:46 | FromDiscord | <Gumbercules> https://github.com/zevv/actors |
18:11:01 | FromDiscord | <Gumbercules> In reply to @Dimi "Hey. I have a": use locks and shared memory |
18:11:06 | FromDiscord | <jmgomez> what do you think makes so different erlang from Nim? Dynamism? |
18:11:12 | FromDiscord | <Gumbercules> That's one major thing |
18:11:13 | FromDiscord | <jmgomez> (edit) "erlang" => "elixir" |
18:11:33 | FromDiscord | <Gumbercules> Be back in a moment, need to change a poopy diaper |
18:11:55 | FromDiscord | <Dimi> In reply to @Gumbercules "use locks and shared": Thanks. Too complicated comparing to Golang |
18:12:11 | FromDiscord | <Andreas> In reply to @jmgomez "oh really?": nimler https://github.com/wltsmrz/nimler |
18:14:04 | Zevv | that actors thing mostly works. I can spawn a million in a few seconds and have them do stuff |
18:14:39 | Zevv | have to jump through hoops to allow nim to properly move memory between threads because ARC is trying in every way to mess that up when you're not looking |
18:14:52 | Zevv | with ORC it's not even possible yet. I'd love to be proven wrong on that to |
18:14:53 | Zevv | tho |
18:19:36 | FromDiscord | <Dimi> Anyone can give me the link to the documentation on how to use locks and shared memory to access variables from the main thread and spawned thread? |
18:20:11 | FromDiscord | <Andreas> @zevv hi, i tried bitline yesterday - had to change some imports - but `bitline perf.txt` takes 2min to start and shows no data ? tried `bitline -s perf.txt` same thing ? |
18:20:57 | FromDiscord | <Andreas> (edit) "@zevv ... hi," added "" |
18:21:01 | Zevv | pff not sure what state it is in I must admit |
18:21:05 | Zevv | I didn't know i had any users |
18:21:35 | Zevv | the format changed a few times so I'm not sure if the tools match the binary anymore |
18:21:38 | Zevv | gimme a few mins |
18:21:51 | FromDiscord | <Andreas> In reply to @Zevv "I didn't know i": at least one - i'd like to use to like the Activity-App on mac, showing perf-stats |
18:22:03 | FromDiscord | <Gumbercules> In reply to @Dimi "Anyone can give me": https://github.com/nim-lang/Nim/blob/devel/tests/threads/tmanyjoin.nim |
18:22:43 | FromDiscord | <Gumbercules> In reply to @Andreas "nimler https://github.com/wltsmrz/nimler": This just lets you write functions to be able to call from Erlang / Elixir |
18:22:59 | FromDiscord | <Gumbercules> Similar to Nim's C/C++ interop |
18:23:06 | FromDiscord | <Andreas> In reply to @Gumbercules "This just lets you": it's a start, isn't ? |
18:23:16 | FromDiscord | <Gumbercules> Well I think it's a start and an end |
18:23:43 | FromDiscord | <Andreas> In reply to @Gumbercules "Well I think it's": what's on your mind ? |
18:24:00 | FromDiscord | <Gumbercules> If you truly wanted to target the BEAM with Nim you'd do something like this - https://www.slideshare.net/hamidreza-s/create-your-own-language |
18:24:00 | FromDiscord | <Andreas> (edit) "In reply to @Gumbercules "Well I think it's": what's on your mind ? ... " added "A full nim-backend ?" |
18:25:16 | FromDiscord | <Gumbercules> probably a bad example - let me try to find something else that shines light on the process |
18:25:28 | FromDiscord | <Gumbercules> https://www.programmingtalks.org/talk/implementing-languages-on-the-beam |
18:25:30 | FromDiscord | <Gumbercules> I think this is better |
18:26:22 | Zevv | Andreas: perf works for me |
18:26:59 | Zevv | I did the stuff from the comments in perf2event.nim |
18:27:14 | Zevv | then run perf2event.nim to convert perf.txt to bitline format |
18:27:20 | Zevv | and just run `bitline perf.stuff` |
18:27:41 | FromDiscord | <Gumbercules> https://www.erlang-factory.com/upload/presentations/523/EFSF2012-Implementinglanguages.pdf is probably good too |
18:28:11 | Zevv | Andreas: http://zevv.nl/div/bl.png |
18:30:45 | FromDiscord | <Dimi> In reply to @Gumbercules "https://github.com/nim-lang/Nim/blob/devel/tests/th": So if I have "var videoArray : seq[string]" variable, I need to access from main and thread, I have to incorporate it along with the object which has Lock var + create pointer additionally? |
18:31:09 | FromDiscord | <Gumbercules> In reply to @Dimi "So if I have": You'd just need the sequence and a lock |
18:31:18 | FromDiscord | <Gumbercules> assuming you're using ARC/ORC and not the refc GC |
18:31:49 | FromDiscord | <Gumbercules> alternatively you could create a lock free version of sequence and use atomics or something else to control access |
18:32:11 | FromDiscord | <Gumbercules> but you wouldn't be able to use this seq with the stdlib - so there's not much point |
18:32:50 | FromDiscord | <Gumbercules> It's pretty much the same way you'd do this type of stuff in C/C++ |
18:33:12 | FromDiscord | <jmgomez> In reply to @Gumbercules "Well I think it's": ideally you would do both. For pure CPU erlang/elixir is not that good |
18:33:13 | FromDiscord | <Gumbercules> If you don't want to have to deal with locks you can use channels |
18:33:43 | FromDiscord | <jmgomez> but yeah, you are right. In the general case it's much better to implement nim with it |
18:33:47 | FromDiscord | <Gumbercules> In reply to @jmgomez "ideally you would do": Yeah - I just meant that you're not going to end up with a language that can run on the BEAM VM with just NIFs solved |
18:33:56 | Zevv | don't use the nim-lang/thrading channels, they're borked and broken |
18:34:09 | FromDiscord | <jmgomez> (edit) "nim" => "a lang" | "it" => "nim" |
18:34:24 | FromDiscord | <Gumbercules> Do the Nim developers know this 😃 ? |
18:34:56 | Zevv | Dunno. |
18:34:56 | Zevv | https://github.com/nim-lang/threading/issues/24 |
18:35:16 | Zevv | actually, it's just a mess. |
18:35:36 | Zevv | the whole thing should be just a dequeue with a mutex and a condition variable, no more no less |
18:35:54 | Zevv | but it's 400+ lines and they are wrong |
18:36:25 | FromDiscord | <Gumbercules> Boggles my mind people aren't testing multithreaded code with valgrind / asan |
18:36:34 | Zevv | preaching to the choir |
18:36:47 | Zevv | I pointed out to a few projects that their code is not running clean under helgrind |
18:37:02 | Zevv | I consistently get the answer "helgrind is giving false positives, i know what I'm doing" |
18:37:04 | FromDiscord | <Gumbercules> Maybe we do all need Rust |
18:37:06 | Zevv | i gave up on that |
18:37:11 | FromDiscord | <Gumbercules> Heh |
18:37:41 | Zevv | I spent over a month with this actors stuff to get it clean on helgrind and friends |
18:37:54 | Zevv | it's hell. but I trust that stuff. |
18:38:58 | Zevv | I was shocked to only properly learn all these details about the C/C++ memory model and threading in my 40's. And now i'm shocked about how few people know this stuff. |
18:38:58 | FromDiscord | <Gumbercules> yeah - I've been there as well |
18:39:12 | Zevv | I've had nice talks with seniors and professionals, and they all just have it wrong |
18:39:13 | FromDiscord | <Dimi> In reply to @Gumbercules "It's pretty much the": I was learning C/C++ 20 years ago, then was working with Python, Go. Now I found Nim as a perfect combination of small binary size (this is important for me though), speed and simple syntax. But when I approached threads, then I've been lost in syntax and possibilities. Thanks. I will check this docs and options out |
18:39:14 | Zevv | time after time. |
18:40:08 | FromDiscord | <Gumbercules> In reply to @Dimi "I was learning C/C++": Yeah, Nim's concurrency model is nothing like Golang's but if you want you can use Boehm and then some of this stuff is easier |
18:40:15 | FromDiscord | <Gumbercules> but now you have a stop the world GC |
18:40:37 | FromDiscord | <Dimi> In reply to @Gumbercules "If you don't want": Yes. I've dealt with the channels already. Thanks for the idea |
18:41:16 | FromDiscord | <Dimi> (edit) "In reply to @Gumbercules "If you don't want": Yes. I've dealt with the ... channels" added "Nim" |
18:43:54 | FromDiscord | <Gumbercules> In reply to @Zevv "I've had nice talks": Doesn't take much to become an expert in things these days |
18:44:02 | FromDiscord | <Gumbercules> Or claim to be one rather |
18:44:07 | FromDiscord | <Gumbercules> (edit) "Or ... claim" added "to be able to" |
18:44:45 | Zevv | i'm no expert |
18:45:06 | FromDiscord | <Gumbercules> err I was referring to the seniors and professionals 😛 |
18:45:33 | Zevv | well, these were people I regard as professionals, they know where their towel is at |
18:45:39 | Zevv | but not in this particular subject, it seems |
18:47:22 | FromDiscord | <Gumbercules> https://media.discordapp.net/attachments/371759389889003532/1088534468257665135/thistall.png |
18:47:24 | FromDiscord | <Gumbercules> there's a reason this exists |
18:47:40 | Zevv | i do agree with that one |
18:48:34 | Zevv | the only reason for writing actors was so that i do not have to write any more threading code |
18:48:43 | Zevv | just parallelize by default and don't care shit about it |
18:49:24 | FromDiscord | <Gumbercules> definitely a sound approach |
18:52:17 | FromDiscord | <Andreas> In reply to @Zevv "then run perf2event.nim to": i'll do - forget the conversion step - thx |
18:53:27 | FromDiscord | <Gumbercules> It's fun to reread that blog post and be reminded of how old I am |
18:55:30 | FromDiscord | <Gumbercules> Not in my 40s yet though 😓 |
18:55:40 | FromDiscord | <Gumbercules> (edit) "😓" => "😅" |
18:55:44 | FromDiscord | <Gumbercules> Just very close |
18:56:01 | * | xet7 quit (Quit: Leaving) |
18:56:20 | * | xet7 joined #nim |
18:58:26 | * | beholders_eye quit (Ping timeout: 252 seconds) |
19:01:06 | FromDiscord | <guzba> re: multithreading, seems like it would be better to have people go ahead and make some mistakes and learn↵peeps gata learn somehow after all↵this does not apply to stdlib code or many workplace settings of course, but for personal projects or whatever, i dunno about the fear advice |
19:04:04 | Zevv | fair point, in the end you want people to learn and understand that stuff, true. My point is that people are just overconfident in this subject. |
19:04:50 | Zevv | you *should* be afraid. The problem is that threading in C and C++ is "just hard" as long as you keep to the basic rules |
19:05:05 | Zevv | like, only share date when writer and reader use the same lock |
19:05:14 | Zevv | but in nim, things still blow up in your face when you do that |
19:05:21 | Zevv | in Nim, it's harder than in C or C++ |
19:05:34 | Zevv | because ARC is really not helping here. |
19:06:04 | Zevv | you can do your best to protect your data, but who is protecting the ARC ref counters |
19:06:22 | Zevv | these are not atomics, but you can't put a lock around the RC ops, because these are injected by the nim compiler |
19:06:42 | Zevv | so write yourself some simple threaded code in nim. feel free to add some .gcsafe. pragmas as advised by the experts |
19:06:54 | Zevv | run it in helgrind or tsan, and then think about what is happening with these reference counters |
19:07:05 | Zevv | these are just solid old fashioned data races. |
19:07:41 | Zevv | with ORC it's even more fun because orc referenced data points back to a threadvar. So move your data between threads and expect a good time. |
19:07:57 | FromDiscord | <guzba> it is very true nim is another layer of stuff to think about, and that is assuming youre arc/orc, let alone the refc legacy right now |
19:10:33 | FromDiscord | <guzba> i dont really have any disagreement with the facts in the convo, just pointing out that the intent is probably not to stop people from experimenting with threads on their own↵its more about what to watch out for and perhaps dont go do that exploring at work where other ppl will experience pain from mistakes haha |
19:11:00 | Zevv | sure, I agree. |
19:12:22 | FromDiscord | <guzba> an example of a perhaps negative outcome of thread-fear is that instead we get in situations where tons of single-thread processes run on tiny vms that have to get orchestrated through k8s↵as opposed to one server with some threads handling tons of requests in parallel↵is the thread complexity worse than the sysadmin complexity? |
19:13:09 | Zevv | if the thread complexity leads to broken code, yes, it is worse |
19:13:42 | Zevv | because it is broken in undefined ways. It is literally undefined behavior. It works on machine A, it does not on machine B. It works on today, but not tomorrow. If it does not work, it can do so in very sneaky ways. |
19:14:14 | Zevv | it's not just throwing you a big SIGSEGV, because that would be obvious. It just adds up your bank balance wrong once every few months. |
19:14:26 | Zevv | then you run it in a debugger, and the problem goes away. |
19:15:22 | FromDiscord | <guzba> i propose not all uses of threads are equally complex or dangerous, and often the dangerous part can be handled by a tested dependency (where stdlib should be helping for example) |
19:16:31 | * | oddish quit (Ping timeout: 240 seconds) |
19:16:40 | FromDiscord | <guzba> its hard to argue against fear, but i would just say that it totally can be done |
19:16:43 | Zevv | which is exactly my point; use other - proven - primitives. |
19:16:59 | * | adigitoleo quit (Ping timeout: 268 seconds) |
19:17:25 | FromDiscord | <guzba> i am optimistic that nim 2.0 making --threads:on the default will improve the threading primitive situation |
19:17:27 | Zevv | anyway, everyone to it's own. I have found that with threading I'm generally just not smart enough to do it right without spending a humongous amount of mental effort. |
19:17:37 | FromDiscord | <guzba> defaults are powerful for sure |
19:17:47 | Zevv | the problem imho is that nim kind of lacks any sane threading model, still. |
19:17:58 | Zevv | the core team points to nim-lang/threading, which is proven broken. |
19:18:16 | Zevv | also, I do not have any proper solutions, so I don't have the right to whine about it of course |
19:18:32 | * | oddish joined #nim |
19:18:43 | FromDiscord | <guzba> In reply to @Zevv "also, I do not": totally respectable |
19:18:46 | * | adigitoleo joined #nim |
19:18:52 | Zevv | but the fact that ARC makes stuff even more fragile than when doing thigns with manual memory is not helping. |
19:19:14 | FromDiscord | <guzba> yes i have just manually managed memory in many cases internal to libs because arc/orc are not helpful at all in this context |
19:19:18 | FromDiscord | <guzba> so im onboard with the pain |
19:19:44 | Zevv | I briefly considered adopting the nim-lang/threading repo and clean it up and add a solid test suite, but I couldn't get myself to go there. |
19:20:25 | FromDiscord | <guzba> everything is difficult and in the end open source work needs to be for your own satisfaction so its np to just not feel like doing it imo |
19:21:20 | FromDiscord | <Andreas> In reply to @Zevv "but the fact that": hmm, good to know, how about trying lock-free concurrent-data-structures, memory-handling has to be done without any GC, so maybe arenas/pools or RCU or a combination of that.. |
19:22:43 | * | derpydoo quit (Ping timeout: 268 seconds) |
19:22:44 | Zevv | it's a pain to have to fall back to manual memory managent. IMHO nim needs an atomic RC type |
19:22:55 | Zevv | you can build those yourself but they will not act like a regular ref |
19:23:09 | Zevv | so you'll need to explicitly handle them |
19:23:16 | FromDiscord | <guzba> i agree there it would be very helpful to at least see a canonical example of one that really works |
19:23:19 | Zevv | you can't just assign and move and copy |
19:23:36 | Zevv | one what that really works? |
19:23:59 | FromDiscord | <guzba> an example of a atomic rc data type that uses nims arc/orc hooks |
19:24:26 | Zevv | https://github.com/zevv/actors/blob/master/actors/pool.nim#L83-L109 |
19:24:50 | Zevv | but using it is a pain because you have to deref[] it all the time |
19:25:02 | Zevv | but yeah, it works. |
19:25:24 | FromDiscord | <guzba> still useful to see even so |
19:25:25 | FromDiscord | <guzba> cool |
19:25:30 | Zevv | I should make a little generic wrapper for that instead of putting it there though |
19:27:32 | FromDiscord | <guzba> everything takes effort but a little repo with discussion of how it works and why it needs to be used a certain way could be a useful thing for people to link to and learn from↵ive always learned a lot from relatively focused examples and some good explanation of why |
19:28:07 | FromDiscord | <guzba> perhaps it will lead to improvements on ergonomics or something in addition to shared knowledge |
19:28:23 | Zevv | I feel it should be part of the language instead. |
19:29:09 | FromDiscord | <guzba> a good step toward that is a clear understandable 'what it is' for other folks maybe |
19:29:17 | Zevv | disruptek uses a fork of the default nim stdlib with only one change where the ARC rc value is an atomic. It solves so many problems. |
19:29:32 | Zevv | but yes, there is a performance penelty. |
19:29:38 | Zevv | pentaly |
19:29:57 | FromDiscord | <Andreas> In reply to @Zevv "pentaly": i thinks it petally |
19:30:13 | Zevv | penalty, damned |
19:31:10 | FromDiscord | <Gumbercules> I just manually manage memory when threads are involved |
19:31:12 | FromDiscord | <Gumbercules> it's not that bad |
19:31:22 | Zevv | then why use nim at all. |
19:31:25 | FromDiscord | <Gumbercules> But I understand the desire for things to "just work" and not to have to resort to that |
19:31:29 | Zevv | no seqs, no refs, no tables. |
19:31:37 | Zevv | no strings |
19:31:40 | Zevv | I might as well go back to C |
19:31:44 | FromDiscord | <Gumbercules> no I mean, I still use those |
19:31:51 | FromDiscord | <Gumbercules> I just don't use them in the context of multiple threads |
19:31:58 | Zevv | sure. |
19:32:14 | FromDiscord | <Andreas> In reply to @Zevv "no seqs, no refs,": no, just exclude the shared values from ARC/ORC and have them in a pool |
19:32:16 | FromDiscord | <Gumbercules> so like - if I need a data structure that is thread safe i'll write one and manually manage the memory |
19:32:24 | FromDiscord | <guzba> imo it is true that manual memory management at the thread boundary is often not a huge thing |
19:33:05 | Zevv | anyway, i'm ranting the same rant like an old man; Nim has no good story on how to do threading in 2023; my phone has 20 cores, and as a system language Nim has no solid and friendly way to utilize these. Other languages have gone a long way solving these problems. |
19:33:28 | Zevv | I do not want to *think* about threading. I have a compiler to do that work for me. |
19:33:30 | FromDiscord | <Gumbercules> well - we're in a much better place than when we only had the refc GC implementation at least |
19:33:41 | FromDiscord | <guzba> In reply to @Gumbercules "well - we're in": so much better |
19:33:44 | FromDiscord | <guzba> agreed |
19:33:50 | FromDiscord | <Gumbercules> but yeah - it's still not ideal by a long shot |
19:34:29 | FromDiscord | <Gumbercules> and I don't think it every will be unless Nim's adopts something like a borrow checker |
19:34:37 | FromDiscord | <guzba> this is why i want nim 2.0 so bad, even if it isnt a perfect thread solution, it is seriously enormously better than refc default today |
19:35:25 | Zevv | true; and stuff *can* be done with nim 2.0, but it is really a huge pain in the ass. |
19:35:33 | FromDiscord | <Gumbercules> (edit) "every" => "ever" |
19:35:44 | FromDiscord | <guzba> i guess im just happy a huge pain in the ass is way better than dont even bother |
19:35:46 | FromDiscord | <guzba> haha easy to please |
19:36:32 | FromDiscord | <guzba> i think after nim 2.0 stuff is out your ergonomics and compiler wants will become more of a focus in time, that is my estimation |
19:37:52 | Zevv | we'll see. I might be not well informed, but I feel that other than disruptek and me not many people have been going deep into multithreading on nim 2.0 yet. |
19:38:20 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Zevv "it's a pain to": What is atomic in this case? |
19:38:23 | Zevv | of course mratsim, but he is just doing manual memory |
19:38:27 | FromDiscord | <Gumbercules> I have been - but I also don't use ref counted memory with threads |
19:38:30 | FromDiscord | <Gumbercules> yeah - same |
19:38:45 | FromDiscord | <Elegantbeef> Zevv i'm still a bit confused how atomic RCs solve anything |
19:38:45 | Zevv | System64 ~ Flandre Scarlet: atomic, as in, the RC is an atomic int |
19:39:03 | Zevv | beef: the problem they solve is the nimDecRefLast and friends |
19:39:17 | FromDiscord | <Elegantbeef> Yes the ref count is now properly threadsafe, but if you mutate a tree it's still a race condition |
19:39:31 | FromDiscord | <Elegantbeef> Ok so it's purely just for ensuring the mm doesnt kick in |
19:39:35 | FromDiscord | <guzba> they solve the hand-off but not the other state problem |
19:39:55 | Zevv | well, not just "Does not kick in", it's worse because the RC value becomes undefined |
19:40:00 | * | rockcavera quit (Read error: Connection reset by peer) |
19:40:03 | Zevv | it can be too high or too low |
19:40:20 | FromDiscord | <Elegantbeef> I mean that's what i meant |
19:40:24 | FromDiscord | <guzba> i would imagine usually too high since it probably read-dec-write which would mean missing decs |
19:40:38 | Zevv | as for moving trees, that is also an unsolved one. I have this little macro that run time checks if a tree is isolated by peeking the RCs in front of the refs, but it's a dirty hack |
19:40:40 | * | rockcavera joined #nim |
19:40:40 | * | rockcavera quit (Changing host) |
19:40:40 | * | rockcavera joined #nim |
19:41:16 | Zevv | guzba: it doesn't matter if its' too highr o too low, it's just undefined. it's wrong either way. |
19:41:19 | FromDiscord | <firasuke> sequences vs tables for sequences of `string, seq[string]`? |
19:41:50 | FromDiscord | <guzba> In reply to @Zevv "<@318284269908918273>: it doesn't matter": its true, no disputing that, though i would take a memory leak over a double-free |
19:42:01 | Zevv | and then there is ORC, which happens to be the default mm and makes this not possible at all. |
19:42:12 | Zevv | with ORC, you simply can not move a ref. period. |
19:42:47 | FromDiscord | <guzba> if you tag acyclic it appears to accidentlly be move-able in 1.6.x |
19:42:57 | FromDiscord | <System64 ~ Flandre Scarlet> Moving a ref? |
19:43:03 | * | rockcavera quit (Read error: Connection reset by peer) |
19:43:07 | Zevv | move a ref to another thread. |
19:43:09 | FromDiscord | <guzba> `let b = move a` |
19:43:12 | FromDiscord | <guzba> or across threads |
19:43:15 | Zevv | yeah sure you can go annotate everything acyclic |
19:43:22 | Zevv | until you actually want to move cyclic data, right |
19:43:23 | FromDiscord | <System64 ~ Flandre Scarlet> It's useful |
19:43:36 | * | rockcavera joined #nim |
19:43:36 | * | rockcavera quit (Changing host) |
19:43:36 | * | rockcavera joined #nim |
19:47:06 | Zevv | one last thing and then I'll probably drop out: I don't think run time isolating a tree can be properly done at this time as well; I have this little macro that recursively traverses my type to check if nothing in that three gets reffed from elsewhere, but when I have an inherited object type that got converted to a parent type, there is no way for the macro to do that. So I don't think this can be made |
19:47:12 | Zevv | properly safe at this time. |
19:47:24 | * | Notxor joined #nim |
19:47:49 | FromDiscord | <Elegantbeef> Hmmm you might be able to with RTTI |
19:48:06 | FromDiscord | <guzba> it would seem that if traversing the tree is not an atomic operation itself it could be raced even if it could work |
19:48:38 | FromDiscord | <System64 ~ Flandre Scarlet> I have the feeling threading is always unsafe |
19:48:42 | FromDiscord | <Elegantbeef> Of course one needs to not mutate a tree whilst ensuring isolation |
19:48:45 | Zevv | the assumption is that the sender is the only one reffing anything at the time I check the isolation. The whole thing is built on assumptions. |
19:49:01 | Zevv | beef: how would that work with RTTI |
19:49:06 | FromDiscord | <Elegantbeef> Threading is pretty safe assuming you use `Channels` |
19:49:09 | Zevv | this is my - naive - impl: https://github.com/zevv/actors/blob/master/actors/isisolated.nim |
19:49:19 | FromDiscord | <Elegantbeef> Nim's RTTI does allow checking fields |
19:49:46 | Zevv | sure, but the problem is that I can have an inherited type that is converted to a parent type. |
19:50:06 | Zevv | so fieldpairs() will not do the right thing. |
19:50:14 | FromDiscord | <Elegantbeef> So you'd recurse the object checking ref count and keeping track of which ref's are ref'd |
19:50:27 | FromDiscord | <Elegantbeef> I didnt say field pairs |
19:50:28 | FromDiscord | <Elegantbeef> I said RTTI |
19:50:33 | Zevv | so how do I use that |
19:50:37 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/typeinfo.html |
19:50:39 | FromDiscord | <Elegantbeef> The typeinfo module that is hardly ever used |
19:50:51 | FromDiscord | <System64 ~ Flandre Scarlet> Not using threading would solve all problems |
19:50:52 | Zevv | I tried it a few times, but I was not having a good time. |
19:51:13 | Zevv | System64 ~ Flandre Scarlet: except for the problem of having 31 of my 32 cores sitting idle |
19:51:14 | FromDiscord | <Elegantbeef> Yea it's fully undocumented and i'm still uncertain if you can get the downcasted type |
19:51:22 | FromDiscord | <guzba> In reply to @System64 "Not using threading would": pass on that |
19:51:42 | FromDiscord | <Elegantbeef> Not having threading is fine when everyone is rocking a c64 |
19:51:45 | Zevv | beef: i'll look into the typeinfo, if I can find the courage |
19:51:45 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @guzba "pass on that": Wdym? |
19:52:05 | FromDiscord | <Elegantbeef> In theory it should work assuming you can get the downcasted type |
19:52:08 | * | xet7 quit (Quit: Leaving) |
19:52:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Zevv "System64 ~ Flandre Scarlet:": How to make it safe then? |
19:52:35 | Zevv | System64 ~ Flandre Scarlet: indeed, how to make it safe, excellent question |
19:52:35 | FromDiscord | <Elegantbeef> Channels, atomics, locks, manual memory management, .... |
19:53:04 | Zevv | personally, falling back to manual mm is not acceptable, PR wise |
19:53:05 | FromDiscord | <guzba> In reply to @System64 "Wdym?": i am using threads successfully in production right now with nim 1.6.10+ and its something i would not give up↵async is not ideal lets say, and many processes is just odd in its own way↵throwing out threads altogether is not a solution i accept is all |
19:53:09 | FromDiscord | <System64 ~ Flandre Scarlet> I guess Java is also unsafe at this level? |
19:53:20 | FromDiscord | <guzba> (edit) "In reply to @System64 "Wdym?": i am using threads successfully in production right now with nim 1.6.10+ and its something i would not give up↵async is not ideal lets say, and many ... processes" added "single-threaded" |
19:53:40 | Zevv | one selling point of nim 2.0 is that the heap is shared so memory can be moved. But in practice, this is not yet the cased. |
19:54:26 | FromDiscord | <guzba> it is the case, just with specific and very sharp caveats is maybe my slightly different perspective |
19:55:16 | Zevv | `move` implies refs. but refs are not safe to move. so I say, no, it is not |
19:55:34 | FromDiscord | <guzba> `move` string can be a huge deal, could be a many gig buffer |
19:55:42 | FromDiscord | <guzba> same for seq etc |
19:55:46 | Zevv | `move` anything can be a huge deal. |
19:56:00 | FromDiscord | <guzba> refs + cyclic does work, with the same kind of assumptions mentioned for isolation |
19:56:06 | FromDiscord | <guzba> (edit) "cyclic" => "acyclic" |
19:56:09 | FromDiscord | <guzba> acyclic |
19:56:40 | Zevv | how do you move a acyclic ref without violating the RC data race |
19:58:10 | Zevv | (it *can* be done) |
19:58:20 | FromDiscord | <guzba> in my experimenting if a ref object has only one owner on one thread, you can move it to another thread |
19:58:28 | FromDiscord | <Elegantbeef> Moving the root should all that needs to be done |
19:58:31 | FromDiscord | <guzba> yeah |
19:59:40 | Zevv | sure, it can be done, I do it as well. but it's just too finicky. I think we all agree, right :) |
20:00:00 | FromDiscord | <guzba> yes im not at all trying to dispute the finickyness haha |
20:00:00 | FromDiscord | <Elegantbeef> I do not thread pretty much ever so no clue |
20:00:27 | Zevv | good man. |
20:00:32 | FromDiscord | <guzba> half-full vs half-empty perspective. i see what i have now and am pleased (move + shared heap), you see what we should have and are less pleased lol |
20:00:46 | Zevv | i'm a whiner by nature. |
20:00:50 | FromDiscord | <guzba> perhaps 10% full 90% empty |
20:00:51 | FromDiscord | <guzba> to be fair |
20:00:53 | FromDiscord | <guzba> lolol |
20:01:03 | FromDiscord | <guzba> ah its not that bad |
20:01:08 | Zevv | also, I have done multithreading in different languages and tasted the fruit of what is possible |
20:01:31 | FromDiscord | <System64 ~ Flandre Scarlet> I'll have to do a game server and seems I'll have to use threading |
20:02:18 | FromDiscord | <guzba> async is the much more popular choice today for networking without threading, unless you to offload work to threads↵so maybe you will not need threads at all |
20:02:29 | FromDiscord | <guzba> (edit) "async is the much more popular choice today for networking without threading, unless you ... to" added "need" |
20:02:44 | Zevv | I am a firm believer in the actor model and in FP, because both these concepts are very good of hiding all the gory details of threading and offer seamles paralellism |
20:02:53 | FromDiscord | <Gumbercules> In reply to @Zevv "also, I have done": languages that have the performance characteristics of Nim? |
20:03:16 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @guzba "async is the much": Problem is when you need to run multiple instances of the server |
20:03:18 | * | xet7 joined #nim |
20:03:27 | Zevv | ponylang comes a long way, but the 12 different ref and pointer types and conversion rules do hurt my brain. |
20:04:02 | FromDiscord | <guzba> In reply to @System64 "Problem is when you": yeah, its the single-thread + many vm/process versus threads thing, well certainly i hope you find a solution that is productive when you work on that |
20:04:12 | Zevv | and given the number of cores in recent hardware, I'd happily give up 50% of my language performance if I can actually utulize these extra cores without effort. |
20:05:21 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @guzba "yeah, its the single-thread": There is 2 approaches↵1) multithread (UNSAFE! risk of Segmentation fault core dumped)↵2) one thread, servers are updated one by one |
20:05:22 | FromDiscord | <Gumbercules> I just don't think everyone is in the same boat |
20:05:42 | Zevv | anyway, I think with my actors experiment, which is basically CPS on top of N threads, I have proven for myself that things could be possible with nim. Performance is very reasonable, overhead is low. |
20:07:34 | Zevv | but ergonomics is lacking |
20:07:38 | FromDiscord | <guzba> In reply to @System64 "There is 2 approaches": if you are not pretty familiar with threads, i do think you'll have less pain with the option 2, especially if youre writing a game which is just so much work as it is↵however option 1 is viable if youre willing to fight for it and maybe age a decade for it |
20:08:00 | Zevv | doing the FUD thing yourself now eh :) |
20:08:15 | FromDiscord | <guzba> i never said you were wrong 😇 |
20:08:25 | FromDiscord | <guzba> just being a counterpint |
20:08:29 | FromDiscord | <guzba> (edit) "counterpint" => "counterpoint" |
20:15:27 | FromDiscord | <IsaacPaul> I think you can also use https://github.com/mratsim/weave with a scope? |
20:15:50 | Zevv | sure, weave is doing just fine, but it's just doing manual memory |
20:15:56 | Zevv | no refs for you, just pointer |
20:16:22 | FromDiscord | <IsaacPaul> Meh I accidentally sent that because my arm moved against the corner enter key :< |
20:16:54 | FromDiscord | <IsaacPaul> It was something I wrote a few hours ago 😅 |
20:20:01 | * | fallback joined #nim |
20:21:41 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @guzba "if you are not": But I need a database too, common to all instances↵And all instances are in different ports and listen for packets |
20:45:12 | * | def- quit (Quit: -) |
20:45:56 | * | def- joined #nim |
20:48:59 | * | fallback quit (Read error: Connection reset by peer) |
20:55:30 | * | rockcavera quit (Read error: Connection reset by peer) |
20:55:50 | * | rockcavera joined #nim |
20:55:51 | * | rockcavera quit (Changing host) |
20:55:51 | * | rockcavera joined #nim |
20:57:02 | FromDiscord | <guzba> In reply to @System64 "But I need a": using async+await to do database queries is doable, see nim's redis lib or various postgres sync wrappers↵instances on diff ports listening is all async-able too↵not saying async is correct for you, just that it is an option if youre not eager to use threads↵i personally like threading but this is after many years of working with them in several languages, maybe i have stockholm syndrome or some |
20:57:14 | FromDiscord | <guzba> (edit) "sync" => "async" |
21:01:34 | FromDiscord | <QuiteQuietQ> talking about Nim 2.0, is it going to have better error messages? |
21:07:14 | * | advesperacit quit () |
21:09:39 | FromDiscord | <Elegantbeef> No it's practically no different |
21:10:18 | * | def- quit (Quit: -) |
21:10:33 | * | def- joined #nim |
21:13:19 | * | fallback joined #nim |
21:21:28 | FromDiscord | <QuiteQuietQ> is there s plan to have them in the future? or is there someone working on it? |
21:22:25 | FromDiscord | <Elegantbeef> "PRs welcome" |
21:23:51 | FromDiscord | <Elegantbeef> There have been some changes to errors like the mismatch error |
21:27:56 | FromDiscord | <QuiteQuietQ> cool, maybe I will get to it one day, if I will get to like Nim |
21:28:09 | FromDiscord | <QuiteQuietQ> at the moment, I am not sure if I want to use it or no |
21:32:48 | FromDiscord | <Elegantbeef> It's pretty nice |
21:43:07 | FromDiscord | <QuiteQuietQ> it is, but what does not click for me is the use of composite data types like arrays, tuple (anonymous/named), sets and tables, and conversion between them.. the way to do feels inconsistent |
21:43:35 | FromDiscord | <QuiteQuietQ> also, I have to get used to using way to much syntactic sugar |
21:43:48 | FromDiscord | <Elegantbeef> You do not have to |
21:44:01 | FromDiscord | <Elegantbeef> I do not follow the conversion issue |
21:56:01 | FromDiscord | <QuiteQuietQ> sent a code paste, see https://play.nim-lang.org/#ix=4rDL |
21:56:36 | FromDiscord | <QuiteQuietQ> when Nim offers simplified syntax without the need to write parenthesis, why it is safer in this case? |
21:56:40 | FromDiscord | <Elegantbeef> Style insensitivity is what you're talking about first |
21:57:31 | FromDiscord | <QuiteQuietQ> ah, so the thing where `o.f()` and `f(o)` is the same... first argument resolution? or sth like that |
21:58:02 | FromDiscord | <Elegantbeef> This is a bug |
21:58:12 | FromDiscord | <Elegantbeef> Atleast afaik this is a bug |
21:58:21 | FromDiscord | <QuiteQuietQ> aha lol |
21:58:41 | FromDiscord | <Elegantbeef> `longString.splitLines().pairs` should likely call the `iterator` and error in all cases |
21:58:44 | FromDiscord | <QuiteQuietQ> all four are supposed to work? |
21:58:51 | FromDiscord | <Elegantbeef> They all should error if you ask me |
21:59:08 | FromDiscord | <Elegantbeef> `splitLines` is an iterator there is no `pairs` for it |
21:59:26 | FromDiscord | <Elegantbeef> Though this is a limitation of the method call syntax |
22:02:32 | FromDiscord | <QuiteQuietQ> that is the thing, it gets modified during compilation somehow↵e.g. `a.f(b)` is converted to `f(a, b)` right? so the parenthesis have to break it |
22:02:52 | FromDiscord | <Elegantbeef> Yes that's how it works |
22:03:39 | FromDiscord | <Elegantbeef> `splitLines` is an iterator though |
22:03:43 | FromDiscord | <Elegantbeef> That's the problem here |
22:04:09 | FromDiscord | <Elegantbeef> really you never should use `pairs` imo and just use `std/enumerate` so it's `for i, line in enumerate longstring.splitlines:` |
22:05:25 | FromDiscord | <Elegantbeef> This is a problem with iterators in general though |
22:05:43 | FromDiscord | <Elegantbeef> You cannot make a iterator that takes a inline iterator |
22:09:19 | FromDiscord | <QuiteQuietQ> hm, there is also `func splitLines` I guess that is used outside of for loops |
22:09:32 | FromDiscord | <Elegantbeef> Yep |
22:09:53 | FromDiscord | <spoon> W, A, S, D, are constants defined in naylib, the code compiles, but nimlsp keeps yelling at me https://media.discordapp.net/attachments/371759389889003532/1088585436626170076/image.png |
22:09:57 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @guzba "using async+await to do": Btw, does Nim have libs for MariaDB/MySQL or SQLite? |
22:10:23 | FromDiscord | <spoon> In reply to @System64 "Btw, does Nim have": they're in standard library |
22:10:54 | FromDiscord | <spoon> https://nim-lang.org/docs/db_mysql.html↵https://nim-lang.org/docs/db_sqlite.html |
22:11:09 | FromDiscord | <System64 ~ Flandre Scarlet> Oh very good! |
22:11:41 | FromDiscord | <System64 ~ Flandre Scarlet> The stdlib will always impress me, it's so huge! |
22:12:18 | FromDiscord | <Nilts> Can i set a var to nil or should i just use options |
22:12:35 | FromDiscord | <QuiteQuietQ> In reply to @Elegantbeef "really you never should": that is another problem for me -- to many basic things "hidden" behind imports↵importing `sequtils`, `strutils`, `strformat`, `tables` in every file gets annoying↵and decrypting an error message when you forget to import something, but still use a proc from there, is frustrating |
22:12:54 | FromDiscord | <Elegantbeef> Sure but the same thing happens in any other system language |
22:13:10 | FromDiscord | <Elegantbeef> If you do not import a library how is the language supposed to know a symbol exists somewhere |
22:13:13 | FromDiscord | <QuiteQuietQ> why wouldn't the utils and formats for strings be available directly, when strings already are? same for sequences |
22:14:16 | FromDiscord | <QuiteQuietQ> i mean the difference between accessible things with and without imports↵there is quite a lot accessible without imports, but such things are not much usable for bigger problems |
22:15:45 | FromDiscord | <QuiteQuietQ> i thinking mainly composite data types.. |
22:16:03 | FromDiscord | <QuiteQuietQ> tables from `std/tables` could be accessible without import |
22:16:12 | FromDiscord | <QuiteQuietQ> that would be nice |
22:16:30 | FromDiscord | <spoon> i mean, same with c where you have to import `string.h` before calling strlen |
22:16:43 | FromDiscord | <QuiteQuietQ> unless it means compiling to many unnecessary code |
22:17:04 | FromDiscord | <spoon> i do like languages that stay out of your way without having to worry about inputs though |
22:17:15 | FromDiscord | <spoon> (edit) "inputs" => "imports" |
22:17:56 | FromDiscord | <spoon> i know nim strips the unused functions from the binary, hm |
22:18:38 | FromDiscord | <Elegantbeef> Which it does↵(@QuiteQuietQ) |
22:18:57 | FromDiscord | <Elegantbeef> Importing a module causes the compiler to parse and semantically analyse libraries |
22:19:21 | FromDiscord | <Elegantbeef> Also Nim is a system language, so it does not import everything, just as Rust, Odin, Zig, C, C++ doesnt |
22:19:51 | FromDiscord | <Elegantbeef> Say you have a specialised `tables` module that you prefer for whatever reason now you cannot call it `Table` |
22:19:51 | FromDiscord | <QuiteQuietQ> got it, and Araq said that compilation time is important to him |
22:20:06 | FromDiscord | <spoon> i will credit rust though, they have a ton of stuff available out of the box, but its compilation time sucks lol |
22:20:41 | FromDiscord | <QuiteQuietQ> In reply to @spoon "i will credit rust": hm, good point |
22:20:59 | FromDiscord | <Elegantbeef> It's not even compile time |
22:21:40 | FromDiscord | <QuiteQuietQ> In reply to @Elegantbeef "Also Nim is a": how does Nim's garbage collector comes into this? it is included in a binary? |
22:22:07 | FromDiscord | <Elegantbeef> You can manually allocate if you want, it doesnt force you to use it |
22:22:08 | FromDiscord | <QuiteQuietQ> (probably dumb question) |
22:22:28 | FromDiscord | <Elegantbeef> The GC is enabled for builtin dynamically allocated types |
22:22:35 | FromDiscord | <Elegantbeef> For Arc/Orc it's just inserted calls of `=destroy` |
22:26:53 | FromDiscord | <QuiteQuietQ> so in the final program there is no GC running? just cleverly inserted `=destroy` calls? |
22:27:34 | FromDiscord | <Elegantbeef> Orc has a cycle collector |
22:27:36 | FromDiscord | <Elegantbeef> But `arc` doesnt |
22:28:46 | FromDiscord | <PunchCake> orc is just better tbh |
22:28:56 | FromDiscord | <PunchCake> cycle collector that isnt stop the world |
22:30:59 | * | fallback quit (Quit: IRCNow and Forever!) |
22:31:29 | FromDiscord | <QuiteQuietQ> 'a' in arc is for automatic, atomic or acyclic? |
22:31:37 | FromDiscord | <QuiteQuietQ> and what is orc abbreviation? |
22:31:38 | FromDiscord | <Elegantbeef> atomic |
22:31:50 | FromDiscord | <Elegantbeef> O represents a cycle |
22:32:16 | FromDiscord | <QuiteQuietQ> 😄 |
22:33:46 | FromDiscord | <spoon> isn't nim arc's whole thing not atomic? `Some people mistake Nim’s ARC for Swift’s ARC, but there is one big difference: ARC in Nim doesn’t use atomic RC.` |
22:34:22 | FromDiscord | <spoon> taken from https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html |
22:34:26 | FromDiscord | <Elegantbeef> Indeed |
22:38:37 | FromDiscord | <QuiteQuietQ> so is it atomic or no? |
22:38:47 | FromDiscord | <QuiteQuietQ> i'm confused now |
22:38:54 | FromDiscord | <Elegantbeef> No |
22:39:21 | FromDiscord | <Elegantbeef> It's not a atomic reference count, it's just an automatic ref count |
22:41:49 | FromDiscord | <spoon> telling you, just rename it DARC to avoid confusion and have a cool buzzword for marketing |
22:41:55 | FromDiscord | <spoon> :-) |
23:05:01 | FromDiscord | <Nilts> How would i make a throttled function? Preferably using the nim js utils. |
23:23:44 | * | fallback joined #nim |
23:30:47 | * | azimut quit (Ping timeout: 255 seconds) |
23:38:26 | FromDiscord | <Gumbercules> In reply to @not logged in "How would i make": Are you referring to rate limiting? |
23:38:48 | FromDiscord | <Gumbercules> Or just only being able to call a procedure every so often? |
23:39:34 | FromDiscord | <Gumbercules> If it's the latter - just use some global state to track how many times it's been invoked within whatever window you prefer |
23:40:11 | FromDiscord | <Gumbercules> Or a variable in the procedure with a global pragma |
23:41:07 | FromDiscord | <Nilts> In reply to @Gumbercules "Are you referring to": like this except in nim: https://www.geeksforgeeks.org/javascript-throttling/ |
23:42:12 | FromDiscord | <Gumbercules> I mean - the code is right there then |
23:42:27 | FromDiscord | <Gumbercules> Just port it to Nim 😃 |
23:42:48 | FromDiscord | <Gumbercules> It should look very similar |
23:43:00 | * | Notxor quit (Remote host closed the connection) |
23:45:26 | FromDiscord | <QuiteQuietQ> how do you schedule a proc call in Nim without blocking the rest of a program? |
23:47:23 | FromDiscord | <Gumbercules> You can use async or threads for concurrency |
23:48:02 | * | azimut joined #nim |