<< 01-06-2023 >>

00:01:00FromDiscord<Elegantbeef> Are you using `--debugger:native`?
00:05:35FromDiscord<michaelb.eth> In reply to @Elegantbeef "Are you using `--debugger:native`?": hmm, let's see
00:06:07FromDiscord<michaelb.eth> yes
00:09:47*cedb joined #nim
00:10:36cedbim browsing nimble and clicking on the "command line" link raises a jester excetion https://nimble.directory/search?query=command%20line
00:10:54cedbnamely: key not found: klymene
00:43:51*lucasta joined #nim
01:17:13FromDiscord<kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4xda
01:17:30FromDiscord<Elegantbeef> Same as a comma just more explciit
01:17:53FromDiscord<kcvinker> Oh I see. Thank you 🙂
01:26:57FromDiscord<sOkam!> i got an issue. i need to pass a `group of Type[T]` generics to a function, but the types are not homogeneous and their quanity unknown (although known at compile time) 😔 ↵is there any way around this?
01:27:18FromDiscord<Elegantbeef> I use a tuple in this case
01:27:29FromDiscord<Elegantbeef> You can use `macro` with `varargs[typed]` aswell
01:27:49FromDiscord<juan_carlos> `;` split types, so `func f(a,b:int)` is ok, but `func f(a;b:int)` is not ok.
01:27:52FromDiscord<sOkam!> can a tuple be variable type?
01:27:57FromDiscord<sOkam!> (edit) "type?" => "size?"
01:28:20FromDiscord<Elegantbeef> `proc doThing(t: tuple)`
01:28:40FromDiscord<sOkam!> oh so it literally matches any tuple
01:28:41FromDiscord<Elegantbeef> `doThing (10, 20); doThing (10, )`
01:28:50FromDiscord<Elegantbeef> You can use a concept if you want to constrain it
01:28:55FromDiscord<Elegantbeef> I use a macro for my ECS and UI
01:29:35FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/master/yeacs.nim#L10-L29↵https://github.com/beef331/gooey/blob/master/src/gooey.nim#L57-L71
01:29:38FromDiscord<Elegantbeef> For inspiration
01:30:02FromDiscord<Elegantbeef> Whoops concept
01:30:05FromDiscord<Elegantbeef> Brain fart there
01:30:21FromDiscord<Elegantbeef> Tuples are the varadic generics of Nim in my opinion
01:30:28FromDiscord<Elegantbeef> They're quite lovely mechanisms for generic code
01:31:25FromDiscord<sOkam!> its a good way to look at them
01:32:23FromDiscord<sOkam!> how would you pass the tuple when its an input to a function?
01:32:32FromDiscord<sOkam!> and the inputs are generic?
01:32:43FromDiscord<Elegantbeef> What?
01:32:45FromDiscord<sOkam!> getting lost in the silly details, as usual 😦
01:33:13FromDiscord<Elegantbeef> If you want to expand the tuple and pass each field to a procedure you need a macro
01:33:24FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xdc
01:33:35FromDiscord<Elegantbeef> `proc thing(data: YourTupleConcept)`
01:33:42FromDiscord<sOkam!> sent a code paste, see https://paste.rs/OehS8
01:33:49FromDiscord<Elegantbeef> `for field in data.fields`
01:34:44FromDiscord<sOkam!> oh each element of the tuple is a field? kk
02:01:35*lucasta quit (Ping timeout: 250 seconds)
02:29:21FromDiscord<Prestige> Can we not cast a cstring to a string?
02:29:34FromDiscord<Elegantbeef> Nope C strings are not pascal string
02:29:38FromDiscord<Elegantbeef> it requires `$myCstring`
02:30:00FromDiscord<Prestige> Ah ty
02:53:21*Batzy joined #nim
05:18:38*oldpcuser joined #nim
05:49:53*ntat joined #nim
05:58:14*derpydoo joined #nim
06:46:10*PMunch joined #nim
06:51:18*rockcavera quit (Remote host closed the connection)
07:01:44*ntat quit (Quit: Leaving)
07:15:36*ntat joined #nim
07:19:26PMunchMan using a language without a proper `for x in y` syntax is surprisingly tedious
07:20:40FromDiscord<Rika> Which language are you using without such
07:20:51FromDiscord<Rika> God bless you if it’s C
07:21:45PMunchRight now it's JavaScript
07:22:07FromDiscord<Rika> Doesn’t that have proper syntax for what you mentioned
07:22:14PMunchNot that I've found
07:22:36PMunchIt has `for (var x in y)`, but with crazy semantics
07:22:48PMunchWhat do you think x would be for an array for example?
07:22:49FromDiscord<Rika> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators ?
07:23:32PMunchAaaah, `for .. of`...
07:23:40PMunchWell that's annoying
07:24:36FromDiscord<Rika> Lol
07:25:15PMunchI thought it was weird that it was missing something like that
07:25:24FromDiscord<Rika> That’s what happens when one has crazy semantics but everyone’s already using it
07:25:46PMunchI googled `for...in` and tried that, but it gives you the indexes..
07:25:56FromDiscord<Elegantbeef> I cannot wait for C's attempt at these for loops in C29
07:26:44FromDiscord<Elegantbeef> "We decided that we need to do proper for loops so what we've done is allow `for i, somePtr` with an optional length that'll yield that many elements"
07:27:15FromDiscord<Elegantbeef> `for(i, myCstring, 2){}` totally sensible 😄
07:28:38PMunchWait really?
07:29:04FromDiscord<Elegantbeef> Shit C29 was recent enough for that to be believable
07:29:17FromDiscord<Elegantbeef> C79?
07:29:26PMunchHaha, now it just sounds old again
07:29:26FromDiscord<Elegantbeef> C2099?
07:30:01FromDiscord<Elegantbeef> This is the issue of just using the tens and ones place for any versioning, if you last 100 years you need a new scheme
07:30:17FromDiscord<Elegantbeef> C99v2 coming out in 77 years
07:32:28PMunchI mean you don't even need to be around for 100 years. Sorting breaks as soon as you cross the rounding point
07:32:53FromDiscord<Elegantbeef> Well that means 51 years 😛
07:32:59FromDiscord<Elegantbeef> I rounded to 100
07:33:10FromDiscord<Elegantbeef> It's an error percentage acceptable somewhere
07:33:42PMunchOh I just meant that if you started a project in 1995 it would be silly to just use 95 because it would wrap in five years
07:34:01FromDiscord<Elegantbeef> Oh i see
07:34:02PMunchNot rounding, more like a wraparound I guess
07:34:16FromDiscord<Elegantbeef> But if you start it in 2001 you're good for 100 years
07:34:25PMunchTrue
07:34:40PMunchQuick, start some projects before we get too far into the century :P
07:34:48FromDiscord<mratsim> In reply to @Elegantbeef "But if you start": 2031 bug coming soon
07:34:49FromDiscord<chmod222> That's why I'm a fan of Pi-Versioning, for every new version you add a new digit of Pi
07:34:55FromDiscord<chmod222> You'll never run out of decimals
07:36:56PMunchHaha, version numbers quickly grow large though :P
07:37:09FromDiscord<Elegantbeef> Nah they're approximately the same value
07:39:14FromDiscord<Rika> Grow large in textual length
07:39:34FromDiscord<Elegantbeef> I cannot believe you needed to clarify
07:39:38PMunchHaha, I can only imagine some poorly implemented package manager trying to compare versions with a float and messing up due to floating point inaccuracy
07:40:06FromDiscord<Elegantbeef> More likely is using a float32 instead of a 128bit float
07:40:15FromDiscord<chmod222> It's all fun and games until you cannot install version 3.0000000004
07:40:34FromDiscord<Elegantbeef> Sorry I agree with engineers Pi is 4
08:23:43FromDiscord<Rika> In reply to @Elegantbeef "I cannot believe you": I didn’t realise it was you because the bridge stopped showing avatars
08:24:01FromDiscord<Rika> Thought it was some random dude
08:24:08FromDiscord<Rika> Then again, what else are you
08:26:21FromDiscord<chmod222> Aren't we all but random dudes and dudettes in the grand scheme of the universe
08:47:54*Szahid joined #nim
08:48:00SzahidHello
08:49:08FromDiscord<Elegantbeef> Hello
08:51:31*m5zs7k quit (Ping timeout: 240 seconds)
08:52:07*m5zs7k joined #nim
08:53:48PMunchSzahid, good day
08:59:58FromDiscord<Elegantbeef> Always fun to see "Please enter a valid email" when typing in your email in a form. Always makes me see how spec conforming the valid email checker is
09:00:25FromDiscord<Elegantbeef> How dare this site not allow `name@[192.168.0.1]` syntax
09:00:29PMunchDo you have a very non-standard email?
09:00:31PMunchAh :P
09:01:28FromDiscord<Elegantbeef> Hey they brought it on themselves telling me the first part of my email isnt valid, of course it's not valid i'm still typing!
09:05:18FromDiscord<chmod222> Anyone who doesn't just do `if '@' in email: sendVerification(email)` is doing it wrong tbh
09:05:48FromDiscord<chmod222> Trying to do it the "right" way is an act of futility
09:06:05FromDiscord<Elegantbeef> If you're going to lexically validate an email copy the grammar and implement it properly, do not use that horrid regex that exists 😄
09:06:25FromDiscord<Elegantbeef> Otherwise yea `@` is sufficient
09:07:15FromDiscord<chmod222> You're going to want to verify that the user can receive emails on that email either way, so you may as well let the mail server do all that annoying stuff
09:08:44SzahidIs nim ready for production ?
09:08:55PMunchSzahid, definitely
09:09:09PMunchI've used it in production myself
09:09:26SzahidBest editor? VSC?
09:09:48PMunchYou'd probably need to use an e-mail specific input sanitizer though, and hope that your mailing library handles weird e-mails correctly
09:10:19PMunchSzahid, personally I use Vim, but VSC is amongst the community favourites
09:12:11FromDiscord<chmod222> I use a mixture of nvim and vsc depending on how I feel that day
09:14:27FromDiscord<Elegantbeef> There is a mild benefit of giving a diagnostic to the user
09:14:34FromDiscord<Elegantbeef> But yea it's best to leave it to mail server
09:29:11FromDiscord<Marcus> neovim ❤️
09:35:34FromDiscord<ricky> In reply to @chmod222 "Aren't we all but": :nimRawr:
10:40:19*beholders_eye joined #nim
11:16:45*Szahid quit (Remote host closed the connection)
11:17:02*Szahid joined #nim
11:17:02*Szahid quit (Changing host)
11:17:02*Szahid joined #nim
12:07:22FromDiscord<least antisemitic pole> is there a trick for really slow nimsuggest responses when there are staticReads involved?
12:08:56PMunchMaybe a when switch and some dummy data?
12:09:10PMunchDepends on what those staticReads are for
13:56:26*rockcavera joined #nim
14:00:58*Szahid quit (Remote host closed the connection)
14:08:27FromDiscord<acek7> i remember a few of you
14:15:38*PMunch quit (Quit: Leaving)
14:16:49FromDiscord<pmunch> Remember us, from when?
14:20:27FromDiscord<acek7> i was in here like last year i think
14:32:40*ntat quit (Quit: Leaving)
14:33:42NimEventerNew post on r/nim by qtless: HappyX First Major Release 🎉, see https://reddit.com/r/nim/comments/13xj5b1/happyx_first_major_release/
15:16:28FromDiscord<Gumbercules> In reply to @acek7 "i was in here": would have been way cooler if you had said you were a time traveler from the future
15:16:47FromDiscord<acek7> im not that smart
15:18:11FromDiscord<Gumbercules> maybe future you is
15:18:14FromDiscord<Gumbercules> or past you
15:18:19FromDiscord<Gumbercules> 🤷
15:24:20FromDiscord<emanresu3> sent a code paste, see https://paste.rs/WgPkX
15:25:13FromDiscord<emanresu3> sent a long message, see http://ix.io/4xfP
15:27:33FromDiscord<emanresu3> sent a code paste, see https://play.nim-lang.org/#ix=4xfS
15:27:50FromDiscord<juan_carlos> In reply to @emanresu3 "hey nimsters, do you": `{.inject.}` ?
15:33:52*derpydoo quit (Ping timeout: 248 seconds)
15:37:15FromDiscord<emanresu3> sent a code paste, see https://play.nim-lang.org/#ix=4xfX
15:38:32FromDiscord<emanresu3> sent a code paste, see https://paste.rs/cZWMq
15:48:18FromDiscord<Rika> i dont see why x should be declared in the else clause
15:48:56FromDiscord<kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4xg7
15:49:01FromDiscord<Rika> ref only, ptr not
15:49:17FromDiscord<kcvinker> Thank you @Rika
15:49:35FromDiscord<kcvinker> How do you convert a `ref Foo` to a `Foo`
15:51:35FromDiscord<Rika> dereference with `varname[]` the `[]`
15:51:59FromDiscord<kcvinker> Okay
15:53:23FromDiscord<emanresu3> not just in the else clause, but also is not available in an enclosing scope, and of course with a more complex example↵(@Rika)
15:55:35FromDiscord<Rika> In reply to @emanresu3 "not just in the": this cannot be done with the macro you propose, nor do i think it can be done with a macro that doesnt enclose the whole if/else statement or replace the `if` part of the statemetn
15:58:31*derpydoo joined #nim
16:15:14FromDiscord<acek7> I remember Rika too
16:23:40FromDiscord<sOkam!> is there no `mfields( t :tuple )` ? 🤔
16:24:23FromDiscord<sOkam!> I can find fields, pairs and fieldpairs, but not mfields https://nim-lang.org/docs/iterators.html#fields.i%2CS%2CT
16:28:06FromDiscord<sOkam!> In reply to @Elegantbeef "`for field in data.fields`": is there a way to do this, but modifiable, for when the input to the function is a `var tuple`?
16:36:55FromDiscord<chmod222> Alright, a style question this time\: The functions I'm binding ocasionally start with an underscore, i.e. `_get_rpc_config`. Nim is super against this and I have to remap these somehow. Is there an established naming convention?
16:38:49NimEventerNew thread by void09: Need suggestions for time scheduling async tasks, see https://forum.nim-lang.org/t/10238
16:39:22FromDiscord<sOkam!> In reply to @chmod222 "Alright, a style question": storing them in a `private.nim` module that only gets imported and not exported
16:39:39FromDiscord<sOkam!> c2nim renames them with `private_blabla` prefix
16:40:36FromDiscord<chmod222> Currently I'm naming them `prot_` because they tended to be "protected" functions, but I find that confusing
16:42:49FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xgo
16:43:02FromDiscord<Graveflo> In reply to @chmod222 "Currently I'm naming them": did you look at how futhark does it?
16:43:07FromDiscord<chmod222> I like that idea
16:43:13FromDiscord<chmod222> I did not, no
16:44:00FromDiscord<chmod222> internal\_, okay
16:44:00FromDiscord<chmod222> Equally valid idea
16:44:23FromDiscord<chmod222> For godot `_blah` mostly means it's a virtual function that the user overrides
16:45:24FromDiscord<sOkam!> i would personally get rid of the `_` for virtuals. its just silly even in gdscript, when _ prefix always means private everywhere else
16:45:47FromDiscord<chmod222> So the user has to define them either way and hiding them in an internal module is not 100% feasible
16:46:01FromDiscord<chmod222> I fear just removing the \_ will cause name clashes
16:46:09FromDiscord<chmod222> Actually, I'm fairly sure it does
16:46:25FromDiscord<sOkam!> yeah, for the expected virtuals the private syntax doesn't make sense, because that's not what godot means for the _virtuals
16:46:34FromDiscord<sOkam!> (edit) "_virtuals" => "them"
16:46:36FromDiscord<juan_carlos> The mode _ you add the more private it is.
16:47:11FromDiscord<chmod222> \_\_\_\_ the government can't read this message?
16:47:14FromDiscord<juan_carlos> (edit) "mode" => "more"
16:47:23FromDiscord<juan_carlos> `func()` for real privacy.
16:47:24FromDiscord<sOkam!> In reply to @chmod222 "I fear just removing": are you storing each class in a separate nim module? that would get rid of all of those
16:48:00FromDiscord<chmod222> Yes I am, but I believe I had a class defined a `_get_something` and `get_something`↵(@sOkam!)
16:48:04*jmdaemon joined #nim
16:48:14FromDiscord<sOkam!> ic
16:48:16FromDiscord<chmod222> I think removing the underscore was my first idea
16:48:22FromDiscord<chmod222> I'll test again just to be sure
16:48:48FromDiscord<chmod222> Otherwise I may just go `virtual_`
16:49:06FromDiscord<chmod222> That's going to be annoying when it comes to runtime dispatch
16:49:20FromDiscord<sOkam!> why not `v_`?
16:49:45FromDiscord<sOkam!> if virtuals are meant to be overloaded and used... they will get ugly real fast with the virtual full word
16:50:00FromDiscord<sOkam!> or just add them to the ones that clash only, maybe, if they are not too many 🤔
16:51:57FromDiscord<chmod222> Right, let's generate the worlds longest `import ./...` statement and see what explodes
16:59:05NimEventerNew thread by lou15b: What is the meaning of () after an enumeration symbol?, see https://forum.nim-lang.org/t/10239
17:09:08FromDiscord<acek7> So whats the state of NIM since ive last been here
17:12:12FromDiscord<Andreas> Is it `{.experimental: "Package level objects".}` or `{.experimental: "PackageLevelObjects".}` or else ? has anybody tried this ?
17:12:54*derpydoo quit (Quit: derpydoo)
17:13:37FromDiscord<Andreas> (edit) "?" => "?↵`Error: unknown experimental feature` ??"
17:18:09FromDiscord<demotomohiro> In reply to @acek7 "So whats the state": https://github.com/nim-lang/Nim/tree/devel/changelogs
17:19:21FromDiscord<acek7> whys all this stuff just go up to like 2018
17:32:59FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4xgI
17:33:45FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4xgJ
17:33:50FromDiscord<Chronos [She/Her]> No more strformat but still confusing
17:48:14FromDiscord<sOkam!> sent a code paste, see https://paste.rs/eeEfT
17:49:37FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4xgM" => "https://play.nim-lang.org/#ix=4xgL"
17:49:52FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4xgL" => "https://play.nim-lang.org/#ix=4xgN"
17:50:55FromDiscord<sOkam!> that way you just have to go to the source code of the function, copy the names, and substitute like this
17:51:19FromDiscord<sOkam!> its not noticeable when the input count is low, but when it gets unwieldly like this it becomes extremely useful
17:55:08*ntat joined #nim
18:08:05FromDiscord<chmod222> Turns out a lot of things exploded because of my old friend\: cyclic dependencies
18:08:19FromDiscord<chmod222> Once again I have broken the cycle, but for how long
18:08:34*derpydoo joined #nim
18:11:44*beholders_eye quit (Ping timeout: 248 seconds)
18:14:08*jmdaemon quit (Ping timeout: 240 seconds)
18:16:09FromDiscord<jmgomez> ouch, cycles are tough. I think I told you but I end up doing an algo that calculates then and move the problematic types to a common file that everyone's pulls
18:16:24FromDiscord<jmgomez> (edit) "then" => "them"
18:17:52FromDiscord<chmod222> I have something similar going on, I have have my own "baby's first dependency solver" so dependant classes import what they need only, and all type definitions are separated from their proc definitions because the proc definitions would import from all over the place
18:18:23FromDiscord<chmod222> The issue is mostly internal stuff because of the dreaded "You need the builtins to fetch the builtins" problem
18:19:07FromDiscord<chmod222> It's fine now though, and recompiling 900 classes every few minutes really makes me appreciate Nim's speed
18:19:24FromDiscord<chmod222> godot-cpp takes around 10 minutes unless I give it all my cores
18:20:41FromDiscord<jmgomez> nice, how big are the bindings nows?
18:22:01FromDiscord<chmod222> In terms of feature completeness, dry size or everything generated?
18:22:12FromDiscord<jmgomez> I end up creating an indirection layer on top that does an importc over the bindings itself. Comp times were reduced to 2 secs for 150k lines of code (oc bindings are way large than that) but tha'ts kinda the minimum
18:22:24FromDiscord<jmgomez> generated LoC
18:22:38FromDiscord<jmgomez> which is what will slow down the Nim compiler itself
18:24:47FromDiscord<chmod222> Naive calculation is about 92.7k LoC
18:25:04FromDiscord<chmod222> On top of that is some considerable on-compile macro expansion
18:25:28FromDiscord<chmod222> My test code has a build time of 0.7 seconds with -d\:danger
18:26:51FromDiscord<jmgomez> sounds roughly the same considering different setups
18:27:48FromDiscord<sOkam!> In reply to @chmod222 "My test code has": is the test code small, or also big?
18:28:47FromDiscord<chmod222> Its a typical "How do you use this library"-type deal, it basically defines a custom type and some methods, touches a few builtins and core classes and for fun calls itself through Godot
18:30:02FromDiscord<chmod222> If someone were to use the lib to quickly build a native plugin to speed up some algorithm, it'd likely be a realistic time
18:30:26FromDiscord<chmod222> Of course it goes up the more engine classes you import, that's where the bulk of the code is
18:30:50FromDiscord<sOkam!> a friend was getting 15s compiletime with the gdnative godot-nim bindings, for a 30k sloc project
18:31:27FromDiscord<sOkam!> that's why i was asking, in case it could be comparable
18:31:53FromDiscord<sOkam!> In reply to @chmod222 "Of course it goes": yeah makes senses
18:32:14FromDiscord<chmod222> I'm sure I could tickle out more time by not focussing so much on a "nice" API, you can likely speed it up a lot if you just not expand so many macros and do more during bindgen
18:32:31FromDiscord<chmod222> Until it's a problem, this works quite well though
18:39:53FromDiscord<guttural666> Token being an object, will this override be picked reliably to stringify Token? or how does the resolution work? https://media.discordapp.net/attachments/371759389889003532/1113899737054183554/image.png
18:43:36*beholders_eye joined #nim
18:44:42FromDiscord<Graveflo> might want to make it public so it can be used in templates and generics, but besides that it'll work how you expect
18:45:03FromDiscord<Graveflo> just have to make sure it's imported when in a different module
18:46:12FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xhg
18:46:22*ntat quit (Quit: Leaving)
18:46:40FromDiscord<guttural666> sure sure, and I just read "Ambiguous calls are reported as errors." in the tutorial, so the compiler will complain
18:48:47FromDiscord<guttural666> have to test this
18:49:42*jmdaemon joined #nim
19:01:46FromDiscord<Graveflo> is there a function similar to `Table`s `repr` but for seq? One that will how the allocated space as well as the contents?
19:21:46FromDiscord<guttural666> In reply to @guttural666 "Token being an object,": circling back to this: this works, but I am not sure exactly why, I suspect that the $ for a generic object in the standard is less specific than my override, which actually specifies the type, maybe some pro can confirm this
19:23:05FromDiscord<Rika> yes
19:23:26FromDiscord<guttural666> In reply to @Graveflo "is there a function": I think the English of that last sentence is a bit confusing, but this should work fine for seqs: https://nim-lang.org/docs/system.html#repr%2CT
19:25:45FromDiscord<guttural666> knowing the bytes of that resulting string is a bit more tricky I think, since the string type I am pretty confident has a pointer indirection to the actual data, so getting size_of or whatever the thing to get the bytes is, will give you len + cap + data_ptr which should just be 3 64 bit
19:26:58FromDiscord<guttural666> looked at this problem couple weeks that, think you would need to rip open the internals of string et al and recursively add up the actual memory size
19:27:43FromDiscord<guttural666> (edit) "knowing the bytes of that resulting string is a bit more tricky I think, since the string type I am pretty confident has a pointer indirection to the actual data, so getting size_of or whatever the thing to get the bytes is, will give you len + cap + data_ptr which should just be 3 64 bit ... " added "(or 2 32 bit for the ints and 64 bit for the ptr?)"
19:34:54FromDiscord<Graveflo> i just meant "show" instead of "how". Im trying to test a couple things about seq related to the above but its hard to do when the data isnt all that transparent and I cant find procs that show it either
19:36:02*xet7 joined #nim
19:37:57FromDiscord<Rika> capacity is hidden without casting
19:38:16FromDiscord<Rika> otherwise repr shows data pointer + data, length is trivial to retrieve
19:38:24FromDiscord<Graveflo> yea i was in the process of trying to figure out the offsets
19:39:32FromDiscord<guttural666> In reply to @Rika "otherwise repr shows data": 'd be nice to have something that expands all the pointers and gives you the full memory cost of a thing (stack + heap, the whole deal)
19:39:51FromDiscord<guttural666> think that is what Flo wants
19:41:36FromDiscord<Elegantbeef> Consider a cyclical graph you cannot calculate the full cost at `O(1)`
19:51:04*aftalavera joined #nim
19:51:28aftalaverahello\
19:53:05FromDiscord<chmod222> A full build of all classes, which pretty much reference all builtin types, takes 29.82 seconds. Rebuilding it without changing anything takes 18.73 seconds. It's a very naive test where I just import literally every class with its procs into one .nim file and let it rip, but that's about 90kLoC↵(@sOkam!)
19:54:05FromDiscord<chmod222> Takes only 730 MiB of RAM as well
19:55:11FromDiscord<guttural666> to pass in a read only non-copying slice to a proc I need this, correct? https://media.discordapp.net/attachments/371759389889003532/1113918688773546056/image.png
19:55:37*jmdaemon quit (Ping timeout: 240 seconds)
19:56:24FromDiscord<chmod222> And actually, it turns out I can actually stip my leading `_` prefix without any name clashes
19:57:54FromDiscord<sOkam!> In reply to @chmod222 "A full build of": makes sense. kk ty ✍️
19:58:32FromDiscord<chmod222> Well then, back to making virtual methods work
19:58:35FromDiscord<sOkam!> In reply to @chmod222 "And actually, it turns": dope
19:58:35FromDiscord<chmod222> That'll be fun
19:59:21FromDiscord<chmod222> Only that, properties and signals and by then I'll have pretty much every big feature covered and can start the much funner task of finding all the edge cases
20:01:01FromDiscord<chmod222> You mean in order to avoid copying the seq despite it only being read?↵(@guttural666)
20:01:05FromDiscord<chmod222> var'll work
20:01:27FromDiscord<guttural666> In reply to @chmod222 "You mean in order": exactly
20:01:51FromDiscord<chmod222> I believe nim is smart enough not to copy it if you pass it without `var` as well
20:02:14FromDiscord<chmod222> And if you don't need it to be a seq specifically inside the function, you can accept `openArray[Token]`
20:02:36FromDiscord<guttural666> In reply to @chmod222 "I believe nim is": maybe, but not gonna depend on that, although var is a bit ambiguous here (not actually mutating)
20:02:58FromDiscord<chmod222> I miss `constvar` or something, sometimes
20:03:07FromDiscord<guttural666> In reply to @chmod222 "And if you don't": I had that before, but I think that will also copy?
20:03:18FromDiscord<guttural666> In reply to @chmod222 "I miss `constvar` or": where is that from?
20:03:38FromDiscord<chmod222> I don't actually know if it will copy, I suspect it will not
20:03:56FromDiscord<guttural666> In reply to @chmod222 "I don't actually know": unsure why it would not behave just like a const seq
20:03:58FromDiscord<chmod222> My brain, it's not a Nim feature
20:04:10FromDiscord<chmod222> Pascal has `constref`, C and C++ have `const `
20:04:19FromDiscord<chmod222> I wish Nim had something like it
20:04:45FromDiscord<chmod222> But the idiom is to just pass it as `T` and let Nim worry about what's happening behind the scenes
20:04:53FromDiscord<chmod222> I'm just paranoid
20:04:58FromDiscord<guttural666> In reply to @chmod222 "Pascal has `constref`, C": was always a bit confused about that, doesn't const allow the underlying memory to be mutated but not the ptr?
20:05:42FromDiscord<chmod222> All C defines in that regard is that it's undefined behaviour (of course) to go ahead and mutate it anyways
20:05:46FromDiscord<guttural666> (edit) "In reply to @chmod222 "Pascal has `constref`, C": was always a bit confused about that, doesn't const allow the underlying memory to be mutated but not the ptr? ... " added "(meaning the int64)"
20:06:11FromDiscord<chmod222> It won't allow you to modify it through a `const ` but it will allow you to unconst it
20:06:29FromDiscord<chmod222> And `const` applies to the referant, not the reference
20:06:40FromDiscord<guttural666> god, C is terrible
20:06:44FromDiscord<chmod222> Unless it's `const const T` in C++
20:06:51FromDiscord<chmod222> In that case both are const
20:07:05FromDiscord<guttural666> In reply to @chmod222 "Unless it's `const *const": that is actually better 😄
20:07:11FromDiscord<guttural666> (edit) "In reply to @chmod222 "Unless it's `const *const": that is actually better 😄 ... " added "(makes sense)"
20:07:26FromDiscord<guttural666> is that specific to C++? didn't even know that
20:08:25FromDiscord<chmod222> I think C does it as well but I mostly see it in C++ because C developers are very relaxed when it comes to constness
20:08:31FromDiscord<chmod222> But it's been a long time since I wrote naked C
20:08:41FromDiscord<chmod222> I lost most of my language lawyer certifications for it
20:09:15*rockcavera quit (Ping timeout: 250 seconds)
20:10:24FromDiscord<chmod222> Between Nim and Zig I find surprisingly little use for C aside from it's ABI
20:11:37FromDiscord<guttural666> I'm just a caveman, but I think C is technically obsolete with Zig, literally no reason to choose it for new projects
20:12:04FromDiscord<chmod222> Zig really take C behind the woodshed, true
20:13:37*xet7 quit (Quit: Leaving)
20:13:44FromDiscord<guttural666> everybody adheres to C ABI, which is a fine enough standard, but other than that, just a choice between cock and ball torture and something considerably nicer
20:13:48FromDiscord<sOkam!> C is much simpler to learn and use, though
20:14:01FromDiscord<guttural666> than Zig? I dunno
20:14:09FromDiscord<sOkam!> although I agree that zig is better, but C is much simpler to learn
20:14:15FromDiscord<chmod222> But learning all the pitfalls is where it falls apart
20:14:19FromDiscord<chmod222> Because C has all of the pitfalls
20:14:23FromDiscord<sOkam!> I know C, and cant wrap my head around zig
20:14:33FromDiscord<chmod222> It's only simple if you don't care about them
20:14:39FromDiscord<sOkam!> that is true, all of which zig solves pretty much
20:14:53*rockcavera joined #nim
20:14:53*rockcavera quit (Changing host)
20:14:53*rockcavera joined #nim
20:15:42FromDiscord<chmod222> It's just kind of bullshit that the compiler can go "Oh I see you overflowed a signed integer here, don't mind if I assume that the next 100 lines of code thus literally can not happen and can be optimized out"
20:16:53FromDiscord<guttural666> compilers acting like they don't have a clue, so awesome
20:20:18FromDiscord<chmod222> Zig at least has the decency of crashing your program with a panic if you trigger undef
20:20:35FromDiscord<Elegantbeef> Openarrays are slices
20:20:36FromDiscord<Elegantbeef> They do not copy
20:20:43FromDiscord<Elegantbeef> That's one reason for their existence
20:20:51FromDiscord<Elegantbeef> Plus `proc doThing(s: seq[string])` doesnt copy
20:21:19FromDiscord<Elegantbeef> The data is not copied atleast the pointer and len probably are
20:22:27FromDiscord<chmod222> Are they properly copy on write as well?
20:22:35FromDiscord<Elegantbeef> Nope
20:22:55FromDiscord<Elegantbeef> Only the literals using arc/orc are copy on write
20:23:12FromDiscord<Elegantbeef> Copy on write for primitives in a system language seems like the exact wrong way of doing things
20:23:32FromDiscord<Elegantbeef> inb4 "But heap allocated types are not primitives"
20:24:06FromDiscord<chmod222> Everything is a primitive if you sit high enough in the system
20:26:30FromDiscord<chmod222> The use of "properly" was not intended to mean "The way it's supposed to be" though, rather the distinction between "shallow copy in this case" vs "shallow copy in the general case unless modified"
20:27:22FromDiscord<chmod222> I'm neutral towards CoW, although I prefer it being obvious and not an implementation detail
20:30:25FromDiscord<Elegantbeef> Well remember you're passing an immutable value in this case
20:30:25FromDiscord<Elegantbeef> So you cannot mutate it
20:30:25FromDiscord<Elegantbeef> Well safely
20:34:55FromDiscord<guttural666> would you rather pick an openArray then to just read a slice or a var seq?
20:35:34FromDiscord<chmod222> I'd go `openArray` for these cases, because the function really doesn't care about it being a `seq` or an array
20:35:36FromDiscord<guttural666> I am tracking the last tokens that I read and want to pass those to the generator to read through those and generate corrected code from them
20:36:03FromDiscord<guttural666> well, I have no arrays, because the source code could be 100k likes per file, dunno
20:39:08FromDiscord<guttural666> the compiler thinks my version is less suitable than the generic one here though 😦 proc to_string it is I guess
20:39:10FromDiscord<guttural666> https://media.discordapp.net/attachments/371759389889003532/1113929756824567870/image.png
20:39:49FromDiscord<Elegantbeef> What?
20:41:39FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/cE3FY
20:41:45FromDiscord<guttural666> compiler chooses a the generic $ for an openArray of object instead of my version
20:42:07FromDiscord<Elegantbeef> I can assure you that's not likely
20:42:09FromDiscord<Elegantbeef> If it did it's a bug
20:42:29FromDiscord<guttural666> LSP says so, testing
20:42:32FromDiscord<Elegantbeef> Nim's overload dispatch means that the most specific is chosen `openArray[int]` \> `openArray`
20:46:44FromDiscord<guttural666> yeah, LSP was right, mine is not chosen↵this should do my thing https://media.discordapp.net/attachments/371759389889003532/1113931656601030717/image.png https://media.discordapp.net/attachments/371759389889003532/1113931657033027584/image.png
20:47:01FromDiscord<Elegantbeef> `[start..to]` isnt an openarray
20:47:03FromDiscord<Elegantbeef> So of course it's not choosing yours
20:47:42FromDiscord<chmod222> It's unintuitive, but seq[...] is another seq
20:47:43FromDiscord<Elegantbeef> `seq[T]` is preferred to `openArray[T]` since `openArray[T]` requires a conversion
20:48:02FromDiscord<guttural666> though .. was a slice
20:48:15FromDiscord<Elegantbeef> It is a slice, but a copied slice
20:48:19FromDiscord<guttural666> damnit
20:48:23FromDiscord<Elegantbeef> Which is required since Nim doesnt have a borrow checker
20:48:31FromDiscord<Elegantbeef> `toOpenArray` is a slice that's not copieid
20:48:42FromDiscord<Elegantbeef> But this isnt very ergonomic cause you cannot store it in a parameter
20:48:45FromDiscord<Elegantbeef> It must be consumed directly
20:48:46FromDiscord<guttural666> that is what I need then
20:49:15FromDiscord<guttural666> I just need a non-copied, read only section of a seq
20:49:29FromDiscord<Elegantbeef> Right
20:50:31FromDiscord<guttural666> can I apply toOpenArray to anything that calls my proc? isn't that a thing?
20:51:08FromDiscord<guttural666> like the vararg thing, where it applies $ to all the args?
20:51:28FromDiscord<Elegantbeef> No
20:51:46FromDiscord<guttural666> just gonna template it then
20:52:02FromDiscord<Elegantbeef> Just make an overload that takes in a `seq`
20:52:10FromDiscord<Elegantbeef> I'm quite confused what you're doing
20:53:09FromDiscord<guttural666> I have potentially 1000s of sequences that my lexer read, I want to pass in the most recent ones that constitute a statement in my language that I want to correct and pass it to the code generator to give me the fixed version of that as a string
20:53:37FromDiscord<guttural666> so I just need to read the last say 10 tokens from that list and spit out the corrected version of the code that they represent
20:53:47FromDiscord<guttural666> (edit) "sequences" => "tokens"
20:53:58FromDiscord<Elegantbeef> Ok so why do you need a template?
20:54:45FromDiscord<guttural666> oh, sorry, the $ overload was just for printing a slice of the tokens
20:55:05FromDiscord<guttural666> well both need to just read a couple tokens
20:55:17FromDiscord<guttural666> both stringifying and reading some for code gen
20:55:45FromDiscord<guttural666> thought of a template just to hide the toOpenArray stuff
20:56:09FromDiscord<Elegantbeef> Procedures and iterators exist
21:03:22FromDiscord<Ayy Lmao> What's the best way to run an iterator in reverse? I'm assuming you can't avoid collecting it first.
21:03:35FromDiscord<Elegantbeef> Depends on the iterator
21:03:46FromDiscord<Elegantbeef> The best case is to write your own `reversed` version
21:03:50FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4xhJ
21:04:26FromDiscord<guttural666> this works and will do for now, thanks for the input https://media.discordapp.net/attachments/371759389889003532/1113936108313657535/image.png
21:04:56FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/MQkiv
21:05:29FromDiscord<Ayy Lmao> The problem with `cmp(y.zIndex, x.zIndex)` is that if the z index is the same it doesn't reverse the order properly.
21:11:38FromDiscord<guttural666> In reply to @guttural666 "this works and will": actually passing in a slice to a var seq is de way, reads/modifies in place just as I wanted
21:11:53FromDiscord<Elegantbeef> What?
21:12:05FromDiscord<Elegantbeef> you can write a `var openArray[T]`
21:13:39FromDiscord<Elegantbeef> That'd take a mutable slice or a mutable seq
21:14:17FromDiscord<guttural666> wouldn't a var seq do the same?
21:14:50FromDiscord<guttural666> seems to
21:15:07FromDiscord<Elegantbeef> No a var seq cannot take a `mySeq.toOpenArray(3, 5)`
21:15:08FromDiscord<Elegantbeef> It only can take a `var seq`
21:15:11FromDiscord<Elegantbeef> If you do not need to add to collection use `var openArray[T]` otherwise use a sequence
21:15:59FromDiscord<guttural666> no, a var seq should be able to take a lex.tokens[1..3] and be able to mutate and read in place no?
21:16:08FromDiscord<guttural666> and that should be what I want
21:17:20FromDiscord<Elegantbeef> Well now you're just lying to me
21:17:27FromDiscord<guttural666> just constructs a new seq with len = 3, cap = whatever, data = pointer to the data in my sequence
21:17:47FromDiscord<Elegantbeef> No it will not
21:17:55FromDiscord<Elegantbeef> `lex.tokens[1..3]` is a immutable seq
21:18:20FromDiscord<Elegantbeef> you want `toOpenArray` to mutate it in place
21:18:25FromDiscord<Elegantbeef> Why do people argue with me about this
21:18:30FromDiscord<guttural666> don't want to mutate it, just read it
21:18:40FromDiscord<Elegantbeef> So then drop the `var`
21:19:01FromDiscord<guttural666> that would be a copy constructor of a new seq, would it not
21:19:17FromDiscord<Elegantbeef> The fuck is a copy constructor
21:19:32FromDiscord<guttural666> 😄 literally malloc the space for 3 ints and do a whole new seq for the proc
21:19:42FromDiscord<guttural666> copy all those 3 bad boys to another place
21:20:24FromDiscord<Elegantbeef> `[1..3]` allocates a new sequence
21:20:37FromDiscord<Elegantbeef> So if you want to avoid allocating USE TOOPENARRAY
21:22:27NimEventerNew Nimble package! shio - A quick media server in nim, see https://github.com/arashi-software/shio
21:31:19*derpydoo quit (Quit: derpydoo)
21:31:35FromDiscord<acek7> So im attempting to use nim with raylib
21:34:01FromDiscord<Chronos [She/Her]> In reply to @sOkam! "<@909883978717204561> I found this": I just don't get what the error even means
21:39:25FromDiscord<sOkam!> In reply to @Hourglass, When the Hour Strikes "I just don't get": it means that the function you are calling is either missing parameters and returning an ambiguous type, or something else related to solving the return type of that newApp function. that's why I recommended to revisit the entire function input setup with proper not-implied names, so you can track what you are missing
21:40:14FromDiscord<sOkam!> something somewhere is giving ambiguous types, wherever that is
21:42:00FromDiscord<guttural666> In reply to @Elegantbeef "So if you want": you're def. right on this https://play.nim-lang.org/#ix=4xhQ
21:42:39FromDiscord<Elegantbeef> If only I didnt enable `toOpenArray` in the VM and make `std/parseutils` and `std/unicode` use openArray 😛
21:50:24FromDiscord<guttural666> a slice always produces an immutable copy is that correct
21:50:43FromDiscord<Elegantbeef> Not if you store it into a mutable variable
21:51:39FromDiscord<guttural666> yeah
21:53:18FromDiscord<Graveflo> sent a long message, see http://ix.io/4xhS
21:53:58FromDiscord<Elegantbeef> capacity is stored on the inside of the `seq` len
21:54:22FromDiscord<Elegantbeef> `(len, ptr -> (capacity, data))`
21:55:10FromDiscord<Elegantbeef> Atleast with arc/roc
21:55:18FromDiscord<Elegantbeef> whops orc\
21:55:31FromDiscord<Elegantbeef> With refc I think it's `ptr -> (len, capacity, data)`
21:56:11FromDiscord<Graveflo> ok. I must have missed that looking on both sides of the pointer. I also might not be using arc for this testing since I'm not explicitly passing to cli
21:57:22aftalaveraHow is Nim tranction?
21:57:37aftalavera*traction
21:58:27FromDiscord<Elegantbeef> It doesnt have tires
21:58:44FromDiscord<Graveflo> In reply to @Elegantbeef "`(len, ptr -> (capacity,": wow ok now I see it. Thanks I was losing my mind
21:59:29FromDiscord<Elegantbeef> Believe it or not but sequences are implemented in Nim code
21:59:56FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/lib/system/seqs_v2.nim↵https://github.com/nim-lang/Nim/blob/devel/lib/system/strs_v2.nim
22:08:51FromDiscord<guttural666> you were right all along @ElegantBeef
22:09:06FromDiscord<Elegantbeef> Don't say that it'll go right to my non existent ego
22:09:51FromDiscord<guttural666> 🤣
22:15:03FromDiscord<guttural666> I get caught up in these details too much, though I really like understanding everything in detail
22:15:35FromDiscord<Chronos [She/Her]> In reply to @sOkam! "it means that the": Ah alright, thanks!
22:17:12FromDiscord<kcvinker> How do you get the sctring from a `char` ?
22:17:20FromDiscord<kcvinker> (edit) "sctring" => "string"
22:17:31FromDiscord<Elegantbeef> `$`
22:17:47FromDiscord<kcvinker> Oh I see. Thank you. Let me check.
22:18:41FromDiscord<kcvinker> Well that didn't worked.
22:19:00FromDiscord<Elegantbeef> `cstring` -\> `string` uses `$`
22:19:11FromDiscord<kcvinker> This is a char pointer
22:19:30*oldpcdude joined #nim
22:19:33FromDiscord<kcvinker> Do I need to do the pointer arithmetic here ?
22:19:34FromDiscord<Elegantbeef> `cstring` is the proper name for a `ptr char` that is null terminated
22:19:47FromDiscord<kcvinker> Oh I see
22:20:14*oldpcdude quit (Max SendQ exceeded)
22:20:36FromDiscord<kcvinker> Worked. Thank you ElegantBeef
22:21:37FromDiscord<Graveflo> In reply to @Elegantbeef "Believe it or not": I can believe it alright, I just couldn't find the code off the bat. So thanks
22:22:10*oldpcuser quit (Ping timeout: 265 seconds)
22:22:11FromDiscord<Elegantbeef> Hey i was just mocking you for using silly logic to attempt to figure out the implementation!
22:22:31FromDiscord<PunchCake> stop mocking pepole
22:22:36FromDiscord<Elegantbeef> No
22:22:36FromDiscord<PunchCake> its 20202023 bro
22:22:43FromDiscord<Elegantbeef> Right
22:22:49FromDiscord<Graveflo> hey ya it is
22:22:52*oldpcuser joined #nim
22:22:56FromDiscord<PunchCake> anyways how've you been elegantbeef long time no see
22:23:01FromDiscord<Elegantbeef> That means humans have had billions of years to get a grasp with being mocked
22:23:13FromDiscord<Elegantbeef> The same as always, a pain in everyone else's ass
22:23:24FromDiscord<PunchCake> i can relate my man
22:24:39FromDiscord<PunchCake> bro why does matrix show your client and os?
22:28:46FromDiscord<PunchCake> as a user with a finite amount of ram in my machine i like electron apps
22:42:28FromDiscord<guttural666> iterators are crazy powerful
22:42:40FromDiscord<PunchCake> foreal
23:04:57*def- quit (Quit: -)
23:06:10*def- joined #nim
23:13:52*madprops quit (Ping timeout: 250 seconds)
23:14:55*madprops joined #nim
23:14:56*madprops quit (Changing host)
23:14:56*madprops joined #nim
23:15:00*oldpcdude joined #nim
23:15:10*Amun-Ra quit (Ping timeout: 250 seconds)
23:15:35*jmdaemon joined #nim
23:17:07*oldpcuser quit (Ping timeout: 240 seconds)
23:20:11*oldpcdude is now known as oldpcuser
23:29:01*beholders_eye quit (Ping timeout: 250 seconds)
23:29:09*Amun-Ra joined #nim
23:44:09aftalaveraThis freaking Nim sounds too good to be true
23:44:16aftalaverafor real
23:44:23FromDiscord<Elegantbeef> Some say it doesnt exist
23:44:39aftalaveraIts so expressive...
23:58:29*oldpcuser quit (Ping timeout: 250 seconds)