<< 13-05-2024 >>

00:01:48*lucasta quit (Quit: Leaving)
00:06:06*gst quit (Ping timeout: 250 seconds)
00:09:57*def- quit (Quit: -)
00:15:47FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=loeGMPgX
00:22:15FromDiscord<Elegantbeef> Yea the word `lerp`
00:22:20FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=meAZJaWO
00:22:32FromDiscord<Elegantbeef> Linear interpolation
00:22:45FromDiscord<Elegantbeef> It mixes two values together by `t`
00:22:54FromDiscord<Elegantbeef> `0.5` is exactly inbetween and draw the rest of the owl
00:28:09*def- joined #nim
00:29:44*rez quit (Quit: much snoozes...)
00:33:05*rez joined #nim
00:40:51FromDiscord<maxtachine> In reply to @polylokh_39446 "when you pass ": Damn ty, I'll try later👍
00:46:11FromDiscord<Robyn [She/Her]> Ah
00:48:49FromDiscord<that_dude.> I thought operators only go up to binary
00:57:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=xZfOrcIm
01:10:52NimEventerNew Nimble package! nudates - Some useful tools when working with dates., see https://github.com/GeK2K/nudates
01:24:04FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=WnrWoeDT
01:25:03FromDiscord<Elegantbeef> Please don't use operators
01:25:36FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Please don't use operators": even for binary ops?
01:26:23*lucasta joined #nim
01:27:31FromDiscord<Elegantbeef> Unless they're mathematical types
01:27:47FromDiscord<Elegantbeef> Arbitrary operators are hard to read and not as intuitive as `a.lerp(b, t)`
01:38:25*def- quit (Quit: -)
01:39:59*def- joined #nim
01:40:05FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Unless they're mathematical types": This can work for numbers
01:56:54FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=BfVGLLqo
01:57:44FromDiscord<maxtachine> does anyone know how I could read a file that is used by another usermode process?
01:58:12FromDiscord<maxtachine> I was trying to read it using mapped files
01:58:21FromDiscord<maxtachine> but got an error on MapViewOfFile
02:00:19FromDiscord<System64 ~ Flandre Scarlet> https://math.stackexchange.com/questions/748883/is-there-any-shorthand-notation-for-linear-interpolation↵Seems you have ``a[p,q]`` and ``a<p,q>``↵I wonder if you can have this notation in Nim
02:01:02FromDiscord<System64 ~ Flandre Scarlet> (edit) "Nim" => "Nim, or something like this"
02:01:35FromDiscord<System64 ~ Flandre Scarlet> like [a, b]: t for exemple
02:11:16FromDiscord<Elegantbeef> Damn it @System64 ~ Flandre Scarlet don't encourage unreadable code 😄
02:15:04*beholders_eye quit (Ping timeout: 268 seconds)
02:39:15FromDiscord<kots> sent a code paste, see https://play.nim-lang.org/#pasty=AEjIseYM
02:39:16FromDiscord<kots> But don't do it
02:58:11*FromDiscord quit (Remote host closed the connection)
02:58:24*FromDiscord joined #nim
03:19:44*lucasta quit (Remote host closed the connection)
03:55:54FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#pasty=UVZWCvbt
04:31:56*def- quit (Quit: -)
04:32:08*def- joined #nim
04:36:12NimEventerNew Nimble package! dira - git profile manager, see https://github.com/tdely/dira
04:40:56*sadome joined #nim
04:40:56*sadome quit (Excess Flood)
04:41:30*sadome joined #nim
04:41:30*sadome quit (Excess Flood)
04:42:40*sadome joined #nim
04:42:40*sadome quit (Excess Flood)
04:43:35*sadome joined #nim
04:43:35*sadome quit (Excess Flood)
04:47:10*sadome joined #nim
04:47:10*sadome quit (Excess Flood)
04:47:51*sadome joined #nim
04:47:51*sadome quit (Excess Flood)
05:06:16FromDiscord<morgan> how can i get a var float from a ptr uncheckedarray float?
05:06:29FromDiscord<Elegantbeef> `arr[ind][]`
05:07:18FromDiscord<morgan> oh i misread the error message, it was adding a f32 to f64 conversion for me
05:07:30FromDiscord<morgan> and complained that the converted float was immutable
05:08:19FromDiscord<morgan> i guess ill create a var copy of the value before passing it in and handle conversion afterwards
05:11:09FromDiscord<morgan> the api provides two arrays (well arrays of arrays), one for f32 and one for f64, and you gotta check if f64 is nil before using it because only f32 has to be there (im not actually sure if it has to provide that if it provides f64)
05:18:24*cadberry joined #nim
05:19:41*cadberry quit (Client Quit)
05:37:32FromDiscord<madonuko> if there some kind of way in a macro to check if I'm at the top level↵trying to do something like "export this symbol unless I can't export this" (which happens when I'm not at the top level)
05:44:51FromDiscord<pusewicz> I've got an object type, and I want one of the properties to be auto-incremented when an object gets created, how do I implement that?
05:45:23FromDiscord<Elegantbeef> Make a constructor procedure that is `proc init(_: typedesc[T], ...): T`
05:49:40FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/wiki/Code-snippets#check-if-top-level @madonuko
05:50:46FromDiscord<madonuko> damn ok
06:02:04*Mister_Magister quit (Excess Flood)
06:02:31*Mister_Magister joined #nim
06:05:20*rockcavera quit (Remote host closed the connection)
06:08:29FromDiscord<pusewicz> In reply to @Elegantbeef "Make a constructor procedure": Is this an answer to my question?
06:08:35FromDiscord<Elegantbeef> Yes
06:09:01FromDiscord<pusewicz> Might need some more help explaining this, as I'm new to Nim.
06:09:30FromDiscord<Elegantbeef> Well the above format is the best way to define a constructor as it allows more code reuse
06:09:44FromDiscord<Elegantbeef> You can just do `proc initMyType(...): MyType = ....`
06:09:50FromDiscord<Elegantbeef> But that does not work with generics
06:10:25FromDiscord<Elegantbeef> Otherwise you just define a procedure that increments a counter and returns the value
06:10:46FromDiscord<pusewicz> But how do I define the variable to store it. I imagine it has to be some kind of a static variable.
06:11:02FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=vbWEEKfa
06:11:17FromDiscord<Elegantbeef> You can either use `{.global.}` or just use a top level variable
06:11:45FromDiscord<Elegantbeef> Then you now do `MyType.init()` instead of `MyType()` everywhere
06:12:28FromDiscord<pusewicz> sent a code paste, see https://play.nim-lang.org/#pasty=rfLbVPgB
06:12:50FromDiscord<pusewicz> Oh, `inc` does not return the value
06:13:14FromDiscord<pusewicz> So gotta assign and call `inc` in another line.
06:14:07*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
06:14:30*SchweinDeBurg joined #nim
06:15:37FromDiscord<Elegantbeef> `result = Cell(x: x, y: y, tiles: tiles)`
06:15:37FromDiscord<Elegantbeef> Also should do `tiles: sink seq[Tile]` so you can avoid some compies
06:16:04FromDiscord<Elegantbeef> Also also `neighbours can just be a `array[Direction, seq[Cell]\`
06:16:10FromDiscord<Elegantbeef> Whoops
06:16:22FromDiscord<Elegantbeef> Also also also `ref Cell` is redundant unless you want two pointers
06:16:49FromDiscord<pusewicz> Well it was complaining about illegal recursion
06:16:53FromDiscord<pusewicz> if there was no ref
06:16:53FromDiscord<Elegantbeef> Finally I you should do `proc new(_: typedesc[Cell], ...): Cell` if you want to be more generic friendly, but that's between you and your god
06:17:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=pSssCEJO
06:18:07FromDiscord<Elegantbeef> Are you sure you did not have `Cell = object` and then tried that
06:21:28FromDiscord<Elegantbeef> Someone clearly regrets asking their question 😄
06:21:57FromDiscord<pusewicz> Hmmm, seems to work with `array`
06:22:05FromDiscord<Elegantbeef> Will work with table aswell
06:22:28FromDiscord<pusewicz> Thanks so much, I gotta go and digest all the tips you provided haha
06:22:58FromDiscord<Elegantbeef> The issue is the default expression as far as I can tell
06:23:24FromDiscord<pusewicz> so how should `newCell` look like then? Or should I call it `new`?
06:23:43FromDiscord<Elegantbeef> But good thing that `Table[enum, T]` is a bad idea in Nim since we have `array[enum, Option[T]]` 😄
06:23:50FromDiscord<Elegantbeef> That's what I'd suggest
06:24:14FromDiscord<Elegantbeef> I generally prefer enabling any generic code, but I do not always abide when a type is meant to be hidden
06:24:37FromDiscord<Elegantbeef> When you do not use overloading you make it pretty much impossible to play with generics
06:26:12FromDiscord<Elegantbeef> Consider `initTable` if you have a procedure that works with data and you want preallocate you have `newSeq[T]` `initTable[K, V]` and so forth
06:26:12FromDiscord<Elegantbeef> There is no single monomorphic solution there
06:26:12FromDiscord<Elegantbeef> Now if it was `seq[T].new()` and `Table[K,V].init()` we can work with this
06:26:38FromDiscord<Elegantbeef> I know you asked how me to connect the dots and I've just dumped a lot of ink on a page and said "Well they're connected", but alas
06:32:38FromDiscord<pusewicz> If I rename `newCell` to `new` can I then create objects with `Cell()`? `new` is the default constructor name?
06:32:59FromDiscord<Elegantbeef> `new` is just a proc
06:33:03FromDiscord<Elegantbeef> You have to call `Cell.new()` everywhere
06:33:07FromDiscord<pusewicz> Ah, ok.
06:33:16FromDiscord<Elegantbeef> Nim does not have default constructors(except for the ones they do)
06:33:23FromDiscord<odexine> beef is just basically advocating for a better way to define constructors really
06:33:58FromDiscord<Elegantbeef> If you want a pretend example showcasing the benefit I can provide it 😄
06:34:05FromDiscord<pusewicz> Please do!
06:34:38FromDiscord<pusewicz> I can provide a gist with my current obj, and you could provide the reference implementation:P
06:34:59FromDiscord<pusewicz> https://gist.github.com/pusewicz/77b5b009ee2a66e315bdc20186e3d1c3
06:38:11FromDiscord<pusewicz> https://nim-lang.org/docs/destructors.html#sink-parameters <- this is what I should read regarding `sink`?
06:38:24FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=HGdvtcQa here you go for the pretend example
06:38:24FromDiscord<Elegantbeef> Yea
06:41:57FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=AExwzyPQ here's my take on your code
06:42:40FromDiscord<Elegantbeef> Hmph anyone know any good A vs. B image testing... want to add some unit testing for my terminaut's screen rendering
06:43:10FromDiscord<Elegantbeef> Or do I just have to write my own test suite using Pixie 😄
06:47:50*PMunch joined #nim
06:50:51FromDiscord<odexine> "A vs B image testing"
06:50:52FromDiscord<odexine> ?
06:51:22FromDiscord<Elegantbeef> Yes "Does this picture match this picture, if not save the image difference"
06:55:33FromDiscord<pusewicz> http://phash.org
06:56:15FromDiscord<Elegantbeef> Is that meant for me?
06:57:18FromDiscord<Elegantbeef> That might be a good solution for making my own test suite. I was going to just manually compare each pixel
07:00:28FromDiscord<nnsee> i think just manually comparing with pixie or something is the least-effort way
07:00:38FromDiscord<nnsee> not sure what you define as "difference", though
07:01:09FromDiscord<Elegantbeef> Images should be identical if they're not highlight the differences in a new debug picture
07:01:28FromDiscord<nnsee> i see
07:08:29FromDiscord<odexine> pixel perfect identical?
07:08:43FromDiscord<Elegantbeef> Yea I am trying to ensure rendering does not go astray
07:09:17FromDiscord<odexine> perceptual hashes work but you can prolly go with any normal hash
07:09:40FromDiscord<Elegantbeef> The hash is cheaper than the diff, then I could drop down to the diff for the picture
07:13:39*PMunch quit (Ping timeout: 256 seconds)
07:15:13FromDiscord<System64 ~ Flandre Scarlet> In reply to @morganalyssa "imo if you wanna": Any exemple?
07:16:14FromDiscord<nnsee> In reply to @Elegantbeef "Is that meant for": and as much as i know about phash, my understanding is that it's the opposite of what you want
07:16:36FromDiscord<nnsee> hashes will match if _content_ is the same, but not necessarily the pixels themselves
07:17:12FromDiscord<nnsee> the phashes of two images will match even if one of the images is rotated 90 degrees, for example
07:17:37FromDiscord<nnsee> iirc it's used mostly to detect CSAM
07:19:10FromDiscord<pusewicz> @ElegantBeef I'm puzzled now `array[Direction, seq[Cell]]` does this allow me to define all 4 directions with this?
07:19:22FromDiscord<Elegantbeef> Yes Nim has enum indexed arrays
07:19:31FromDiscord<Elegantbeef> They're a 0 cost abstraction
07:19:47FromDiscord<pusewicz> Holy shit.
07:19:51FromDiscord<Elegantbeef> Which allow for the same syntax as `Table[Direction, seq[Cell]]`
07:19:57FromDiscord<Elegantbeef> But without the hash overhead
07:20:13FromDiscord<pusewicz> https://github.com/beef331/nimtrest/wiki/Code-snippets#enum-indexed-array ah
07:20:15FromDiscord<Elegantbeef> And without the manually doing `arr[YourEnum.ord]` of `array[4, T]`
07:20:48FromDiscord<pusewicz> This is cool
07:20:56FromDiscord<pusewicz> I feel like a kid learning programming again
07:21:46FromDiscord<pusewicz> I'm trying to get my https://github.com/pusewicz/wave-function-collapse-ruby ported to Nim, to see the performance difference.
07:22:25FromDiscord<Elegantbeef> Ah I wrote a shitty WFC eons ago
07:22:36FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/master/wavefunctioncollapse.nim if you care to see
07:25:45FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=IzSQuHMj
07:26:42FromDiscord<Elegantbeef> Are you later using `logLvlTrace` in a const?
07:27:10FromDiscord<madonuko> thats… a very hard question
07:27:28FromDiscord<madonuko> uhh I'm using it in templates I guess
07:27:31FromDiscord<madonuko> I don't think that counts
07:27:58FromDiscord<pusewicz> Oooh, can I defined a proc called `tiles=` so that I could do `cell.tiles = @[...]` ?
07:28:06FromDiscord<pusewicz> (edit) "defined" => "define"
07:28:07FromDiscord<Elegantbeef> Yes
07:28:18FromDiscord<pusewicz> YES.
07:28:23FromDiscord<pusewicz> OMG, this is great.
07:29:06FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1239479518935388230/image.png?ex=664312c1&is=6641c141&hm=582468eb8392612431912e5744b72d770dabb8553fb38329288a146f9042b49d&
07:29:08FromDiscord<Elegantbeef> This is what that wfc does btw
07:29:28FromDiscord<pusewicz> sent a code paste, see https://play.nim-lang.org/#pasty=oGkesmJQ
07:29:46FromDiscord<Elegantbeef> Complaining about it how
07:30:19*ntat joined #nim
07:30:30FromDiscord<pusewicz> invalid type `sink seq[Tile]` in this context: 'Cell' for result (line with self.tiles = tiles) (I use nimcheck)
07:31:37FromDiscord<Elegantbeef> Now what about the compiler?
07:32:01FromDiscord<pusewicz> Same
07:32:53FromDiscord<Elegantbeef> you didn't make `Cell`'s `tiles` a `sink` did you, cause that's wrong
07:33:22FromDiscord<Robyn [She/Her]> Shouldn't `Cell` be `var Cell`?
07:33:32FromDiscord<pusewicz> Ah, I did.
07:33:52FromDiscord<Robyn [She/Her]> Ah it's a ref object ignore me
07:34:25FromDiscord<Elegantbeef> Heh I did that
07:34:25FromDiscord<Elegantbeef> My bad 😄
07:34:25FromDiscord<Elegantbeef> Remove `sink` inside the object
07:34:29FromDiscord<ElegantBeef> It's bad when I can tell the bridge slowed down
07:36:54FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=HcQiyOqD
07:37:14FromDiscord<Elegantbeef> Time to use delayed imports
07:37:44FromDiscord<Elegantbeef> Damn I have a snippet for it
07:37:45FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/wiki/Code-snippets#delayed-imports
07:37:53FromDiscord<Elegantbeef> This wiki was ingenous
07:38:21FromDiscord<madonuko> nvm I placed everything in a file, fixed everything and it somehow appears again in another file
07:38:39FromDiscord<Elegantbeef> and you're not trying to pass it to a `static` or `const`?
07:39:09FromDiscord<madonuko> nope
07:39:30FromDiscord<Elegantbeef> Well I feel lied to by either you or the compiler
07:40:57FromDiscord<madonuko> https://media.discordapp.net/attachments/371759389889003532/1239482500548657152/5FD9tUo.png?ex=66431588&is=6641c408&hm=6cae4ce8ad32a57542d1d97b0cbc6c8d462967f043eb0cce8003c93497c1ce7b& https://media.discordapp.net/attachments/371759389889003532/1239482500833873951/TjPxlf0.png?ex=66431588&is=6641c408&hm=b0581d5367a419ddf9d1f0396bcf5684f6889df44abba2f30c60d052886eb357&
07:41:24FromDiscord<madonuko> you get lied to by nim I guess
07:42:24FromDiscord<Elegantbeef> Or you're passing it to a proc you didn't define that expects `static` 😛
07:45:55*gst joined #nim
07:53:15FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "This wiki was ingenous": Right? And you only did it because various people here said to do it :)
07:53:31FromDiscord<Elegantbeef> No it was my idea and my idea a lone
07:53:43FromDiscord<Robyn [She/Her]> We told you to post your code snippets
07:53:49FromDiscord<Elegantbeef> Nope
07:53:50FromDiscord<Elegantbeef> Never
07:53:55FromDiscord<Robyn [She/Her]> Mhm sureeeee :)
07:54:52FromDiscord<Elegantbeef> Do I know you?
07:56:00FromDiscord<Robyn [She/Her]> Indeed you do, my friend
07:56:23FromDiscord<starkiller1493> In reply to @Elegantbeef "That might be a": dhash should be faster than the dhash, but not that much worse↵https://nimble.directory/pkg/dhash↵↵I used it here (https://github.com/filvyb/cunimnurse-bot/blob/c075e8f84d3a1a51b3ad9cba9f545c31cda4686a/src/utils/my_utils.nim#L100), but I switched to using vector distance between the downscaled greyscale
07:56:37FromDiscord<starkiller1493> (edit) "dhash," => "phash,"
07:56:37FromDiscord<Elegantbeef> dhash is faster than dhash
07:56:42FromDiscord<Elegantbeef> You heard it here first folks
07:56:57FromDiscord<starkiller1493> minor typo 🫡 💀
07:57:01*KhazAkar quit (Remote host closed the connection)
07:58:47FromDiscord<madonuko> In reply to @Elegantbeef "dhash is faster than": you are giving me import conflict vibes
07:58:58*KhazAkar joined #nim
07:59:02FromDiscord<odexine> In reply to @Elegantbeef "No it was my": a lone what
07:59:05FromDiscord<madonuko> that's exactly what I was dealing with with my own implementation of `debug()` and the one from `std/macros`
07:59:10FromDiscord<Elegantbeef> I knew it rika
07:59:15FromDiscord<Elegantbeef> One accidental space
07:59:16FromDiscord<Elegantbeef> One!
07:59:38FromDiscord<madonuko> In reply to @Elegantbeef "One accidental space": and your friend `nim` complains about it
07:59:46FromDiscord<Elegantbeef> So then do `import std/macros except debug`
07:59:48FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "One accidental space": Throw shit, get shit :>
07:59:53FromDiscord<madonuko> In reply to @Elegantbeef "So then do `import": I did
07:59:58FromDiscord<odexine> you know ive seen so many errors from you but decided to leave them as is
08:00:11FromDiscord<madonuko> but it still says cannot eval at compile time
08:00:13FromDiscord<odexine> In reply to @chronos.vitaqua "Throw shit, get shit": shitflinger central this is is it
08:00:13FromDiscord<Elegantbeef> I know when I make airs!
08:00:21FromDiscord<madonuko> soooooooo that's not the only issue
08:00:47FromDiscord<Robyn [She/Her]> In reply to @odexine "shitflinger central this is": Indeed it is!
08:00:49FromDiscord<Elegantbeef> Rika is just up set that I make miss steaks
08:00:50FromDiscord<odexine> madomado would it be ok to post full code if possible
08:01:07FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=QutPsGkU
08:01:16FromDiscord<odexine> In reply to @Elegantbeef "Rika is just up": how sweet of you to make your missy some steaks
08:01:21FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Rika is just up": Beef how much sleep did you get? :P
08:01:29FromDiscord<Elegantbeef> I get all the sleep I need
08:01:41FromDiscord<madonuko> In reply to @odexine "madomado would it be": it's something like 200 lines of code
08:01:45FromDiscord<odexine> 200 is nothing
08:01:47FromDiscord<Elegantbeef> Well send it
08:01:59FromDiscord<Elegantbeef> I can process 200 lines of code like 1 cob of corn
08:02:00FromDiscord<madonuko> hold on then
08:02:02FromDiscord<nnsee> In reply to @madonuko "it's something like 200": use https://play.nim-lang.org
08:02:11FromDiscord<madonuko> In reply to @nnsee "use https://play.nim-lang.org": it's nimscript
08:02:20FromDiscord<Elegantbeef> Well there's your problem
08:02:21FromDiscord<odexine> i think we found the issue
08:02:47FromDiscord<madonuko> I mean yeah… it's like submerging yourself in the ocean unknown
08:03:02FromDiscord<Elegantbeef> It's more like making a soup spoon out of gallium
08:03:10FromDiscord<Elegantbeef> It sorta works, but it just makes your soup full of metal
08:03:19FromDiscord<madonuko> well it's not toxic
08:03:20Amun-Rabut not of titanium
08:03:24FromDiscord<madonuko> so more like mercury
08:03:28FromDiscord<odexine> what if my bowl was aluminum
08:03:38FromDiscord<Elegantbeef> That's still the least of your worries
08:04:02FromDiscord<Elegantbeef> If you wanted to have soup but your spoons kept melting, that's just awful
08:04:03FromDiscord<odexine> what if i were aluminum
08:04:14FromDiscord<odexine> In reply to @Elegantbeef "If you wanted to": just drink off the bowl wdym
08:04:17Amun-Rawhat if you were aluminium
08:04:27FromDiscord<Elegantbeef> It's like the soup of Tantalus
08:05:05FromDiscord<odexine> what about tantalum
08:05:34FromDiscord<Elegantbeef> Who cares what you're made of, it's who you are that matters!
08:05:39FromDiscord<odexine> mmm capacitor soup
08:05:42FromDiscord<Elegantbeef> And you're clearly a dipshit!
08:06:28FromDiscord<odexine> eww why would i dip shit in my soup
08:06:36FromDiscord<madonuko> how did we went from nimscripting to souping
08:06:41FromDiscord<madonuko> (edit) "went" => "go"
08:07:00FromDiscord<odexine> close call there
08:07:10FromDiscord<odexine> anyway basically nimscript is what's used on compile time
08:07:23FromDiscord<odexine> a lot of errors that say "compile time" also apply when you're using things in nimscript
08:08:23FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=yCoQWNiO
08:09:11FromDiscord<madonuko> In reply to @odexine "i dont really know": it just runs it
08:09:14FromDiscord<madonuko> (?)
08:11:31FromDiscord<madonuko> I have to say nim's pretty bad at compile time errors or something
08:13:09FromDiscord<odexine> yeah
08:13:11FromDiscord<odexine> has been for years
08:13:13FromDiscord<odexine> sorry to say
08:13:16FromDiscord<madonuko> AFTER A BUNCH OF COMMENTING
08:13:22FromDiscord<madonuko> I'VE FOUND THE LINE THAT CAUSES THE ISSUE
08:13:38FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=qUvSbEUu
08:13:40FromDiscord<madonuko> ?????
08:14:05FromDiscord<odexine> you shouldnt import os in nimscript i think
08:14:29FromDiscord<madonuko> ok yeah it has something to do with std/times
08:14:31FromDiscord<madonuko> can't import that
08:15:21FromDiscord<madonuko> In reply to @odexine "you shouldnt import os": https://media.discordapp.net/attachments/371759389889003532/1239491159869362206/GciyQYH.png?ex=66431d99&is=6641cc19&hm=06e06f8efa88247af917a2994d00a9297f15a0ef7cf5167f51b9ff779abbe27f&
08:15:36FromDiscord<odexine> might have forgor
08:15:45FromDiscord<odexine> or my knowledge is too old
08:15:49FromDiscord<madonuko> rip
08:17:41FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=mvTXGZav
08:17:43FromDiscord<madonuko> (edit) "https://play.nim-lang.org/#pasty=kaVaCDBR" => "https://play.nim-lang.org/#pasty=JaZbeUcs"
08:17:55*m5zs7k quit (Ping timeout: 246 seconds)
08:18:34FromDiscord<madonuko> ~~I'm at the third level~~
08:18:49FromDiscord<nnsee> you guys remember things?
08:18:54*PMunch joined #nim
08:18:58FromDiscord<madonuko> In reply to @nnsee "you guys remember things?": bulb
08:19:20*m5zs7k joined #nim
08:21:57FromDiscord<madonuko> trying to write a `time` template for nimscript ~~and ended up spending too much time just to find out you just have no choice but to open `timedatectl` or something something~~
08:34:42*beholders_eye joined #nim
08:38:24*beholders_eye quit (Read error: Connection reset by peer)
08:44:02*beholders_eye joined #nim
10:18:35*def- quit (Quit: -)
10:27:06FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=wEpNHTKz
10:27:37FromDiscord<madonuko> (edit) "https://play.nim-lang.org/#pasty=ZGxClNOw" => "https://play.nim-lang.org/#pasty=PRecqCpJ"
10:28:25FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=mhUdPPHM
10:28:42FromDiscord<madonuko> there is no way `taskname` is undeclared
10:34:01FromDiscord<System64 ~ Flandre Scarlet> Is there a way to pass a nil string?
10:36:30FromDiscord<solitudesf> In reply to @sys64 "Is there a way": no, whats the usecase?
10:37:24*def- joined #nim
10:38:09FromDiscord<System64 ~ Flandre Scarlet> In reply to @solitudesf "no, whats the usecase?": Some Tilengine functions I try to abstract uses C-strings, so you can pass nil
10:41:22FromDiscord<solitudesf> In reply to @sys64 "Some Tilengine functions I": maybe you can special case some invalid state, like empty string and pass nil manually?
10:44:21FromDiscord<System64 ~ Flandre Scarlet> In reply to @solitudesf "maybe you can special": This is what I did, but maybe the user want to pass an empty string instead of nil
10:45:38FromDiscord<solitudesf> In reply to @sys64 "This is what I": make an overload without string paramter that passes nil instead?
10:45:43FromDiscord<solitudesf> (edit) "paramter" => "parameter"
10:46:54FromDiscord<System64 ~ Flandre Scarlet> In reply to @solitudesf "make an overload without": That I can do
10:47:10FromDiscord<System64 ~ Flandre Scarlet> Or use an optional
10:51:36*coldfeet joined #nim
10:54:50FromDiscord<System64 ~ Flandre Scarlet> Optionnels doesn't add that much verbosity, so maybe I can use those
10:55:47*coldfeet quit (Remote host closed the connection)
11:04:31FromDiscord<System64 ~ Flandre Scarlet> What is the best for passing a nil string?↵Procedure overload?↵Empty string to Nil?↵Option[string]?
11:15:30FromDiscord<odexine> how many parameters do you have and will an overload make it look awkward?↵if it will, then option is better↵if it wont, then overload is fine↵empty string to nil is never ok
11:33:21FromDiscord<Robyn [She/Her]> In reply to @sys64 "Some Tilengine functions I": Use `std/options` for `Option` types
11:33:52FromDiscord<Robyn [She/Her]> In reply to @sys64 "What is the best": Overloading looks nicer, in my opinion
11:34:28FromDiscord<solitudesf> In reply to @sys64 "What is the best": we dont know how either nim or c side of your code looks, its just guessing
11:34:36FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=ngwHqMNj
11:35:04FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=UuEUbHlP
11:35:11FromDiscord<System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#pasty=XLJaJonj" => "https://play.nim-lang.org/#pasty=XvgbHcjY"
11:36:57FromDiscord<solitudesf> sent a code paste, see https://play.nim-lang.org/#pasty=vJrtBXlh
11:37:16FromDiscord<System64 ~ Flandre Scarlet> options has a lot of overhead?
11:37:51FromDiscord<solitudesf> it has some overhead, if you dont need the option, why pay for it anyway.
11:38:26FromDiscord<System64 ~ Flandre Scarlet> I can do an overload then
11:39:04FromDiscord<Robyn [She/Her]> In reply to @solitudesf "if you already can": Reuse of logic
11:39:23FromDiscord<Robyn [She/Her]> I don't have to duplicate the proc body
11:39:25FromDiscord<solitudesf> In reply to @chronos.vitaqua "Reuse of logic": put the login in template instead, if you want to reuse it
11:39:47FromDiscord<Robyn [She/Her]> True, that is an option
11:40:57FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "True, that *is* an": Should I use options or overloads?
11:44:49FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=MbbwTEJs
11:48:45FromDiscord<polylokh_39446> with an overload, there's no runtime overhead. With a default argument that's tested like that, or with an option that's tested, there's minimal runtime overload. The advantage of option over the default is probably of no value to you here: it would permit you to pass an empty string as a legitimate layer name.↵All of these options are fine and you probably won't feel any regret whichever one you go with.
11:50:14FromDiscord<System64 ~ Flandre Scarlet> I highly doubt you would load very often outside of transitions, so in this case, an option is probably better, less to write
11:51:14FromDiscord<polylokh_39446> if this is a library for other people though, you should look at it more from the perspective of users of the library. Option has more advantages: you can use it consistently, across cases where there's no reasonable default and cases where there is one, and an option would make more sense in user code that optionally stores layer names in an object or a configuration file
11:51:44FromDiscord<System64 ~ Flandre Scarlet> In reply to @polylokh_39446 "if this is a": the default would be nil
11:51:58FromDiscord<System64 ~ Flandre Scarlet> like the proc declarations I just posted above
11:52:06FromDiscord<polylokh_39446> strings aren't nillable, and most things aren't in Nim.
11:52:52FromDiscord<System64 ~ Flandre Scarlet> In reply to @polylokh_39446 "strings aren't nillable, and": the problem with overloading is I need to rewrite the logic 2 times
11:53:20FromDiscord<polylokh_39446> one overload can call the other.
11:53:34FromDiscord<polylokh_39446> for this specific function I think the better route is `layername: cstring = nil`
11:54:12FromDiscord<madonuko> I think I broke nimble
11:54:31FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=fSDjsqqD
11:54:56FromDiscord<System64 ~ Flandre Scarlet> In reply to @polylokh_39446 "for this specific function": Well, I try to abstract from C as much as possible
11:55:33FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=cqwoCSmE
11:56:19FromDiscord<polylokh_39446> that makes sense I guess, since the conversion requires a copy.
11:56:45FromDiscord<solitudesf> sent a code paste, see https://play.nim-lang.org/#pasty=ckosfQqs
11:57:08FromDiscord<madonuko> In reply to @solitudesf "can you share the": the context is I'm making a drop-in replacement for the `task` template provided by nimble
11:58:39FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=XYsPOKbj
12:11:47FromDiscord<Robyn [She/Her]> In reply to @polylokh_39446 "it would still be": Avoid nil at all costs, imo
12:12:23FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "Avoid nil at all": So for you I should use Options instead of overloading?
12:13:00FromDiscord<Robyn [She/Her]> In reply to @sys64 "So for you I": Personally I'd use both for extra niceness value, but really `Option`s should br enough
12:13:04FromDiscord<Robyn [She/Her]> Be enough
12:14:42FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "Personally I'd use both": It's hard to make a consistant API for users
12:15:47FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=ZftLpUIK
12:20:02FromDiscord<polylokh_39446> and options are the easiest to make consistent. Not everything's going to have a good default value that you could use instead.
12:22:01FromDiscord<System64 ~ Flandre Scarlet> In reply to @polylokh_39446 "and options are the": First string isn't an Option the second is↵Is it still consistant?
12:24:13FromDiscord<polylokh_39446> the first string is required and the second isn't. The consistency is across the optional things.
12:25:43FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=KlqXHTlH
12:27:58FromDiscord<polylokh_39446> it's fine. You can write that as `"layername".some` as well
12:28:59FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=HBnxjWKa
12:29:22*rez quit (Remote host closed the connection)
12:29:34FromDiscord<polylokh_39446> not without a converter, which I wouldn't suggest just to make that function cleaner
12:31:47FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=JZDfdhLh
12:32:23FromDiscord<solitudesf> In reply to @polylokh_39446 "another alternative is the": ah hell nah
12:32:32FromDiscord<polylokh_39446> tileLoader returns an object, you have functions that modify the object, and `load` to actually do the thing.
12:33:16*xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in)
12:34:01FromDiscord<System64 ~ Flandre Scarlet> In reply to @polylokh_39446 "tileLoader returns an object,": Is that something we see often in Nim?
12:35:29FromDiscord<polylokh_39446> it's something you see in any language.
12:35:43FromDiscord<System64 ~ Flandre Scarlet> Method chaining is elegant
12:37:01FromDiscord<polylokh_39446> all in all I prefer passing a table with options in a dynamic language to the builder pattern, but that has multiple downsides as well.
12:37:24FromDiscord<solitudesf> In reply to @sys64 "Is that something we": absolutely not
12:38:08FromDiscord<System64 ~ Flandre Scarlet> Alright so I should avoid to use a builder in Nim to stay consistant, however it can work for C# for exemple
12:38:40FromDiscord<polylokh_39446> anyway, this is programming. You're not going to have to pay Blizzard $20 to re-spec your decision. As a rule you should go with reasonable defaults and wait for friction to show up in practice, to make changes to reduce the friction.
12:39:10FromDiscord<polylokh_39446> if 100% of your practical loads use a layer name, for example, then all the work to make it optional is pointless.
12:39:17FromDiscord<System64 ~ Flandre Scarlet> the hardest thing in programming is to make the best decisions
12:39:31FromDiscord<polylokh_39446> no the hardest things in programming are cache invalidation and good names.
12:39:43FromDiscord<System64 ~ Flandre Scarlet> Cache invalitation 😬
12:39:57FromDiscord<System64 ~ Flandre Scarlet> (edit) "invalitation" => "invalidation"
12:39:59FromDiscord<polylokh_39446> breaking an API in a very popular library and forcing people to upgrade to use your new fancy-pants idea of how it should work, that's easy, people to it all the tie
12:40:55FromDiscord<polylokh_39446> for example, the 'clap' library in Rust used to be a big builder pattern, and they bumped major versions to replace that with procedure macros that you put on structs.
12:41:37FromDiscord<System64 ~ Flandre Scarlet> kaboom
12:42:01FromDiscord<System64 ~ Flandre Scarlet> Anyways↵I used overloading
12:42:19FromDiscord<System64 ~ Flandre Scarlet> because the less the user must write, the better
12:51:39*xutaxkamay joined #nim
12:57:48FromDiscord<madonuko> anyone knows what `{.callsite.}` does exactly?
13:00:41*def- quit (Quit: -)
13:01:58NimEventerNew Nimble package! leveldbstatic - Statically linked LevelDB wrapper for Nim, see https://github.com/codex-storage/nim-leveldb
13:02:50*def- joined #nim
13:24:32*rockcavera joined #nim
13:40:13FromDiscord<_nenc> In reply to @sys64 "and can I do": you can make it a generic parameter and convert it inside function
13:40:59FromDiscord<_nenc> (edit) "In reply to @sys64 "and can I do": you can make it a generic parameter and convert it inside function ... " added "with `when x is string:`"
13:47:55FromDiscord<Zoom> Is there some simple idiom of parsing a short [u]int into a holey enum? Currently I collect a set of valid numbers with `enumutils.items` at compile time and check if the value in question is in the set when parsing.
13:52:34PMunchI think that's the best way of doing it
13:53:07PMunchWould be nice if you could get a set of the valid numbers in an enum more easily though
13:56:50*KhazAkar quit (Ping timeout: 268 seconds)
14:03:25*KhazAkar joined #nim
14:10:17*KhazAkar quit (Ping timeout: 256 seconds)
14:34:12FromDiscord<madonuko> I'm moving here
14:34:19FromDiscord<madonuko> I've no idea what's happening in offtopic I'm sorry
14:34:39FromDiscord<madonuko> anyone here has any particular complains for missing features in nimscript
14:34:41FromDiscord<odexine> dont worry about it
14:34:48FromDiscord<madonuko> might consider adding into my new pkg
14:34:56FromDiscord<odexine> In reply to @madonuko "anyone here has any": i believe a lot of people get bit by the lack of FFI
14:34:58FromDiscord<odexine> oh
14:35:02FromDiscord<odexine> you mean things to add
14:35:25FromDiscord<madonuko> yeah…
14:35:44FromDiscord<madonuko> In reply to @odexine "i believe a lot": I'm one of them tbh, I really hate having to use the `date` command to get the current time…
14:37:11FromDiscord<Robyn [She/Her]> In reply to @madonuko "I'm one of them": Look into Confy if you want a library that provides an API to create your own buildsystem in a binary
14:37:18FromDiscord<Robyn [She/Her]> https://github.com/heysokam/confy/tree/master
14:37:56FromDiscord<Robyn [She/Her]> It uses the native backends so you don't need to worry about half the things you need not being present
14:38:00FromDiscord<madonuko> > Confy is a buildsystem for compiling code with ZigCC.↵<insert wow emoji>
14:38:10FromDiscord<Robyn [She/Her]> I haven't used it personally but sOkam makes high quality stuff
14:38:29FromDiscord<madonuko> I was like what the hell did you mean by "library that provides an API to create your own buildsystem in a binary", and I clicked into the link, and I got even more confused
14:38:40FromDiscord<Robyn [She/Her]> In reply to @madonuko "> Confy is a": It uses ZigCC because it enables much easier crosscompilation
14:38:51FromDiscord<Robyn [She/Her]> Might be possible to configure it to use your own C compiler but that's something to ask them
14:38:59FromDiscord<Robyn [She/Her]> In reply to @madonuko "I was like what": I'm very bad at phrasing shit, sorry :P
14:39:01FromDiscord<madonuko> holy gosh https://media.discordapp.net/attachments/371759389889003532/1239587711044817007/x7CvQvz.png?ex=66437784&is=66422604&hm=73c2e11025ad86663348742952f662b458c341d64d495b5faecf6434e0697485&
14:39:07FromDiscord<madonuko> this person is crazy
14:39:15FromDiscord<albassort> whats go---
14:39:16FromDiscord<albassort> what the fuck
14:39:54FromDiscord<Robyn [She/Her]> Basically, it's a library that provides convenience procs to build Nim code, and it doesn't run on Nimscript
14:39:55FromDiscord<Robyn [She/Her]> In reply to @madonuko "this person is crazy": Crazy but good :P
14:40:03FromDiscord<Robyn [She/Her]> In reply to @albassort "what the fuck": ?
14:40:41FromDiscord<madonuko> oh so what it does is basically
14:40:54FromDiscord<madonuko> compiling a program written in C to Nim
14:41:07FromDiscord<albassort> https://github.com/heysokam/minc
14:41:09FromDiscord<albassort> what is this
14:41:15*xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in)
14:41:39FromDiscord<madonuko> In reply to @albassort "what is this": well… read the description?
14:41:42FromDiscord<Robyn [She/Her]> In reply to @madonuko "compiling a program written": No? It provides functions that compile C/C++/Nim code
14:41:48FromDiscord<albassort> why is this
14:41:57FromDiscord<madonuko> In reply to @chronos.vitaqua "No? It provides functions": what.
14:42:04FromDiscord<madonuko> oh
14:42:07FromDiscord<madonuko> ohhhh
14:42:09*xutaxkamay joined #nim
14:42:14FromDiscord<madonuko> so it's basically build.rs in nim
14:42:20FromDiscord<madonuko> or Makefile
14:42:21FromDiscord<madonuko> something like that
14:42:21*coldfeet joined #nim
14:42:23FromDiscord<Robyn [She/Her]> In reply to @albassort "why is this": A language using Nim's AST, that generates C code :P
14:42:32FromDiscord<Robyn [She/Her]> In reply to @madonuko "so it's basically build.rs": Yeah exactly like that
14:42:33FromDiscord<albassort> why not just use nim tho
14:42:36FromDiscord<Robyn [She/Her]> Sorry for my poor wording
14:42:37FromDiscord<albassort> :|
14:42:40FromDiscord<Robyn [She/Her]> In reply to @albassort "why not just use": 🤷‍♀️
14:42:47FromDiscord<albassort> >>:(
14:42:49FromDiscord<madonuko> In reply to @chronos.vitaqua "Sorry for my poor": don't mind
14:43:45FromDiscord<madonuko> In reply to @albassort "why not just use": that's the same logic as "I will die anyway and after 10000 years no one will remember me so might as well die now"
14:44:05FromDiscord<albassort> @Robyn [She/Her] fact check this logic
14:44:10FromDiscord<madonuko> w-wha
14:44:20FromDiscord<albassort> is that the same logic?
14:44:34FromDiscord<Robyn [She/Her]> Not the same logic but gets the point across ig?
14:44:40FromDiscord<albassort> hmmm
14:44:45FromDiscord<Robyn [She/Her]> When you ask why, my logic is: "Why not?"
14:44:55*coldfeet quit (Remote host closed the connection)
14:44:58FromDiscord<albassort> that is the correct logic
14:45:03FromDiscord<albassort> although
14:45:18FromDiscord<albassort> maybe if it ran on a nim JIT so its a scripted language
14:45:20FromDiscord<albassort> would be cool
14:45:23FromDiscord<Robyn [She/Her]> sOkam just wanted a language that is basically C, but just a tad nicer to use for him
14:45:37FromDiscord<Robyn [She/Her]> In reply to @albassort "maybe if it ran": ✨ You could do that ✨
14:46:02FromDiscord<Robyn [She/Her]> Make a WASM backend and ez, you now have a sandboxed VM
14:53:06FromDiscord<albassort> In reply to @chronos.vitaqua "✨ You could do": no im stupid
14:54:32FromDiscord<Robyn [She/Her]> In reply to @albassort "no im stupid": I'm also stupid, so?
14:54:50FromDiscord<Robyn [She/Her]> True intelligence is using your stupidity to do amazing things :)
14:55:07FromDiscord<albassort> im a stupid face who also needs a new job and has to prioritize the fun coding things i can do before its back to sad serious coding things
14:56:30FromDiscord<Robyn [She/Her]> Rip that's fair enough, I just need a full-time job soon so I can save up for a good gaming PC
14:56:46FromDiscord<albassort> i need a job so i can... eat food
14:57:34FromDiscord<Robyn [She/Her]> Yeah that's a few months off for me still ehe
15:15:30FromDiscord<@@prestosilver> Interesting question, technically for a game but I thought it might make more sense to ask here, LUAs panic function exits on return, is there a way to get the address of something and force a jump rather than quitting. I was able to do this in zig recently but Idk how to go about this in nim. Might also be possible to just return to the main loop, but I do need to be able to jump rather than calling a function.
15:15:50FromDiscord<@@prestosilver> Havent used nim much for stuff this low level
15:15:55FromDiscord<@@prestosilver> (edit) "low level" => ""low level""
15:24:36FromDiscord<madonuko> In reply to @albassort "no im stupid": but seriously nim is so good you can be a drunk cat, an eepy cat, a dumb cat, or a drunk eepy dumb cat, and your program would still work
15:25:12FromDiscord<madonuko> no cap but best language for gui development
15:25:28FromDiscord<Phil> Tfw not a cat
15:25:44FromDiscord<madonuko> In reply to @isofruit "Tfw not a cat": banned
15:25:55FromDiscord<madonuko> segmentation fault
15:25:57FromDiscord<demotomohiro> In reply to @prestosilver "Interesting question, technically for": When you jump to other place, destructor or defer statements in the scope never executed?
15:26:42FromDiscord<odexine> In reply to @isofruit "Tfw not a cat": ok apple
15:27:19FromDiscord<@@prestosilver> In reply to @demotomohiro "When you jump to": Didnt even think abt that, ill problaby just have to deal with the error tbh
15:27:29FromDiscord<madonuko> I'd like to request banning this moderator, because this moderator is not a cat! This is illegal!!
15:27:40FromDiscord<Phil> In reply to @odexine "ok apple": I prefer the term douchebag fruit
15:28:32FromDiscord<odexine> In reply to @isofruit "I prefer the term": idk i dont think an apple would fit up there
15:31:29FromDiscord<albassort> In reply to @madonuko "no cap but best": false
15:31:33FromDiscord<albassort> that'd be JS or C
15:31:36FromDiscord<albassort> (edit) "that'd be JS or C ... " added "or C++"
15:31:44FromDiscord<madonuko> In reply to @albassort "that'd be JS or": wtf
15:31:49FromDiscord<albassort> nim is probably number 30 just under php
15:31:52FromDiscord<albassort> (edit) "nim is probably number 30 just under php ... " added "and lisp"
15:31:59FromDiscord<madonuko> php for gui development??
15:32:04FromDiscord<albassort> its been done
15:32:09FromDiscord<madonuko> wtf is wrong with you
15:32:16FromDiscord<madonuko> I'm sorry wtf
15:32:18FromDiscord<albassort> thats #28
15:32:35FromDiscord<albassort> All gui dev i've done is C or JS
15:32:35FromDiscord<madonuko> idk like
15:32:39FromDiscord<madonuko> personal experience wise
15:32:52FromDiscord<madonuko> making native gui applications in nim are much better than python and rust
15:33:20FromDiscord<albassort> just write it in GTK silly guy
15:33:36FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=PLQVbaJR
15:33:38FromDiscord<madonuko> In reply to @albassort "just write it in": I did
15:33:41FromDiscord<madonuko> ??
15:33:43FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=rgleNjJY
15:33:54FromDiscord<System64 ~ Flandre Scarlet> In reply to @albassort "no": Oh alright
15:34:00FromDiscord<albassort> well maybe in some version somewhere
15:34:03FromDiscord<albassort> but i've never seen it
15:34:25FromDiscord<odexine> In reply to @albassort "no": technically, yes
15:34:33FromDiscord<albassort> if you make it return a value sure
15:34:35FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=XTxCVbdY
15:34:35FromDiscord<odexine> it'd just be incredibly cursed
15:34:37FromDiscord<albassort> but they meant in the stdlib
15:34:47FromDiscord<odexine> is that what they meant
15:34:52FromDiscord<albassort> i misunderstood
15:34:54FromDiscord<albassort> lol
15:35:02FromDiscord<albassort> yeah you can make it return a value, you shouldn't
15:35:24FromDiscord<albassort> i thought they meant "is there a library somewhere in the stdlib which returns a value that would conflcit with this"
15:37:17FromDiscord<madonuko> this actually looks terrifying https://media.discordapp.net/attachments/371759389889003532/1239602372997681182/b0uKfSO.png?ex=6643852c&is=664233ac&hm=239bca3ab32ca145eed43397da95ea360794db37b5657a388f3bd7d1c00a8701&
15:38:46FromDiscord<albassort> i was including not native ways
15:38:56FromDiscord<albassort> native only, maybe nim is like top 10
15:40:04FromDiscord<madonuko> In reply to @albassort "native only, maybe nim": what's 0..9
15:40:18*def- quit (Quit: -)
15:40:24FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=bKxJzfoX
15:41:50*def- joined #nim
15:41:54FromDiscord<madonuko> In reply to @demotomohiro "If `[]=` returns bool:": could be useful for an array of bools and returns the one in that array before overriding
15:41:55FromDiscord<madonuko> dunno
15:42:08FromDiscord<madonuko> still cursed
15:44:44FromDiscord<albassort> sent a long message, see https://pasty.ee/hLoVItQt
15:44:56FromDiscord<Phil> Agreed, if you want something like that you should write out a fully set proc. But even then you shouldn't do it because you're doing a side-effect and a transformation
15:45:01FromDiscord<odexine> In reply to @madonuko "could be useful for": i dont see the use case of this that isnt covered by getOrDefault or hasKeyOrPut
15:45:19FromDiscord<demotomohiro> In if statement, writing '`if (x = 2):`' instead of '`if (x == 2):`' is common mistake.↵And in some programming language, such a mistake cannot be detected at compile time.
15:45:24FromDiscord<madonuko> In reply to @odexine "i dont see the": sugar
15:45:42FromDiscord<Phil> That ain't sugar, that's adding garbled hieroglyphs
15:45:45FromDiscord<madonuko> In reply to @albassort "C Ultimate support ": well you're mostly talking about support↵I'm mostly talking about practicality
15:45:48FromDiscord<madonuko> In reply to @isofruit "That ain't sugar, that's": LMAO
15:46:04FromDiscord<Phil> In reply to @madonuko "well you're mostly talking": Support is a massive part of practicality
15:46:12FromDiscord<Phil> The easy part is getting the application written
15:46:17FromDiscord<albassort> very true
15:46:19FromDiscord<Phil> The hard part is maintaining it. That is also 80% of the work
15:46:21FromDiscord<madonuko> In reply to @isofruit "Support is a massive": not until it is >>
15:46:36FromDiscord<albassort> we stand on the shoulders of giants, especially when we work on GUI applications
15:46:48FromDiscord<albassort> the sheer codebase beneath your is massive
15:47:11FromDiscord<madonuko> In reply to @albassort "the sheer codebase beneath": me trying to port libhelium into nim:
15:47:24FromDiscord<albassort> when you work on algorithmic software, you stand more ontop of the intellectual endeavors of our predecessors
15:47:28FromDiscord<Phil> There's people talking about "Write your own micro-OS for your program so you don't have to rely on 1.000.000+ lines of code working correctly before you can even do anything"
15:48:25FromDiscord<albassort> write your micro-micro-os which runs in parallel mode with raw X86 asm
15:49:45FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=gxyThJUR
15:50:04FromDiscord<madonuko> and I think it takes like 5 to actually write the equivalent in rust
15:50:18FromDiscord<madonuko> I mean relm4
15:50:36FromDiscord<madonuko> I forgot how it works in relm4
15:50:56FromDiscord<Phil> Owlkettle is kind of a poster child in that regard though because it makes decent use of a DSL here.↵But even then it still has issues that you just don't see because they don't show up in the semantics
15:51:05FromDiscord<Phil> I say that as a fairly sizeable contributor to owlkettle
15:51:24FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=zbasXvYo
15:51:28FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=xBcqkWrR" => "https://play.nim-lang.org/#pasty=IbvaPlOt"
15:51:36FromDiscord<albassort> there you go mutating hello world in svelte
15:51:39*ntat quit (Quit: Leaving)
15:52:22FromDiscord<Phil> And yeah, I'll agree with albassort, JS (or rather: TS) as a FE language is very hard to beat in terms of productivity
15:52:25FromDiscord<Phil> The web in general is
15:52:29FromDiscord<madonuko> In reply to @isofruit "Owlkettle is kind of": well… I think I wrote like a full-fetched app in owlkettle and I'm very happy to say I've faced mostly no issues
15:52:41FromDiscord<madonuko> other than taking like a day to figure out gtk doesn't work with threads
15:52:43FromDiscord<albassort> In reply to @isofruit "And yeah, I'll agree": JS SUPREMACY
15:52:52FromDiscord<Phil> In reply to @albassort "JS SUPREMACY": TS or heresy
15:53:05FromDiscord<madonuko> In reply to @isofruit "And yeah, I'll agree": you can't make native apps with them or something
15:53:12FromDiscord<Phil> TS is like the one type system I've seen so far I like almost more than nim's
15:53:13FromDiscord<madonuko> does react native count as native
15:53:18FromDiscord<Phil> Yes
15:53:18FromDiscord<madonuko> eh idk
15:53:23FromDiscord<albassort> i dont like TS's
15:53:24FromDiscord<Phil> Because it actually compiles down to native
15:53:25FromDiscord<albassort> its too intense
15:53:31FromDiscord<albassort> its a over-correction from JS
15:53:34FromDiscord<Phil> In reply to @albassort "i dont like TS's": Maniac!
15:53:40FromDiscord<Phil> Madwoman!
15:53:53FromDiscord<madonuko> In reply to @albassort "its too intense": edit your eslint or something idk
15:54:31FromDiscord<Phil> TS is one of those things that's as intense as you make it. But then again I'm of the type that I like my TS compiler as strict as possible so her point is still valid
15:54:48*beholders_eye quit (Quit: WeeChat 4.1.2)
15:54:49FromDiscord<albassort> NOTHING is implied in TS and you cant write sugar function spaghetti like you can in nim
15:55:01FromDiscord<madonuko> wait you can't?
15:55:02FromDiscord<Phil> In reply to @albassort "NOTHING is implied in": Now that I call lies on
15:55:12FromDiscord<albassort> not as easily
15:55:25FromDiscord<madonuko> eh I'd say nim is pretty weak on the imply part too
15:55:41FromDiscord<madonuko> the real imply thingy winner here is rust
15:56:17FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=vmuLjlnh
15:56:52FromDiscord<Phil> I'll agree you need to type more, but personally that saves me a fair amount of errors I'd elsewise have later
15:57:11FromDiscord<madonuko> I think I'm cooking again https://media.discordapp.net/attachments/371759389889003532/1239607378874335272/S1KloCo.png?ex=664389d5&is=66423855&hm=ac0d8efe6368c37fd44e111dc24c75e60c20aa4796b979b9874648ece77f24c5&
15:58:48FromDiscord<Robyn [She/Her]> Whyyyy would you want that?
15:59:45FromDiscord<madonuko> idea is cmd_lib but in nim
15:59:53FromDiscord<Robyn [She/Her]> Idk what cmd_lib is
16:00:31FromDiscord<madonuko> In reply to @chronos.vitaqua "Idk what cmd_lib is": basically write shell stuff as nim code
16:00:37FromDiscord<madonuko> cmd_lib is a rust lib tho
16:00:48FromDiscord<madonuko> https://media.discordapp.net/attachments/371759389889003532/1239608293752569997/jQJjimN.png?ex=66438ab0&is=66423930&hm=793fee2be1f0ae7ccab7fc81436790b86051ae505290e1406225dbbde0070b1c&
16:03:25FromDiscord<Robyn [She/Her]> Aaah
16:03:46*beholders_eye joined #nim
16:06:31*krux02 joined #nim
16:18:45*xet7 joined #nim
16:24:54FromDiscord<Nelson> nim friends over discord! I am a nim newbie and I have stumbled across an issue with https://github.com/Angluca/mui/
16:25:35FromDiscord<Nelson> imagen.png https://media.discordapp.net/attachments/371759389889003532/1239614529424326656/imagen.png?ex=6643907e&is=66423efe&hm=b17dddf91d575cf376e75a45cdc07b8d0b9efb1b9f0681a328265600a012199a&
16:25:45FromDiscord<Nelson> imagen.png https://media.discordapp.net/attachments/371759389889003532/1239614569509289994/imagen.png?ex=66439088&is=66423f08&hm=b89426d54eefe2aded103e1d428f97fcdeb6d0a89594fd47bc09cc63f42cc811&
16:26:44FromDiscord<Nelson> it's these two last lines specifically
16:27:17FromDiscord<Nelson> thing is, the demo of the library itself does this exact same thing too
16:27:48FromDiscord<Phil> I would love to help, but you're messing with allocation directly and over there I'm so far out of my depth it's not even funny
16:27:49FromDiscord<solitudesf> does the demo work?
16:28:14FromDiscord<Nelson> no lmao↵(@solitudesf)
16:28:23FromDiscord<Nelson> but not because of those two lines
16:28:25FromDiscord<Nelson> wait
16:28:48FromDiscord<Nelson> i think i can fix the demo myself
16:32:32FromDiscord<Nelson> exact same error \:(↵(@solitudesf)
16:32:37FromDiscord<morgan> In reply to @sys64 "Any exemple?": idk (foo, bar) % 0.25
16:33:07FromDiscord<demotomohiro> You probably need to wrap C's `const char` to match pointer type:↵https://internet-of-tomohiro.pages.dev/nim/faq.en#use-nim-with-other-language-how-to-wrap-const-charstar-type-in-cqmark
16:34:05FromDiscord<Nelson> it's actually a function↵(@demotomohiro)
16:34:09FromDiscord<Nelson> but this seems useful
16:35:30FromDiscord<System64 ~ Flandre Scarlet> In reply to @morganalyssa "idk (foo, bar) %": looks neat!
16:35:52FromDiscord<demotomohiro> Error message you posted seems you assinged different function pointer type as 2nd function pointer is not `const char` but `char`.
16:36:22FromDiscord<Nelson> OHHHHHHHHHHHHH
16:36:36FromDiscord<Nelson> yeah i see it now, sorry lol↵(@demotomohiro)
16:37:42FromDiscord<Nelson> great i'll have to fix the binding too
16:38:13FromDiscord<Nelson> oh wait let me guess, my nim version is too old
16:43:59FromDiscord<Nelson> nope it wasnt that, i'll have to fix the binding
16:46:54FromDiscord<morgan> In reply to @sys64 "looks neat!": and thinking more about it, you could extend that to multi point interpolation, like (a, b, c, d) ~ 0.3 for beziers, (seq, of, many, things...) ^ 2.5 for piecewise linear
16:49:42FromDiscord<morgan> or maybe seq[(x,y)] ~ -1.2 for evaluation of a(n ideally compile time defined) curve fit
16:50:48FromDiscord<morgan> but it would be cleaner to do that with mytuple.bez(t)
16:51:13FromDiscord<morgan> lerp, bez, plin, fit
16:51:24FromDiscord<morgan> fairly short and more understandable still
16:51:42FromDiscord<odexine> prolly better to use a fuller name if its not as popular as lerp
16:51:45FromDiscord<System64 ~ Flandre Scarlet> yeah I think we should avoid operators here
16:54:22FromDiscord<morgan> i think lerp with percent does kinda make sense enough to work with an operator, but much less so for the others
16:55:47FromDiscord<System64 ~ Flandre Scarlet> In reply to @morganalyssa "i think lerp with": Is there a risk to confuse it with a modulo?
16:58:29FromDiscord<morgan> probably
16:58:43FromDiscord<morgan> what does modulo of a tuple mean though
16:58:51FromDiscord<morgan> modulo of both?
16:59:02FromDiscord<morgan> but if you see it returns one, then what
16:59:27FromDiscord<morgan> but yeah i think it would still be better off as tup.lerp(t)
17:18:33*ntat joined #nim
17:20:38FromDiscord<System64 ~ Flandre Scarlet> I think thesame
17:20:41FromDiscord<System64 ~ Flandre Scarlet> (edit) "thesame" => "the same"
17:21:08FromDiscord<System64 ~ Flandre Scarlet> Btw↵When a proc returns a ref object↵And I discard this return value↵Would the destructor be immediately called?
17:23:51*Amun-Ra bets on not
17:26:15Amun-Rathen again, I'd like to change my bet ;)
17:33:19FromDiscord<System64 ~ Flandre Scarlet> In reply to @Amun-Ra "bets on not": Not immediately but it is destroyed↵So probably discard is like↵let _ = myFunction()
17:34:49Amun-Rainteresting, thanks
17:36:23FromDiscord<System64 ~ Flandre Scarlet> Btw replace the A from Discard by O↵Discord
17:36:30FromDiscord<System64 ~ Flandre Scarlet> Well, that's cursed
17:37:13Amun-Rawhat if you put it in inner block? does it get freed right after?
17:55:40*coldfeet joined #nim
17:58:27FromDiscord<morgan> welp i think im gonna have to write my own platform abstracted window reparenting thing
17:58:49FromDiscord<morgan> i wanna see if i can get it to work without objc on mac
18:02:13*def- quit (Quit: -)
18:02:30*def- joined #nim
18:12:04FromDiscord<morgan> https://stackoverflow.com/a/72973624 :bolbdevil: maybe i can figure out what this is doing and apply it to the reparent calls
18:13:19FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#pasty=mKVnfLXX
18:15:32FromDiscord<morgan> i want to just shim sokol in and see what else i need after that
18:27:00FromDiscord<nervecenter> In reply to @isofruit "Owlkettle is kind of": That's by biggest issue with macros and macro-based DSLs, so much generated code you never see and debugging is a wild ride
18:27:16FromDiscord<Phil> Oh the DSL itself is fine
18:27:26FromDiscord<Phil> I'm more talking how difficult the memory management under the hood can be
18:27:34FromDiscord<Phil> And I'm still not entirely certain it's all working correctly
18:28:29FromDiscord<Phil> The DSL itself is in fact the least of my problems tbh. Like, yeah there's a limitation where one widget may want a reference to another one, that's being worked on
18:28:44FromDiscord<Phil> But otherwise it's working fairly well
18:28:47FromDiscord<nervecenter> True I guess, I still don't like relying on macro-heavy libraries too much. But I also think functions/procs are detailed enough and semantically rich enough to function as a DSL without needing macro expansion so that's a real hot take
18:29:17FromDiscord<nervecenter> Glad it works though, I tried the weird CLI macro library and it worked decently, I forget what it was
18:29:43FromDiscord<nervecenter> `docopt`
18:30:33FromDiscord<nervecenter> (edit) "detailed enough" => "detailed, composable,"
18:30:51FromDiscord<nervecenter> (edit) "`docopt`" => "`docopt.nim`"
18:44:09FromDiscord<the_real_hypno> In reply to @isofruit "And I'm still not": Yep, i feel you. How did you make sure about the parts you are sure about?
18:44:36FromDiscord<Phil> In reply to @nervecenter "True I guess, I": Imo it's alright if you go very methodically at it
18:45:53FromDiscord<Phil> Basically very clear API. First thing you do every proc is validate that the input is one of the nimnodekinds you can expect this to work with.↵Like, the start of the proc is always defining the contract of which NimNodes are acceptable.↵From there you move on very step-wise and methodical. It's always a straightforward transformation etc.
18:46:38FromDiscord<Phil> In reply to @the_real_hypno "Yep, i feel you.": That was before my multithreading days, I essentially wrote a minimal example, checked in the taskmanager. If memory usage grew without shrinking back down again I started combing through the code for leaks
18:46:50FromDiscord<Phil> (edit) "days," => "days and better knowledge of tooling in that regard,"
18:47:06FromDiscord<Phil> Nowadays I'd like first need to invest a day or two to figure out how to suppress false positives from GTK itself
18:47:13FromDiscord<the_real_hypno> Ah, so roughly what i did. Doesnt really feel satisfying though
18:47:15FromDiscord<Phil> And then comb through it with valgrind
18:48:34FromDiscord<the_real_hypno> Valgrind is Linux, right?
18:48:55FromDiscord<Phil> Yes, I think it might be available under windows as well?
18:49:02FromDiscord<Phil> Seems essential enough for that to be the case
18:49:07FromDiscord<Phil> Other than that you still have sanitizers
18:49:12FromDiscord<Phil> Which I think also work on windows
18:49:22FromDiscord<the_real_hypno> I think i wanted to use it and saw its Linux only and silently cried
18:49:40FromDiscord<Phil> For memory leaks I know of 2 options:↵Valgrind and address sanitizer
18:50:20FromDiscord<Phil> ASAN works for mac as well, windows seems SOL
18:50:22FromDiscord<the_real_hypno> Could you point me into the address sanitizer direction? Where would i look that up.
18:50:26FromDiscord<the_real_hypno> (edit) "up." => "up?"
18:50:32FromDiscord<the_real_hypno> Just google?
18:51:07FromDiscord<Phil> https://github.com/google/sanitizers/wiki/AddressSanitizerComparisonOfMemoryTools↵That's the repo and also them comparing themselves to other tools
18:51:33FromDiscord<the_real_hypno> Sweet, cheers. Ill read myself into it
18:52:15FromDiscord<Phil> In reply to @the_real_hypno "Sweet, cheers. Ill read": Give me a notice with what you find works on windows. Could be valuable info because I have no clue what you'd be using as a windows user more generally for this sort of thing
18:52:39FromDiscord<the_real_hypno> Will do!
18:58:25*nils` joined #nim
19:07:06FromDiscord<Robyn [She/Her]> Now I'm struggling to figure out how to traverse my AST to validate the original tree :p
19:09:26FromDiscord<System64 ~ Flandre Scarlet> I love the idea of custom destructors↵So you can make a C library, safer
19:09:34FromDiscord<System64 ~ Flandre Scarlet> (edit) "library," => "library" | "librarysafer ... " added "to use"
19:11:35*beholders_eye quit (Ping timeout: 272 seconds)
19:16:01FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#pasty=KyBQBJLy
19:44:10*ntat quit (Quit: Leaving)
19:52:21*coldfeet quit (Remote host closed the connection)
20:01:59*def- quit (Quit: -)
20:02:41*def- joined #nim
20:09:56FromDiscord<Elegantbeef> Probably `{.stackframe:off.}` followed by turning it back on after the proc
20:23:34NimEventerNew thread by ITwrx: Remove first 4 lines from string, see https://forum.nim-lang.org/t/11597
20:30:17FromDiscord<m4ul3r> In reply to @Elegantbeef "Probably `{.stackframe:off.}` followed by": Is this a valid pragma? I'm getting `Error: invalid pragma: stackframe: off` after putting it off before the function and on after
20:36:55FromDiscord<Elegantbeef> stackframes maybe
20:40:49FromDiscord<m4ul3r> hmm also loogs not
20:40:53FromDiscord<m4ul3r> (edit) "loogs" => "looks"
20:43:02FromDiscord<Elegantbeef> Ah I was thinking about stacktrace
20:43:06FromDiscord<Elegantbeef> Which is not what you want
20:56:45*beholders_eye joined #nim
21:13:21*beholders_eye quit (Read error: Connection reset by peer)
21:19:21*beholders_eye joined #nim
21:45:42*sadome joined #nim
21:45:42*sadome quit (Excess Flood)
21:52:39FromDiscord<nocturn9x> quick question
21:52:45FromDiscord<nocturn9x> suppose I wanted to spawn n worker threads
21:52:52FromDiscord<nocturn9x> with `n` being a dynamically provided value
21:53:09FromDiscord<nocturn9x> do I just make a `seq[ref Thread[TArg]]` and add `new Thread[TArg]` to it?
21:53:16FromDiscord<nocturn9x> (edit) "do I just make a `seq[ref Thread[TArg]]` and add ... `new" added "n"
21:54:18FromDiscord<nocturn9x> also, another related question: is passing `Atomic[...]` objects around across threads supported? i.e. will they all share the same underlying state?
21:54:36FromDiscord<nocturn9x> or do I need to turn them into `ptr`s
21:56:20FromDiscord<Elegantbeef> Atomics are stack values so you need to pass them as ptrs
21:56:26FromDiscord<Elegantbeef> Well they're value types rather
21:56:50FromDiscord<nocturn9x> okay
21:56:55FromDiscord<nocturn9x> easy enough
21:57:00FromDiscord<Elegantbeef> Using `seq[ref Thread]` sounds fine but I do not thread much. I've done more sewing than using threads 😄
21:57:12FromDiscord<nocturn9x> hah, okay. Thanks :)
21:58:44FromDiscord<threefour> I'm using the `ref[seq Thead]` approach right now, and it seems to be working fine.
21:58:49FromDiscord<nocturn9x> alrighty
21:58:51FromDiscord<threefour> (edit) "Thead]`" => "Thread]`"
21:59:25FromDiscord<Elegantbeef> It works around the entire resource issue of Nim's `Thread` so it should be fine
21:59:35FromDiscord<Elegantbeef> As long as the seq does not get GC'd while the thread is still alive
21:59:43FromDiscord<Elegantbeef> So ensure the seq outlives any thread operations
21:59:50FromDiscord<nocturn9x> of course
22:00:12FromDiscord<nocturn9x> I assume the thread will still have the issue of thread vars not being collected
22:00:18FromDiscord<nocturn9x> probably not much I can do about that
22:00:41FromDiscord<Elegantbeef> Yep it needs to be changed in the compiler to emit a proc that calls `=destroy` on all `threadvar`s
22:00:57FromDiscord<Elegantbeef> I don't think it's that difficult to do but like I said last time I do not touch cgen 😛
22:01:10FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=QknTCXdL
22:01:15FromDiscord<nocturn9x> do any of these modules use thread vars?
22:01:18FromDiscord<nocturn9x> iirc monotimes does
22:01:21FromDiscord<Elegantbeef> No clue
22:01:36FromDiscord<nocturn9x> would have to look I guess
22:01:38FromDiscord<nocturn9x> _pain-
22:01:40FromDiscord<nocturn9x> (edit) "_pain-" => "_pain_"
22:01:40FromDiscord<Elegantbeef> `import std/[math, times, atomics, algorithm, monotimes, strformat]` is cooler 😛
22:02:33FromDiscord<nocturn9x> debatable :>
22:03:04FromDiscord<nocturn9x> anyway, aside from that thread madness a few days ago, Nim has as always been surprisingly nice to work with
22:03:10FromDiscord<nocturn9x> I hope the issues can be fixed soon
22:03:20FromDiscord<nocturn9x> It's a shame considering the potential it has
22:05:53FromDiscord<Elegantbeef> Yea it's not too complicated of an issue
22:05:54FromDiscord<Elegantbeef> Just requires work
22:09:04*sadome joined #nim
22:09:04*sadome quit (Changing host)
22:09:04*sadome joined #nim
22:09:05*sadome quit (Excess Flood)
22:17:27FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=cmOCSHSh
22:17:29FromDiscord<nocturn9x> would this be correct?
22:22:25FromDiscord<Elegantbeef> Not if they're stack values
22:23:34FromDiscord<nocturn9x> they're not of course
22:23:36FromDiscord<nocturn9x> they're all `ptr`s
22:24:01FromDiscord<Elegantbeef> Right but a pointer is a pointer it does not have to be to the heap
22:24:21FromDiscord<nocturn9x> oh but it's created via `alloc0` on the constructor
22:24:31FromDiscord<nocturn9x> (edit) "on" => "in"
22:25:02FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=nczumXIN
22:26:11FromDiscord<Elegantbeef> Just use create
22:26:19FromDiscord<amjadhd> Are generic enums a thing in Nim ?
22:26:26FromDiscord<nocturn9x> In reply to @Elegantbeef "Just use create": docs?
22:26:31FromDiscord<Elegantbeef> Yesn't
22:26:41FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#create%2Ctypedesc
22:26:54FromDiscord<Elegantbeef> You can add type information but it does not help much
22:27:17FromDiscord<nocturn9x> _The allocated memory belongs to its allocating thread! Use createShared to allocate from a shared heap._↵↵this only applies to MMs with thread-local heaps, I suppose
22:27:27FromDiscord<Elegantbeef> yep
22:27:29FromDiscord<nocturn9x> which ARC is not
22:27:31FromDiscord<nocturn9x> cool
22:27:47FromDiscord<Elegantbeef> Though `createShared` is right there 😄
22:28:15FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=WwyVDAdk
22:28:19FromDiscord<nocturn9x> true, but I clearly don't need it
22:28:34FromDiscord<nocturn9x> or should I use it just in case
22:29:01FromDiscord<nocturn9x> it really isn't terribly nice that changing a critical flag can make or break your code
22:29:04FromDiscord<nocturn9x> (edit) "it really isn't terribly nice that changing a critical ... flag" added "compiler"
22:29:20FromDiscord<nocturn9x> like if someone compiles with `--mm:refc` it'll explode :P
22:29:32FromDiscord<Elegantbeef> Good refc suuuucks
22:29:41FromDiscord<nocturn9x> I agree, but it's not the point :>
22:29:43FromDiscord<nocturn9x> (edit) ":>" => ":<"
22:29:51FromDiscord<nocturn9x> also nim's deferred refcount is pretty clever
22:29:56FromDiscord<nocturn9x> and decently performant too
22:30:15FromDiscord<nocturn9x> it's just not very good for modern memory management, since it doesn't handle cycles anyway
22:30:28FromDiscord<nocturn9x> (although to be fair, neither does ARC)
22:31:00FromDiscord<nocturn9x> also, fun name clashing: some languages define ARC as Atomically Reference Counted, rather than Automatically Reference Counted
22:31:15FromDiscord<nocturn9x> that sparked a confusing conversation about my thread safety issues a while ago
22:32:17FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=bXFvJqTp
22:32:19FromDiscord<nocturn9x> is it a template thing
22:32:25FromDiscord<Elegantbeef> No
22:32:32FromDiscord<Elegantbeef> Robyn just likes having a giggle apparently
22:32:34FromDiscord<Robyn [She/Her]> In reply to @nocturn9x "why the parentheses around": Just did it for clarity
22:32:41FromDiscord<Elegantbeef> I mean it's not that refc is a bad idea
22:32:43FromDiscord<nocturn9x> considering nim's syntax
22:32:48FromDiscord<nocturn9x> I'd say that's a wee bit less clear
22:32:53FromDiscord<Elegantbeef> It's just badly implemented with all of Nim's modern features
22:32:54FromDiscord<nocturn9x> just personal taste though I guess
22:32:55FromDiscord<Robyn [She/Her]> Tho maybe `while cond` is better
22:32:59FromDiscord<nocturn9x> yeah
22:33:03FromDiscord<Robyn [She/Her]> In reply to @nocturn9x "I'd say that's a": How so?
22:33:19FromDiscord<nocturn9x> well, you don't need parentheses around conditionals in nim, so using them here is just confusing imo
22:33:40FromDiscord<Robyn [She/Her]> Don't get how it's confusing, but can add visual noise ig
22:33:45FromDiscord<nocturn9x> yeah, that
22:33:54FromDiscord<nocturn9x> I think it does the opposite of adding clarity, is all
22:34:01FromDiscord<Robyn [She/Her]> Fair
22:37:18*beholders_eye quit (Ping timeout: 268 seconds)
22:44:18FromDiscord<nocturn9x> one question
22:44:42FromDiscord<nocturn9x> would it make sense, to limit resource leaks, to have a private `seq` inside my module that stores the `ref Thread` objects
22:44:48FromDiscord<nocturn9x> and reuse them instead of creating them every time?
22:46:09FromDiscord<polylokh_39446> that makes sense in general since there's an expense just in creating a thread
22:46:20FromDiscord<nocturn9x> yeah, fair enough
22:46:21FromDiscord<zumi.dxy> In reply to @nocturn9x "also, fun name clashing:": maybe it should be named AuRC? :p
22:46:28FromDiscord<nocturn9x> xD
22:46:40FromDiscord<polylokh_39446> it's also a good tunable, the size of your threadpool.
22:46:41FromDiscord<Elegantbeef> Gold RC interesting
22:46:56FromDiscord<nocturn9x> In reply to @polylokh_39446 "it's also a good": that is determined via UCI options, but yes
22:47:01FromDiscord<nocturn9x> I can add and remove workers at my leisure
22:49:07FromDiscord<nocturn9x> since when is `high` deprecated for seqs??
22:49:30FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=hevABZFR
22:50:00FromDiscord<nocturn9x> I don't think that `high()` is the same one I mean, haha (aka `len() - 1`)
22:51:06FromDiscord<Elegantbeef> You're doing `high(type)`
22:51:16FromDiscord<nocturn9x> ah, what a dumbass I am. I have shadowed `workers` (a seq), with an `int`
22:51:24FromDiscord<nocturn9x> facepalm
22:51:49FromDiscord<nocturn9x> I was so confused
22:54:36FromDiscord<nocturn9x> question
22:54:46FromDiscord<nocturn9x> does `deepCopy()` copy pointers or does it copy the underlying values too
22:55:02FromDiscord<nocturn9x> I need to pass basically a copy of `self` but with some values changed to multiple threads
22:55:20FromDiscord<nocturn9x> but I want the pointers to stay shared
22:55:29FromDiscord<Elegantbeef> I don't think deep copy deep copies pointers
22:55:36FromDiscord<nocturn9x> okay so they should stay the same
22:55:37FromDiscord<Elegantbeef> Only refs
22:55:41FromDiscord<nocturn9x> gotcha
23:07:44FromDiscord<nocturn9x> question
23:07:46FromDiscord<nocturn9x> can I pass `var T` to threads
23:07:59FromDiscord<nocturn9x> I'm getting weird type errors in `createThread`
23:08:01FromDiscord<Elegantbeef> No cause `var T` is not a valid field type
23:08:17FromDiscord<nocturn9x> got it
23:12:18FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=NBhyyrRX
23:12:20FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=ONZKBvEg
23:13:04FromDiscord<nocturn9x> (edit) "https://play.nim-lang.org/#pasty=IbjEHrDo" => "https://play.nim-lang.org/#pasty=ORkqgknC"
23:14:32FromDiscord<nocturn9x> ah ups
23:14:43FromDiscord<nocturn9x> I'm not passing it the proc....
23:14:47FromDiscord<nocturn9x> what an idiot x2
23:14:54FromDiscord<nocturn9x> it's late, I apologize for the noise
23:15:16FromDiscord<nocturn9x> it would be nice if nim made arity issues more clear
23:32:51*xet7 quit (Ping timeout: 256 seconds)
23:34:18*jmdaemon joined #nim
23:40:10FromDiscord<nocturn9x> wow, this was surprisingly painless
23:40:29FromDiscord<nocturn9x> haven't done any extensive testing but other than an out of bounds access cuz I'm stupid, I pretty much just wrote the code and it worked
23:40:30FromDiscord<nocturn9x> _neat_
23:40:53FromDiscord<Elegantbeef> Just mark all your thread procs as `raises: []` for style points
23:41:56FromDiscord<nocturn9x> XDD
23:45:08*xet7 joined #nim
23:57:13FromDiscord<Robyn [She/Her]> In reply to @nocturn9x "it's late, I apologize": Noise as in using the channel? Don't see why it'd be an issue aha