00:01:48 | * | lucasta quit (Quit: Leaving) |
00:06:06 | * | gst quit (Ping timeout: 250 seconds) |
00:09:57 | * | def- quit (Quit: -) |
00:15:47 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=loeGMPgX |
00:22:15 | FromDiscord | <Elegantbeef> Yea the word `lerp` |
00:22:20 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=meAZJaWO |
00:22:32 | FromDiscord | <Elegantbeef> Linear interpolation |
00:22:45 | FromDiscord | <Elegantbeef> It mixes two values together by `t` |
00:22:54 | FromDiscord | <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:51 | FromDiscord | <maxtachine> In reply to @polylokh_39446 "when you pass ": Damn ty, I'll try later👍 |
00:46:11 | FromDiscord | <Robyn [She/Her]> Ah |
00:48:49 | FromDiscord | <that_dude.> I thought operators only go up to binary |
00:57:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=xZfOrcIm |
01:10:52 | NimEventer | New Nimble package! nudates - Some useful tools when working with dates., see https://github.com/GeK2K/nudates |
01:24:04 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=WnrWoeDT |
01:25:03 | FromDiscord | <Elegantbeef> Please don't use operators |
01:25:36 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Please don't use operators": even for binary ops? |
01:26:23 | * | lucasta joined #nim |
01:27:31 | FromDiscord | <Elegantbeef> Unless they're mathematical types |
01:27:47 | FromDiscord | <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:05 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Unless they're mathematical types": This can work for numbers |
01:56:54 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=BfVGLLqo |
01:57:44 | FromDiscord | <maxtachine> does anyone know how I could read a file that is used by another usermode process? |
01:58:12 | FromDiscord | <maxtachine> I was trying to read it using mapped files |
01:58:21 | FromDiscord | <maxtachine> but got an error on MapViewOfFile |
02:00:19 | FromDiscord | <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:02 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "Nim" => "Nim, or something like this" |
02:01:35 | FromDiscord | <System64 ~ Flandre Scarlet> like [a, b]: t for exemple |
02:11:16 | FromDiscord | <Elegantbeef> Damn it @System64 ~ Flandre Scarlet don't encourage unreadable code 😄 |
02:15:04 | * | beholders_eye quit (Ping timeout: 268 seconds) |
02:39:15 | FromDiscord | <kots> sent a code paste, see https://play.nim-lang.org/#pasty=AEjIseYM |
02:39:16 | FromDiscord | <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:54 | FromDiscord | <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:12 | NimEventer | New 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:16 | FromDiscord | <morgan> how can i get a var float from a ptr uncheckedarray float? |
05:06:29 | FromDiscord | <Elegantbeef> `arr[ind][]` |
05:07:18 | FromDiscord | <morgan> oh i misread the error message, it was adding a f32 to f64 conversion for me |
05:07:30 | FromDiscord | <morgan> and complained that the converted float was immutable |
05:08:19 | FromDiscord | <morgan> i guess ill create a var copy of the value before passing it in and handle conversion afterwards |
05:11:09 | FromDiscord | <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:32 | FromDiscord | <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:51 | FromDiscord | <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:23 | FromDiscord | <Elegantbeef> Make a constructor procedure that is `proc init(_: typedesc[T], ...): T` |
05:49:40 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/wiki/Code-snippets#check-if-top-level @madonuko |
05:50:46 | FromDiscord | <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:29 | FromDiscord | <pusewicz> In reply to @Elegantbeef "Make a constructor procedure": Is this an answer to my question? |
06:08:35 | FromDiscord | <Elegantbeef> Yes |
06:09:01 | FromDiscord | <pusewicz> Might need some more help explaining this, as I'm new to Nim. |
06:09:30 | FromDiscord | <Elegantbeef> Well the above format is the best way to define a constructor as it allows more code reuse |
06:09:44 | FromDiscord | <Elegantbeef> You can just do `proc initMyType(...): MyType = ....` |
06:09:50 | FromDiscord | <Elegantbeef> But that does not work with generics |
06:10:25 | FromDiscord | <Elegantbeef> Otherwise you just define a procedure that increments a counter and returns the value |
06:10:46 | FromDiscord | <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:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=vbWEEKfa |
06:11:17 | FromDiscord | <Elegantbeef> You can either use `{.global.}` or just use a top level variable |
06:11:45 | FromDiscord | <Elegantbeef> Then you now do `MyType.init()` instead of `MyType()` everywhere |
06:12:28 | FromDiscord | <pusewicz> sent a code paste, see https://play.nim-lang.org/#pasty=rfLbVPgB |
06:12:50 | FromDiscord | <pusewicz> Oh, `inc` does not return the value |
06:13:14 | FromDiscord | <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:37 | FromDiscord | <Elegantbeef> `result = Cell(x: x, y: y, tiles: tiles)` |
06:15:37 | FromDiscord | <Elegantbeef> Also should do `tiles: sink seq[Tile]` so you can avoid some compies |
06:16:04 | FromDiscord | <Elegantbeef> Also also `neighbours can just be a `array[Direction, seq[Cell]\` |
06:16:10 | FromDiscord | <Elegantbeef> Whoops |
06:16:22 | FromDiscord | <Elegantbeef> Also also also `ref Cell` is redundant unless you want two pointers |
06:16:49 | FromDiscord | <pusewicz> Well it was complaining about illegal recursion |
06:16:53 | FromDiscord | <pusewicz> if there was no ref |
06:16:53 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=pSssCEJO |
06:18:07 | FromDiscord | <Elegantbeef> Are you sure you did not have `Cell = object` and then tried that |
06:21:28 | FromDiscord | <Elegantbeef> Someone clearly regrets asking their question 😄 |
06:21:57 | FromDiscord | <pusewicz> Hmmm, seems to work with `array` |
06:22:05 | FromDiscord | <Elegantbeef> Will work with table aswell |
06:22:28 | FromDiscord | <pusewicz> Thanks so much, I gotta go and digest all the tips you provided haha |
06:22:58 | FromDiscord | <Elegantbeef> The issue is the default expression as far as I can tell |
06:23:24 | FromDiscord | <pusewicz> so how should `newCell` look like then? Or should I call it `new`? |
06:23:43 | FromDiscord | <Elegantbeef> But good thing that `Table[enum, T]` is a bad idea in Nim since we have `array[enum, Option[T]]` 😄 |
06:23:50 | FromDiscord | <Elegantbeef> That's what I'd suggest |
06:24:14 | FromDiscord | <Elegantbeef> I generally prefer enabling any generic code, but I do not always abide when a type is meant to be hidden |
06:24:37 | FromDiscord | <Elegantbeef> When you do not use overloading you make it pretty much impossible to play with generics |
06:26:12 | FromDiscord | <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:12 | FromDiscord | <Elegantbeef> There is no single monomorphic solution there |
06:26:12 | FromDiscord | <Elegantbeef> Now if it was `seq[T].new()` and `Table[K,V].init()` we can work with this |
06:26:38 | FromDiscord | <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:38 | FromDiscord | <pusewicz> If I rename `newCell` to `new` can I then create objects with `Cell()`? `new` is the default constructor name? |
06:32:59 | FromDiscord | <Elegantbeef> `new` is just a proc |
06:33:03 | FromDiscord | <Elegantbeef> You have to call `Cell.new()` everywhere |
06:33:07 | FromDiscord | <pusewicz> Ah, ok. |
06:33:16 | FromDiscord | <Elegantbeef> Nim does not have default constructors(except for the ones they do) |
06:33:23 | FromDiscord | <odexine> beef is just basically advocating for a better way to define constructors really |
06:33:58 | FromDiscord | <Elegantbeef> If you want a pretend example showcasing the benefit I can provide it 😄 |
06:34:05 | FromDiscord | <pusewicz> Please do! |
06:34:38 | FromDiscord | <pusewicz> I can provide a gist with my current obj, and you could provide the reference implementation:P |
06:34:59 | FromDiscord | <pusewicz> https://gist.github.com/pusewicz/77b5b009ee2a66e315bdc20186e3d1c3 |
06:38:11 | FromDiscord | <pusewicz> https://nim-lang.org/docs/destructors.html#sink-parameters <- this is what I should read regarding `sink`? |
06:38:24 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=HGdvtcQa here you go for the pretend example |
06:38:24 | FromDiscord | <Elegantbeef> Yea |
06:41:57 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=AExwzyPQ here's my take on your code |
06:42:40 | FromDiscord | <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:10 | FromDiscord | <Elegantbeef> Or do I just have to write my own test suite using Pixie 😄 |
06:47:50 | * | PMunch joined #nim |
06:50:51 | FromDiscord | <odexine> "A vs B image testing" |
06:50:52 | FromDiscord | <odexine> ? |
06:51:22 | FromDiscord | <Elegantbeef> Yes "Does this picture match this picture, if not save the image difference" |
06:55:33 | FromDiscord | <pusewicz> http://phash.org |
06:56:15 | FromDiscord | <Elegantbeef> Is that meant for me? |
06:57:18 | FromDiscord | <Elegantbeef> That might be a good solution for making my own test suite. I was going to just manually compare each pixel |
07:00:28 | FromDiscord | <nnsee> i think just manually comparing with pixie or something is the least-effort way |
07:00:38 | FromDiscord | <nnsee> not sure what you define as "difference", though |
07:01:09 | FromDiscord | <Elegantbeef> Images should be identical if they're not highlight the differences in a new debug picture |
07:01:28 | FromDiscord | <nnsee> i see |
07:08:29 | FromDiscord | <odexine> pixel perfect identical? |
07:08:43 | FromDiscord | <Elegantbeef> Yea I am trying to ensure rendering does not go astray |
07:09:17 | FromDiscord | <odexine> perceptual hashes work but you can prolly go with any normal hash |
07:09:40 | FromDiscord | <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:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @morganalyssa "imo if you wanna": Any exemple? |
07:16:14 | FromDiscord | <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:36 | FromDiscord | <nnsee> hashes will match if _content_ is the same, but not necessarily the pixels themselves |
07:17:12 | FromDiscord | <nnsee> the phashes of two images will match even if one of the images is rotated 90 degrees, for example |
07:17:37 | FromDiscord | <nnsee> iirc it's used mostly to detect CSAM |
07:19:10 | FromDiscord | <pusewicz> @ElegantBeef I'm puzzled now `array[Direction, seq[Cell]]` does this allow me to define all 4 directions with this? |
07:19:22 | FromDiscord | <Elegantbeef> Yes Nim has enum indexed arrays |
07:19:31 | FromDiscord | <Elegantbeef> They're a 0 cost abstraction |
07:19:47 | FromDiscord | <pusewicz> Holy shit. |
07:19:51 | FromDiscord | <Elegantbeef> Which allow for the same syntax as `Table[Direction, seq[Cell]]` |
07:19:57 | FromDiscord | <Elegantbeef> But without the hash overhead |
07:20:13 | FromDiscord | <pusewicz> https://github.com/beef331/nimtrest/wiki/Code-snippets#enum-indexed-array ah |
07:20:15 | FromDiscord | <Elegantbeef> And without the manually doing `arr[YourEnum.ord]` of `array[4, T]` |
07:20:48 | FromDiscord | <pusewicz> This is cool |
07:20:56 | FromDiscord | <pusewicz> I feel like a kid learning programming again |
07:21:46 | FromDiscord | <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:25 | FromDiscord | <Elegantbeef> Ah I wrote a shitty WFC eons ago |
07:22:36 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/wavefunctioncollapse.nim if you care to see |
07:25:45 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=IzSQuHMj |
07:26:42 | FromDiscord | <Elegantbeef> Are you later using `logLvlTrace` in a const? |
07:27:10 | FromDiscord | <madonuko> thats… a very hard question |
07:27:28 | FromDiscord | <madonuko> uhh I'm using it in templates I guess |
07:27:31 | FromDiscord | <madonuko> I don't think that counts |
07:27:58 | FromDiscord | <pusewicz> Oooh, can I defined a proc called `tiles=` so that I could do `cell.tiles = @[...]` ? |
07:28:06 | FromDiscord | <pusewicz> (edit) "defined" => "define" |
07:28:07 | FromDiscord | <Elegantbeef> Yes |
07:28:18 | FromDiscord | <pusewicz> YES. |
07:28:23 | FromDiscord | <pusewicz> OMG, this is great. |
07:29:06 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1239479518935388230/image.png?ex=664312c1&is=6641c141&hm=582468eb8392612431912e5744b72d770dabb8553fb38329288a146f9042b49d& |
07:29:08 | FromDiscord | <Elegantbeef> This is what that wfc does btw |
07:29:28 | FromDiscord | <pusewicz> sent a code paste, see https://play.nim-lang.org/#pasty=oGkesmJQ |
07:29:46 | FromDiscord | <Elegantbeef> Complaining about it how |
07:30:19 | * | ntat joined #nim |
07:30:30 | FromDiscord | <pusewicz> invalid type `sink seq[Tile]` in this context: 'Cell' for result (line with self.tiles = tiles) (I use nimcheck) |
07:31:37 | FromDiscord | <Elegantbeef> Now what about the compiler? |
07:32:01 | FromDiscord | <pusewicz> Same |
07:32:53 | FromDiscord | <Elegantbeef> you didn't make `Cell`'s `tiles` a `sink` did you, cause that's wrong |
07:33:22 | FromDiscord | <Robyn [She/Her]> Shouldn't `Cell` be `var Cell`? |
07:33:32 | FromDiscord | <pusewicz> Ah, I did. |
07:33:52 | FromDiscord | <Robyn [She/Her]> Ah it's a ref object ignore me |
07:34:25 | FromDiscord | <Elegantbeef> Heh I did that |
07:34:25 | FromDiscord | <Elegantbeef> My bad 😄 |
07:34:25 | FromDiscord | <Elegantbeef> Remove `sink` inside the object |
07:34:29 | FromDiscord | <ElegantBeef> It's bad when I can tell the bridge slowed down |
07:36:54 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=HcQiyOqD |
07:37:14 | FromDiscord | <Elegantbeef> Time to use delayed imports |
07:37:44 | FromDiscord | <Elegantbeef> Damn I have a snippet for it |
07:37:45 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/wiki/Code-snippets#delayed-imports |
07:37:53 | FromDiscord | <Elegantbeef> This wiki was ingenous |
07:38:21 | FromDiscord | <madonuko> nvm I placed everything in a file, fixed everything and it somehow appears again in another file |
07:38:39 | FromDiscord | <Elegantbeef> and you're not trying to pass it to a `static` or `const`? |
07:39:09 | FromDiscord | <madonuko> nope |
07:39:30 | FromDiscord | <Elegantbeef> Well I feel lied to by either you or the compiler |
07:40:57 | FromDiscord | <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:24 | FromDiscord | <madonuko> you get lied to by nim I guess |
07:42:24 | FromDiscord | <Elegantbeef> Or you're passing it to a proc you didn't define that expects `static` 😛 |
07:45:55 | * | gst joined #nim |
07:53:15 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> No it was my idea and my idea a lone |
07:53:43 | FromDiscord | <Robyn [She/Her]> We told you to post your code snippets |
07:53:49 | FromDiscord | <Elegantbeef> Nope |
07:53:50 | FromDiscord | <Elegantbeef> Never |
07:53:55 | FromDiscord | <Robyn [She/Her]> Mhm sureeeee :) |
07:54:52 | FromDiscord | <Elegantbeef> Do I know you? |
07:56:00 | FromDiscord | <Robyn [She/Her]> Indeed you do, my friend |
07:56:23 | FromDiscord | <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:37 | FromDiscord | <starkiller1493> (edit) "dhash," => "phash," |
07:56:37 | FromDiscord | <Elegantbeef> dhash is faster than dhash |
07:56:42 | FromDiscord | <Elegantbeef> You heard it here first folks |
07:56:57 | FromDiscord | <starkiller1493> minor typo 🫡 💀 |
07:57:01 | * | KhazAkar quit (Remote host closed the connection) |
07:58:47 | FromDiscord | <madonuko> In reply to @Elegantbeef "dhash is faster than": you are giving me import conflict vibes |
07:58:58 | * | KhazAkar joined #nim |
07:59:02 | FromDiscord | <odexine> In reply to @Elegantbeef "No it was my": a lone what |
07:59:05 | FromDiscord | <madonuko> that's exactly what I was dealing with with my own implementation of `debug()` and the one from `std/macros` |
07:59:10 | FromDiscord | <Elegantbeef> I knew it rika |
07:59:15 | FromDiscord | <Elegantbeef> One accidental space |
07:59:16 | FromDiscord | <Elegantbeef> One! |
07:59:38 | FromDiscord | <madonuko> In reply to @Elegantbeef "One accidental space": and your friend `nim` complains about it |
07:59:46 | FromDiscord | <Elegantbeef> So then do `import std/macros except debug` |
07:59:48 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "One accidental space": Throw shit, get shit :> |
07:59:53 | FromDiscord | <madonuko> In reply to @Elegantbeef "So then do `import": I did |
07:59:58 | FromDiscord | <odexine> you know ive seen so many errors from you but decided to leave them as is |
08:00:11 | FromDiscord | <madonuko> but it still says cannot eval at compile time |
08:00:13 | FromDiscord | <odexine> In reply to @chronos.vitaqua "Throw shit, get shit": shitflinger central this is is it |
08:00:13 | FromDiscord | <Elegantbeef> I know when I make airs! |
08:00:21 | FromDiscord | <madonuko> soooooooo that's not the only issue |
08:00:47 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "shitflinger central this is": Indeed it is! |
08:00:49 | FromDiscord | <Elegantbeef> Rika is just up set that I make miss steaks |
08:00:50 | FromDiscord | <odexine> madomado would it be ok to post full code if possible |
08:01:07 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=QutPsGkU |
08:01:16 | FromDiscord | <odexine> In reply to @Elegantbeef "Rika is just up": how sweet of you to make your missy some steaks |
08:01:21 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Rika is just up": Beef how much sleep did you get? :P |
08:01:29 | FromDiscord | <Elegantbeef> I get all the sleep I need |
08:01:41 | FromDiscord | <madonuko> In reply to @odexine "madomado would it be": it's something like 200 lines of code |
08:01:45 | FromDiscord | <odexine> 200 is nothing |
08:01:47 | FromDiscord | <Elegantbeef> Well send it |
08:01:59 | FromDiscord | <Elegantbeef> I can process 200 lines of code like 1 cob of corn |
08:02:00 | FromDiscord | <madonuko> hold on then |
08:02:02 | FromDiscord | <nnsee> In reply to @madonuko "it's something like 200": use https://play.nim-lang.org |
08:02:11 | FromDiscord | <madonuko> In reply to @nnsee "use https://play.nim-lang.org": it's nimscript |
08:02:20 | FromDiscord | <Elegantbeef> Well there's your problem |
08:02:21 | FromDiscord | <odexine> i think we found the issue |
08:02:47 | FromDiscord | <madonuko> I mean yeah… it's like submerging yourself in the ocean unknown |
08:03:02 | FromDiscord | <Elegantbeef> It's more like making a soup spoon out of gallium |
08:03:10 | FromDiscord | <Elegantbeef> It sorta works, but it just makes your soup full of metal |
08:03:19 | FromDiscord | <madonuko> well it's not toxic |
08:03:20 | Amun-Ra | but not of titanium |
08:03:24 | FromDiscord | <madonuko> so more like mercury |
08:03:28 | FromDiscord | <odexine> what if my bowl was aluminum |
08:03:38 | FromDiscord | <Elegantbeef> That's still the least of your worries |
08:04:02 | FromDiscord | <Elegantbeef> If you wanted to have soup but your spoons kept melting, that's just awful |
08:04:03 | FromDiscord | <odexine> what if i were aluminum |
08:04:14 | FromDiscord | <odexine> In reply to @Elegantbeef "If you wanted to": just drink off the bowl wdym |
08:04:17 | Amun-Ra | what if you were aluminium |
08:04:27 | FromDiscord | <Elegantbeef> It's like the soup of Tantalus |
08:05:05 | FromDiscord | <odexine> what about tantalum |
08:05:34 | FromDiscord | <Elegantbeef> Who cares what you're made of, it's who you are that matters! |
08:05:39 | FromDiscord | <odexine> mmm capacitor soup |
08:05:42 | FromDiscord | <Elegantbeef> And you're clearly a dipshit! |
08:06:28 | FromDiscord | <odexine> eww why would i dip shit in my soup |
08:06:36 | FromDiscord | <madonuko> how did we went from nimscripting to souping |
08:06:41 | FromDiscord | <madonuko> (edit) "went" => "go" |
08:07:00 | FromDiscord | <odexine> close call there |
08:07:10 | FromDiscord | <odexine> anyway basically nimscript is what's used on compile time |
08:07:23 | FromDiscord | <odexine> a lot of errors that say "compile time" also apply when you're using things in nimscript |
08:08:23 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#pasty=yCoQWNiO |
08:09:11 | FromDiscord | <madonuko> In reply to @odexine "i dont really know": it just runs it |
08:09:14 | FromDiscord | <madonuko> (?) |
08:11:31 | FromDiscord | <madonuko> I have to say nim's pretty bad at compile time errors or something |
08:13:09 | FromDiscord | <odexine> yeah |
08:13:11 | FromDiscord | <odexine> has been for years |
08:13:13 | FromDiscord | <odexine> sorry to say |
08:13:16 | FromDiscord | <madonuko> AFTER A BUNCH OF COMMENTING |
08:13:22 | FromDiscord | <madonuko> I'VE FOUND THE LINE THAT CAUSES THE ISSUE |
08:13:38 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=qUvSbEUu |
08:13:40 | FromDiscord | <madonuko> ????? |
08:14:05 | FromDiscord | <odexine> you shouldnt import os in nimscript i think |
08:14:29 | FromDiscord | <madonuko> ok yeah it has something to do with std/times |
08:14:31 | FromDiscord | <madonuko> can't import that |
08:15:21 | FromDiscord | <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:36 | FromDiscord | <odexine> might have forgor |
08:15:45 | FromDiscord | <odexine> or my knowledge is too old |
08:15:49 | FromDiscord | <madonuko> rip |
08:17:41 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=mvTXGZav |
08:17:43 | FromDiscord | <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:34 | FromDiscord | <madonuko> ~~I'm at the third level~~ |
08:18:49 | FromDiscord | <nnsee> you guys remember things? |
08:18:54 | * | PMunch joined #nim |
08:18:58 | FromDiscord | <madonuko> In reply to @nnsee "you guys remember things?": bulb |
08:19:20 | * | m5zs7k joined #nim |
08:21:57 | FromDiscord | <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:06 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=wEpNHTKz |
10:27:37 | FromDiscord | <madonuko> (edit) "https://play.nim-lang.org/#pasty=ZGxClNOw" => "https://play.nim-lang.org/#pasty=PRecqCpJ" |
10:28:25 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=mhUdPPHM |
10:28:42 | FromDiscord | <madonuko> there is no way `taskname` is undeclared |
10:34:01 | FromDiscord | <System64 ~ Flandre Scarlet> Is there a way to pass a nil string? |
10:36:30 | FromDiscord | <solitudesf> In reply to @sys64 "Is there a way": no, whats the usecase? |
10:37:24 | * | def- joined #nim |
10:38:09 | FromDiscord | <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:22 | FromDiscord | <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:21 | FromDiscord | <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:38 | FromDiscord | <solitudesf> In reply to @sys64 "This is what I": make an overload without string paramter that passes nil instead? |
10:45:43 | FromDiscord | <solitudesf> (edit) "paramter" => "parameter" |
10:46:54 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @solitudesf "make an overload without": That I can do |
10:47:10 | FromDiscord | <System64 ~ Flandre Scarlet> Or use an optional |
10:51:36 | * | coldfeet joined #nim |
10:54:50 | FromDiscord | <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:31 | FromDiscord | <System64 ~ Flandre Scarlet> What is the best for passing a nil string?↵Procedure overload?↵Empty string to Nil?↵Option[string]? |
11:15:30 | FromDiscord | <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:21 | FromDiscord | <Robyn [She/Her]> In reply to @sys64 "Some Tilengine functions I": Use `std/options` for `Option` types |
11:33:52 | FromDiscord | <Robyn [She/Her]> In reply to @sys64 "What is the best": Overloading looks nicer, in my opinion |
11:34:28 | FromDiscord | <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:36 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=ngwHqMNj |
11:35:04 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=UuEUbHlP |
11:35:11 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#pasty=XLJaJonj" => "https://play.nim-lang.org/#pasty=XvgbHcjY" |
11:36:57 | FromDiscord | <solitudesf> sent a code paste, see https://play.nim-lang.org/#pasty=vJrtBXlh |
11:37:16 | FromDiscord | <System64 ~ Flandre Scarlet> options has a lot of overhead? |
11:37:51 | FromDiscord | <solitudesf> it has some overhead, if you dont need the option, why pay for it anyway. |
11:38:26 | FromDiscord | <System64 ~ Flandre Scarlet> I can do an overload then |
11:39:04 | FromDiscord | <Robyn [She/Her]> In reply to @solitudesf "if you already can": Reuse of logic |
11:39:23 | FromDiscord | <Robyn [She/Her]> I don't have to duplicate the proc body |
11:39:25 | FromDiscord | <solitudesf> In reply to @chronos.vitaqua "Reuse of logic": put the login in template instead, if you want to reuse it |
11:39:47 | FromDiscord | <Robyn [She/Her]> True, that is an option |
11:40:57 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "True, that *is* an": Should I use options or overloads? |
11:44:49 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=MbbwTEJs |
11:48:45 | FromDiscord | <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:14 | FromDiscord | <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:14 | FromDiscord | <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:44 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @polylokh_39446 "if this is a": the default would be nil |
11:51:58 | FromDiscord | <System64 ~ Flandre Scarlet> like the proc declarations I just posted above |
11:52:06 | FromDiscord | <polylokh_39446> strings aren't nillable, and most things aren't in Nim. |
11:52:52 | FromDiscord | <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:20 | FromDiscord | <polylokh_39446> one overload can call the other. |
11:53:34 | FromDiscord | <polylokh_39446> for this specific function I think the better route is `layername: cstring = nil` |
11:54:12 | FromDiscord | <madonuko> I think I broke nimble |
11:54:31 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=fSDjsqqD |
11:54:56 | FromDiscord | <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:33 | FromDiscord | <polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=cqwoCSmE |
11:56:19 | FromDiscord | <polylokh_39446> that makes sense I guess, since the conversion requires a copy. |
11:56:45 | FromDiscord | <solitudesf> sent a code paste, see https://play.nim-lang.org/#pasty=ckosfQqs |
11:57:08 | FromDiscord | <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:39 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=XYsPOKbj |
12:11:47 | FromDiscord | <Robyn [She/Her]> In reply to @polylokh_39446 "it would still be": Avoid nil at all costs, imo |
12:12:23 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "Avoid nil at all": So for you I should use Options instead of overloading? |
12:13:00 | FromDiscord | <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:04 | FromDiscord | <Robyn [She/Her]> Be enough |
12:14:42 | FromDiscord | <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:47 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=ZftLpUIK |
12:20:02 | FromDiscord | <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:01 | FromDiscord | <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:13 | FromDiscord | <polylokh_39446> the first string is required and the second isn't. The consistency is across the optional things. |
12:25:43 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=KlqXHTlH |
12:27:58 | FromDiscord | <polylokh_39446> it's fine. You can write that as `"layername".some` as well |
12:28:59 | FromDiscord | <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:34 | FromDiscord | <polylokh_39446> not without a converter, which I wouldn't suggest just to make that function cleaner |
12:31:47 | FromDiscord | <polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=JZDfdhLh |
12:32:23 | FromDiscord | <solitudesf> In reply to @polylokh_39446 "another alternative is the": ah hell nah |
12:32:32 | FromDiscord | <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:01 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @polylokh_39446 "tileLoader returns an object,": Is that something we see often in Nim? |
12:35:29 | FromDiscord | <polylokh_39446> it's something you see in any language. |
12:35:43 | FromDiscord | <System64 ~ Flandre Scarlet> Method chaining is elegant |
12:37:01 | FromDiscord | <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:24 | FromDiscord | <solitudesf> In reply to @sys64 "Is that something we": absolutely not |
12:38:08 | FromDiscord | <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:40 | FromDiscord | <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:10 | FromDiscord | <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:17 | FromDiscord | <System64 ~ Flandre Scarlet> the hardest thing in programming is to make the best decisions |
12:39:31 | FromDiscord | <polylokh_39446> no the hardest things in programming are cache invalidation and good names. |
12:39:43 | FromDiscord | <System64 ~ Flandre Scarlet> Cache invalitation 😬 |
12:39:57 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "invalitation" => "invalidation" |
12:39:59 | FromDiscord | <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:55 | FromDiscord | <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:37 | FromDiscord | <System64 ~ Flandre Scarlet> kaboom |
12:42:01 | FromDiscord | <System64 ~ Flandre Scarlet> Anyways↵I used overloading |
12:42:19 | FromDiscord | <System64 ~ Flandre Scarlet> because the less the user must write, the better |
12:51:39 | * | xutaxkamay joined #nim |
12:57:48 | FromDiscord | <madonuko> anyone knows what `{.callsite.}` does exactly? |
13:00:41 | * | def- quit (Quit: -) |
13:01:58 | NimEventer | New 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:13 | FromDiscord | <_nenc> In reply to @sys64 "and can I do": you can make it a generic parameter and convert it inside function |
13:40:59 | FromDiscord | <_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:55 | FromDiscord | <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:34 | PMunch | I think that's the best way of doing it |
13:53:07 | PMunch | Would 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:12 | FromDiscord | <madonuko> I'm moving here |
14:34:19 | FromDiscord | <madonuko> I've no idea what's happening in offtopic I'm sorry |
14:34:39 | FromDiscord | <madonuko> anyone here has any particular complains for missing features in nimscript |
14:34:41 | FromDiscord | <odexine> dont worry about it |
14:34:48 | FromDiscord | <madonuko> might consider adding into my new pkg |
14:34:56 | FromDiscord | <odexine> In reply to @madonuko "anyone here has any": i believe a lot of people get bit by the lack of FFI |
14:34:58 | FromDiscord | <odexine> oh |
14:35:02 | FromDiscord | <odexine> you mean things to add |
14:35:25 | FromDiscord | <madonuko> yeah… |
14:35:44 | FromDiscord | <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:11 | FromDiscord | <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:18 | FromDiscord | <Robyn [She/Her]> https://github.com/heysokam/confy/tree/master |
14:37:56 | FromDiscord | <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:00 | FromDiscord | <madonuko> > Confy is a buildsystem for compiling code with ZigCC.↵<insert wow emoji> |
14:38:10 | FromDiscord | <Robyn [She/Her]> I haven't used it personally but sOkam makes high quality stuff |
14:38:29 | FromDiscord | <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:40 | FromDiscord | <Robyn [She/Her]> In reply to @madonuko "> Confy is a": It uses ZigCC because it enables much easier crosscompilation |
14:38:51 | FromDiscord | <Robyn [She/Her]> Might be possible to configure it to use your own C compiler but that's something to ask them |
14:38:59 | FromDiscord | <Robyn [She/Her]> In reply to @madonuko "I was like what": I'm very bad at phrasing shit, sorry :P |
14:39:01 | FromDiscord | <madonuko> holy gosh https://media.discordapp.net/attachments/371759389889003532/1239587711044817007/x7CvQvz.png?ex=66437784&is=66422604&hm=73c2e11025ad86663348742952f662b458c341d64d495b5faecf6434e0697485& |
14:39:07 | FromDiscord | <madonuko> this person is crazy |
14:39:15 | FromDiscord | <albassort> whats go--- |
14:39:16 | FromDiscord | <albassort> what the fuck |
14:39:54 | FromDiscord | <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:55 | FromDiscord | <Robyn [She/Her]> In reply to @madonuko "this person is crazy": Crazy but good :P |
14:40:03 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "what the fuck": ? |
14:40:41 | FromDiscord | <madonuko> oh so what it does is basically |
14:40:54 | FromDiscord | <madonuko> compiling a program written in C to Nim |
14:41:07 | FromDiscord | <albassort> https://github.com/heysokam/minc |
14:41:09 | FromDiscord | <albassort> what is this |
14:41:15 | * | xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in) |
14:41:39 | FromDiscord | <madonuko> In reply to @albassort "what is this": well… read the description? |
14:41:42 | FromDiscord | <Robyn [She/Her]> In reply to @madonuko "compiling a program written": No? It provides functions that compile C/C++/Nim code |
14:41:48 | FromDiscord | <albassort> why is this |
14:41:57 | FromDiscord | <madonuko> In reply to @chronos.vitaqua "No? It provides functions": what. |
14:42:04 | FromDiscord | <madonuko> oh |
14:42:07 | FromDiscord | <madonuko> ohhhh |
14:42:09 | * | xutaxkamay joined #nim |
14:42:14 | FromDiscord | <madonuko> so it's basically build.rs in nim |
14:42:20 | FromDiscord | <madonuko> or Makefile |
14:42:21 | FromDiscord | <madonuko> something like that |
14:42:21 | * | coldfeet joined #nim |
14:42:23 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "why is this": A language using Nim's AST, that generates C code :P |
14:42:32 | FromDiscord | <Robyn [She/Her]> In reply to @madonuko "so it's basically build.rs": Yeah exactly like that |
14:42:33 | FromDiscord | <albassort> why not just use nim tho |
14:42:36 | FromDiscord | <Robyn [She/Her]> Sorry for my poor wording |
14:42:37 | FromDiscord | <albassort> :| |
14:42:40 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "why not just use": 🤷♀️ |
14:42:47 | FromDiscord | <albassort> >>:( |
14:42:49 | FromDiscord | <madonuko> In reply to @chronos.vitaqua "Sorry for my poor": don't mind |
14:43:45 | FromDiscord | <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:05 | FromDiscord | <albassort> @Robyn [She/Her] fact check this logic |
14:44:10 | FromDiscord | <madonuko> w-wha |
14:44:20 | FromDiscord | <albassort> is that the same logic? |
14:44:34 | FromDiscord | <Robyn [She/Her]> Not the same logic but gets the point across ig? |
14:44:40 | FromDiscord | <albassort> hmmm |
14:44:45 | FromDiscord | <Robyn [She/Her]> When you ask why, my logic is: "Why not?" |
14:44:55 | * | coldfeet quit (Remote host closed the connection) |
14:44:58 | FromDiscord | <albassort> that is the correct logic |
14:45:03 | FromDiscord | <albassort> although |
14:45:18 | FromDiscord | <albassort> maybe if it ran on a nim JIT so its a scripted language |
14:45:20 | FromDiscord | <albassort> would be cool |
14:45:23 | FromDiscord | <Robyn [She/Her]> sOkam just wanted a language that is basically C, but just a tad nicer to use for him |
14:45:37 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "maybe if it ran": ✨ You could do that ✨ |
14:46:02 | FromDiscord | <Robyn [She/Her]> Make a WASM backend and ez, you now have a sandboxed VM |
14:53:06 | FromDiscord | <albassort> In reply to @chronos.vitaqua "✨ You could do": no im stupid |
14:54:32 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "no im stupid": I'm also stupid, so? |
14:54:50 | FromDiscord | <Robyn [She/Her]> True intelligence is using your stupidity to do amazing things :) |
14:55:07 | FromDiscord | <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:30 | FromDiscord | <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:46 | FromDiscord | <albassort> i need a job so i can... eat food |
14:57:34 | FromDiscord | <Robyn [She/Her]> Yeah that's a few months off for me still ehe |
15:15:30 | FromDiscord | <@@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:50 | FromDiscord | <@@prestosilver> Havent used nim much for stuff this low level |
15:15:55 | FromDiscord | <@@prestosilver> (edit) "low level" => ""low level"" |
15:24:36 | FromDiscord | <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:12 | FromDiscord | <madonuko> no cap but best language for gui development |
15:25:28 | FromDiscord | <Phil> Tfw not a cat |
15:25:44 | FromDiscord | <madonuko> In reply to @isofruit "Tfw not a cat": banned |
15:25:55 | FromDiscord | <madonuko> segmentation fault |
15:25:57 | FromDiscord | <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:42 | FromDiscord | <odexine> In reply to @isofruit "Tfw not a cat": ok apple |
15:27:19 | FromDiscord | <@@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:29 | FromDiscord | <madonuko> I'd like to request banning this moderator, because this moderator is not a cat! This is illegal!! |
15:27:40 | FromDiscord | <Phil> In reply to @odexine "ok apple": I prefer the term douchebag fruit |
15:28:32 | FromDiscord | <odexine> In reply to @isofruit "I prefer the term": idk i dont think an apple would fit up there |
15:31:29 | FromDiscord | <albassort> In reply to @madonuko "no cap but best": false |
15:31:33 | FromDiscord | <albassort> that'd be JS or C |
15:31:36 | FromDiscord | <albassort> (edit) "that'd be JS or C ... " added "or C++" |
15:31:44 | FromDiscord | <madonuko> In reply to @albassort "that'd be JS or": wtf |
15:31:49 | FromDiscord | <albassort> nim is probably number 30 just under php |
15:31:52 | FromDiscord | <albassort> (edit) "nim is probably number 30 just under php ... " added "and lisp" |
15:31:59 | FromDiscord | <madonuko> php for gui development?? |
15:32:04 | FromDiscord | <albassort> its been done |
15:32:09 | FromDiscord | <madonuko> wtf is wrong with you |
15:32:16 | FromDiscord | <madonuko> I'm sorry wtf |
15:32:18 | FromDiscord | <albassort> thats #28 |
15:32:35 | FromDiscord | <albassort> All gui dev i've done is C or JS |
15:32:35 | FromDiscord | <madonuko> idk like |
15:32:39 | FromDiscord | <madonuko> personal experience wise |
15:32:52 | FromDiscord | <madonuko> making native gui applications in nim are much better than python and rust |
15:33:20 | FromDiscord | <albassort> just write it in GTK silly guy |
15:33:36 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=PLQVbaJR |
15:33:38 | FromDiscord | <madonuko> In reply to @albassort "just write it in": I did |
15:33:41 | FromDiscord | <madonuko> ?? |
15:33:43 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=rgleNjJY |
15:33:54 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @albassort "no": Oh alright |
15:34:00 | FromDiscord | <albassort> well maybe in some version somewhere |
15:34:03 | FromDiscord | <albassort> but i've never seen it |
15:34:25 | FromDiscord | <odexine> In reply to @albassort "no": technically, yes |
15:34:33 | FromDiscord | <albassort> if you make it return a value sure |
15:34:35 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=XTxCVbdY |
15:34:35 | FromDiscord | <odexine> it'd just be incredibly cursed |
15:34:37 | FromDiscord | <albassort> but they meant in the stdlib |
15:34:47 | FromDiscord | <odexine> is that what they meant |
15:34:52 | FromDiscord | <albassort> i misunderstood |
15:34:54 | FromDiscord | <albassort> lol |
15:35:02 | FromDiscord | <albassort> yeah you can make it return a value, you shouldn't |
15:35:24 | FromDiscord | <albassort> i thought they meant "is there a library somewhere in the stdlib which returns a value that would conflcit with this" |
15:37:17 | FromDiscord | <madonuko> this actually looks terrifying https://media.discordapp.net/attachments/371759389889003532/1239602372997681182/b0uKfSO.png?ex=6643852c&is=664233ac&hm=239bca3ab32ca145eed43397da95ea360794db37b5657a388f3bd7d1c00a8701& |
15:38:46 | FromDiscord | <albassort> i was including not native ways |
15:38:56 | FromDiscord | <albassort> native only, maybe nim is like top 10 |
15:40:04 | FromDiscord | <madonuko> In reply to @albassort "native only, maybe nim": what's 0..9 |
15:40:18 | * | def- quit (Quit: -) |
15:40:24 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=bKxJzfoX |
15:41:50 | * | def- joined #nim |
15:41:54 | FromDiscord | <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:55 | FromDiscord | <madonuko> dunno |
15:42:08 | FromDiscord | <madonuko> still cursed |
15:44:44 | FromDiscord | <albassort> sent a long message, see https://pasty.ee/hLoVItQt |
15:44:56 | FromDiscord | <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:01 | FromDiscord | <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:19 | FromDiscord | <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:24 | FromDiscord | <madonuko> In reply to @odexine "i dont see the": sugar |
15:45:42 | FromDiscord | <Phil> That ain't sugar, that's adding garbled hieroglyphs |
15:45:45 | FromDiscord | <madonuko> In reply to @albassort "C Ultimate support ": well you're mostly talking about support↵I'm mostly talking about practicality |
15:45:48 | FromDiscord | <madonuko> In reply to @isofruit "That ain't sugar, that's": LMAO |
15:46:04 | FromDiscord | <Phil> In reply to @madonuko "well you're mostly talking": Support is a massive part of practicality |
15:46:12 | FromDiscord | <Phil> The easy part is getting the application written |
15:46:17 | FromDiscord | <albassort> very true |
15:46:19 | FromDiscord | <Phil> The hard part is maintaining it. That is also 80% of the work |
15:46:21 | FromDiscord | <madonuko> In reply to @isofruit "Support is a massive": not until it is >> |
15:46:36 | FromDiscord | <albassort> we stand on the shoulders of giants, especially when we work on GUI applications |
15:46:48 | FromDiscord | <albassort> the sheer codebase beneath your is massive |
15:47:11 | FromDiscord | <madonuko> In reply to @albassort "the sheer codebase beneath": me trying to port libhelium into nim: |
15:47:24 | FromDiscord | <albassort> when you work on algorithmic software, you stand more ontop of the intellectual endeavors of our predecessors |
15:47:28 | FromDiscord | <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:25 | FromDiscord | <albassort> write your micro-micro-os which runs in parallel mode with raw X86 asm |
15:49:45 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=gxyThJUR |
15:50:04 | FromDiscord | <madonuko> and I think it takes like 5 to actually write the equivalent in rust |
15:50:18 | FromDiscord | <madonuko> I mean relm4 |
15:50:36 | FromDiscord | <madonuko> I forgot how it works in relm4 |
15:50:56 | FromDiscord | <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:05 | FromDiscord | <Phil> I say that as a fairly sizeable contributor to owlkettle |
15:51:24 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=zbasXvYo |
15:51:28 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=xBcqkWrR" => "https://play.nim-lang.org/#pasty=IbvaPlOt" |
15:51:36 | FromDiscord | <albassort> there you go mutating hello world in svelte |
15:51:39 | * | ntat quit (Quit: Leaving) |
15:52:22 | FromDiscord | <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:25 | FromDiscord | <Phil> The web in general is |
15:52:29 | FromDiscord | <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:41 | FromDiscord | <madonuko> other than taking like a day to figure out gtk doesn't work with threads |
15:52:43 | FromDiscord | <albassort> In reply to @isofruit "And yeah, I'll agree": JS SUPREMACY |
15:52:52 | FromDiscord | <Phil> In reply to @albassort "JS SUPREMACY": TS or heresy |
15:53:05 | FromDiscord | <madonuko> In reply to @isofruit "And yeah, I'll agree": you can't make native apps with them or something |
15:53:12 | FromDiscord | <Phil> TS is like the one type system I've seen so far I like almost more than nim's |
15:53:13 | FromDiscord | <madonuko> does react native count as native |
15:53:18 | FromDiscord | <Phil> Yes |
15:53:18 | FromDiscord | <madonuko> eh idk |
15:53:23 | FromDiscord | <albassort> i dont like TS's |
15:53:24 | FromDiscord | <Phil> Because it actually compiles down to native |
15:53:25 | FromDiscord | <albassort> its too intense |
15:53:31 | FromDiscord | <albassort> its a over-correction from JS |
15:53:34 | FromDiscord | <Phil> In reply to @albassort "i dont like TS's": Maniac! |
15:53:40 | FromDiscord | <Phil> Madwoman! |
15:53:53 | FromDiscord | <madonuko> In reply to @albassort "its too intense": edit your eslint or something idk |
15:54:31 | FromDiscord | <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:49 | FromDiscord | <albassort> NOTHING is implied in TS and you cant write sugar function spaghetti like you can in nim |
15:55:01 | FromDiscord | <madonuko> wait you can't? |
15:55:02 | FromDiscord | <Phil> In reply to @albassort "NOTHING is implied in": Now that I call lies on |
15:55:12 | FromDiscord | <albassort> not as easily |
15:55:25 | FromDiscord | <madonuko> eh I'd say nim is pretty weak on the imply part too |
15:55:41 | FromDiscord | <madonuko> the real imply thingy winner here is rust |
15:56:17 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=vmuLjlnh |
15:56:52 | FromDiscord | <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:11 | FromDiscord | <madonuko> I think I'm cooking again https://media.discordapp.net/attachments/371759389889003532/1239607378874335272/S1KloCo.png?ex=664389d5&is=66423855&hm=ac0d8efe6368c37fd44e111dc24c75e60c20aa4796b979b9874648ece77f24c5& |
15:58:48 | FromDiscord | <Robyn [She/Her]> Whyyyy would you want that? |
15:59:45 | FromDiscord | <madonuko> idea is cmd_lib but in nim |
15:59:53 | FromDiscord | <Robyn [She/Her]> Idk what cmd_lib is |
16:00:31 | FromDiscord | <madonuko> In reply to @chronos.vitaqua "Idk what cmd_lib is": basically write shell stuff as nim code |
16:00:37 | FromDiscord | <madonuko> cmd_lib is a rust lib tho |
16:00:48 | FromDiscord | <madonuko> https://media.discordapp.net/attachments/371759389889003532/1239608293752569997/jQJjimN.png?ex=66438ab0&is=66423930&hm=793fee2be1f0ae7ccab7fc81436790b86051ae505290e1406225dbbde0070b1c& |
16:03:25 | FromDiscord | <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:54 | FromDiscord | <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:35 | FromDiscord | <Nelson> imagen.png https://media.discordapp.net/attachments/371759389889003532/1239614529424326656/imagen.png?ex=6643907e&is=66423efe&hm=b17dddf91d575cf376e75a45cdc07b8d0b9efb1b9f0681a328265600a012199a& |
16:25:45 | FromDiscord | <Nelson> imagen.png https://media.discordapp.net/attachments/371759389889003532/1239614569509289994/imagen.png?ex=66439088&is=66423f08&hm=b89426d54eefe2aded103e1d428f97fcdeb6d0a89594fd47bc09cc63f42cc811& |
16:26:44 | FromDiscord | <Nelson> it's these two last lines specifically |
16:27:17 | FromDiscord | <Nelson> thing is, the demo of the library itself does this exact same thing too |
16:27:48 | FromDiscord | <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:49 | FromDiscord | <solitudesf> does the demo work? |
16:28:14 | FromDiscord | <Nelson> no lmao↵(@solitudesf) |
16:28:23 | FromDiscord | <Nelson> but not because of those two lines |
16:28:25 | FromDiscord | <Nelson> wait |
16:28:48 | FromDiscord | <Nelson> i think i can fix the demo myself |
16:32:32 | FromDiscord | <Nelson> exact same error \:(↵(@solitudesf) |
16:32:37 | FromDiscord | <morgan> In reply to @sys64 "Any exemple?": idk (foo, bar) % 0.25 |
16:33:07 | FromDiscord | <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:05 | FromDiscord | <Nelson> it's actually a function↵(@demotomohiro) |
16:34:09 | FromDiscord | <Nelson> but this seems useful |
16:35:30 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @morganalyssa "idk (foo, bar) %": looks neat! |
16:35:52 | FromDiscord | <demotomohiro> Error message you posted seems you assinged different function pointer type as 2nd function pointer is not `const char` but `char`. |
16:36:22 | FromDiscord | <Nelson> OHHHHHHHHHHHHH |
16:36:36 | FromDiscord | <Nelson> yeah i see it now, sorry lol↵(@demotomohiro) |
16:37:42 | FromDiscord | <Nelson> great i'll have to fix the binding too |
16:38:13 | FromDiscord | <Nelson> oh wait let me guess, my nim version is too old |
16:43:59 | FromDiscord | <Nelson> nope it wasnt that, i'll have to fix the binding |
16:46:54 | FromDiscord | <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:42 | FromDiscord | <morgan> or maybe seq[(x,y)] ~ -1.2 for evaluation of a(n ideally compile time defined) curve fit |
16:50:48 | FromDiscord | <morgan> but it would be cleaner to do that with mytuple.bez(t) |
16:51:13 | FromDiscord | <morgan> lerp, bez, plin, fit |
16:51:24 | FromDiscord | <morgan> fairly short and more understandable still |
16:51:42 | FromDiscord | <odexine> prolly better to use a fuller name if its not as popular as lerp |
16:51:45 | FromDiscord | <System64 ~ Flandre Scarlet> yeah I think we should avoid operators here |
16:54:22 | FromDiscord | <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:47 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @morganalyssa "i think lerp with": Is there a risk to confuse it with a modulo? |
16:58:29 | FromDiscord | <morgan> probably |
16:58:43 | FromDiscord | <morgan> what does modulo of a tuple mean though |
16:58:51 | FromDiscord | <morgan> modulo of both? |
16:59:02 | FromDiscord | <morgan> but if you see it returns one, then what |
16:59:27 | FromDiscord | <morgan> but yeah i think it would still be better off as tup.lerp(t) |
17:18:33 | * | ntat joined #nim |
17:20:38 | FromDiscord | <System64 ~ Flandre Scarlet> I think thesame |
17:20:41 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "thesame" => "the same" |
17:21:08 | FromDiscord | <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:15 | Amun-Ra | then again, I'd like to change my bet ;) |
17:33:19 | FromDiscord | <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:49 | Amun-Ra | interesting, thanks |
17:36:23 | FromDiscord | <System64 ~ Flandre Scarlet> Btw replace the A from Discard by O↵Discord |
17:36:30 | FromDiscord | <System64 ~ Flandre Scarlet> Well, that's cursed |
17:37:13 | Amun-Ra | what if you put it in inner block? does it get freed right after? |
17:55:40 | * | coldfeet joined #nim |
17:58:27 | FromDiscord | <morgan> welp i think im gonna have to write my own platform abstracted window reparenting thing |
17:58:49 | FromDiscord | <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:04 | FromDiscord | <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:19 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#pasty=mKVnfLXX |
18:15:32 | FromDiscord | <morgan> i want to just shim sokol in and see what else i need after that |
18:27:00 | FromDiscord | <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:16 | FromDiscord | <Phil> Oh the DSL itself is fine |
18:27:26 | FromDiscord | <Phil> I'm more talking how difficult the memory management under the hood can be |
18:27:34 | FromDiscord | <Phil> And I'm still not entirely certain it's all working correctly |
18:28:29 | FromDiscord | <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:44 | FromDiscord | <Phil> But otherwise it's working fairly well |
18:28:47 | FromDiscord | <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:17 | FromDiscord | <nervecenter> Glad it works though, I tried the weird CLI macro library and it worked decently, I forget what it was |
18:29:43 | FromDiscord | <nervecenter> `docopt` |
18:30:33 | FromDiscord | <nervecenter> (edit) "detailed enough" => "detailed, composable," |
18:30:51 | FromDiscord | <nervecenter> (edit) "`docopt`" => "`docopt.nim`" |
18:44:09 | FromDiscord | <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:36 | FromDiscord | <Phil> In reply to @nervecenter "True I guess, I": Imo it's alright if you go very methodically at it |
18:45:53 | FromDiscord | <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:38 | FromDiscord | <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:50 | FromDiscord | <Phil> (edit) "days," => "days and better knowledge of tooling in that regard," |
18:47:06 | FromDiscord | <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:13 | FromDiscord | <the_real_hypno> Ah, so roughly what i did. Doesnt really feel satisfying though |
18:47:15 | FromDiscord | <Phil> And then comb through it with valgrind |
18:48:34 | FromDiscord | <the_real_hypno> Valgrind is Linux, right? |
18:48:55 | FromDiscord | <Phil> Yes, I think it might be available under windows as well? |
18:49:02 | FromDiscord | <Phil> Seems essential enough for that to be the case |
18:49:07 | FromDiscord | <Phil> Other than that you still have sanitizers |
18:49:12 | FromDiscord | <Phil> Which I think also work on windows |
18:49:22 | FromDiscord | <the_real_hypno> I think i wanted to use it and saw its Linux only and silently cried |
18:49:40 | FromDiscord | <Phil> For memory leaks I know of 2 options:↵Valgrind and address sanitizer |
18:50:20 | FromDiscord | <Phil> ASAN works for mac as well, windows seems SOL |
18:50:22 | FromDiscord | <the_real_hypno> Could you point me into the address sanitizer direction? Where would i look that up. |
18:50:26 | FromDiscord | <the_real_hypno> (edit) "up." => "up?" |
18:50:32 | FromDiscord | <the_real_hypno> Just google? |
18:51:07 | FromDiscord | <Phil> https://github.com/google/sanitizers/wiki/AddressSanitizerComparisonOfMemoryTools↵That's the repo and also them comparing themselves to other tools |
18:51:33 | FromDiscord | <the_real_hypno> Sweet, cheers. Ill read myself into it |
18:52:15 | FromDiscord | <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:39 | FromDiscord | <the_real_hypno> Will do! |
18:58:25 | * | nils` joined #nim |
19:07:06 | FromDiscord | <Robyn [She/Her]> Now I'm struggling to figure out how to traverse my AST to validate the original tree :p |
19:09:26 | FromDiscord | <System64 ~ Flandre Scarlet> I love the idea of custom destructors↵So you can make a C library, safer |
19:09:34 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "library," => "library" | "librarysafer ... " added "to use" |
19:11:35 | * | beholders_eye quit (Ping timeout: 272 seconds) |
19:16:01 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> Probably `{.stackframe:off.}` followed by turning it back on after the proc |
20:23:34 | NimEventer | New thread by ITwrx: Remove first 4 lines from string, see https://forum.nim-lang.org/t/11597 |
20:30:17 | FromDiscord | <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:55 | FromDiscord | <Elegantbeef> stackframes maybe |
20:40:49 | FromDiscord | <m4ul3r> hmm also loogs not |
20:40:53 | FromDiscord | <m4ul3r> (edit) "loogs" => "looks" |
20:43:02 | FromDiscord | <Elegantbeef> Ah I was thinking about stacktrace |
20:43:06 | FromDiscord | <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:39 | FromDiscord | <nocturn9x> quick question |
21:52:45 | FromDiscord | <nocturn9x> suppose I wanted to spawn n worker threads |
21:52:52 | FromDiscord | <nocturn9x> with `n` being a dynamically provided value |
21:53:09 | FromDiscord | <nocturn9x> do I just make a `seq[ref Thread[TArg]]` and add `new Thread[TArg]` to it? |
21:53:16 | FromDiscord | <nocturn9x> (edit) "do I just make a `seq[ref Thread[TArg]]` and add ... `new" added "n" |
21:54:18 | FromDiscord | <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:36 | FromDiscord | <nocturn9x> or do I need to turn them into `ptr`s |
21:56:20 | FromDiscord | <Elegantbeef> Atomics are stack values so you need to pass them as ptrs |
21:56:26 | FromDiscord | <Elegantbeef> Well they're value types rather |
21:56:50 | FromDiscord | <nocturn9x> okay |
21:56:55 | FromDiscord | <nocturn9x> easy enough |
21:57:00 | FromDiscord | <Elegantbeef> Using `seq[ref Thread]` sounds fine but I do not thread much. I've done more sewing than using threads 😄 |
21:57:12 | FromDiscord | <nocturn9x> hah, okay. Thanks :) |
21:58:44 | FromDiscord | <threefour> I'm using the `ref[seq Thead]` approach right now, and it seems to be working fine. |
21:58:49 | FromDiscord | <nocturn9x> alrighty |
21:58:51 | FromDiscord | <threefour> (edit) "Thead]`" => "Thread]`" |
21:59:25 | FromDiscord | <Elegantbeef> It works around the entire resource issue of Nim's `Thread` so it should be fine |
21:59:35 | FromDiscord | <Elegantbeef> As long as the seq does not get GC'd while the thread is still alive |
21:59:43 | FromDiscord | <Elegantbeef> So ensure the seq outlives any thread operations |
21:59:50 | FromDiscord | <nocturn9x> of course |
22:00:12 | FromDiscord | <nocturn9x> I assume the thread will still have the issue of thread vars not being collected |
22:00:18 | FromDiscord | <nocturn9x> probably not much I can do about that |
22:00:41 | FromDiscord | <Elegantbeef> Yep it needs to be changed in the compiler to emit a proc that calls `=destroy` on all `threadvar`s |
22:00:57 | FromDiscord | <Elegantbeef> I don't think it's that difficult to do but like I said last time I do not touch cgen 😛 |
22:01:10 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=QknTCXdL |
22:01:15 | FromDiscord | <nocturn9x> do any of these modules use thread vars? |
22:01:18 | FromDiscord | <nocturn9x> iirc monotimes does |
22:01:21 | FromDiscord | <Elegantbeef> No clue |
22:01:36 | FromDiscord | <nocturn9x> would have to look I guess |
22:01:38 | FromDiscord | <nocturn9x> _pain- |
22:01:40 | FromDiscord | <nocturn9x> (edit) "_pain-" => "_pain_" |
22:01:40 | FromDiscord | <Elegantbeef> `import std/[math, times, atomics, algorithm, monotimes, strformat]` is cooler 😛 |
22:02:33 | FromDiscord | <nocturn9x> debatable :> |
22:03:04 | FromDiscord | <nocturn9x> anyway, aside from that thread madness a few days ago, Nim has as always been surprisingly nice to work with |
22:03:10 | FromDiscord | <nocturn9x> I hope the issues can be fixed soon |
22:03:20 | FromDiscord | <nocturn9x> It's a shame considering the potential it has |
22:05:53 | FromDiscord | <Elegantbeef> Yea it's not too complicated of an issue |
22:05:54 | FromDiscord | <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:27 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=cmOCSHSh |
22:17:29 | FromDiscord | <nocturn9x> would this be correct? |
22:22:25 | FromDiscord | <Elegantbeef> Not if they're stack values |
22:23:34 | FromDiscord | <nocturn9x> they're not of course |
22:23:36 | FromDiscord | <nocturn9x> they're all `ptr`s |
22:24:01 | FromDiscord | <Elegantbeef> Right but a pointer is a pointer it does not have to be to the heap |
22:24:21 | FromDiscord | <nocturn9x> oh but it's created via `alloc0` on the constructor |
22:24:31 | FromDiscord | <nocturn9x> (edit) "on" => "in" |
22:25:02 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=nczumXIN |
22:26:11 | FromDiscord | <Elegantbeef> Just use create |
22:26:19 | FromDiscord | <amjadhd> Are generic enums a thing in Nim ? |
22:26:26 | FromDiscord | <nocturn9x> In reply to @Elegantbeef "Just use create": docs? |
22:26:31 | FromDiscord | <Elegantbeef> Yesn't |
22:26:41 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#create%2Ctypedesc |
22:26:54 | FromDiscord | <Elegantbeef> You can add type information but it does not help much |
22:27:17 | FromDiscord | <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:27 | FromDiscord | <Elegantbeef> yep |
22:27:29 | FromDiscord | <nocturn9x> which ARC is not |
22:27:31 | FromDiscord | <nocturn9x> cool |
22:27:47 | FromDiscord | <Elegantbeef> Though `createShared` is right there 😄 |
22:28:15 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=WwyVDAdk |
22:28:19 | FromDiscord | <nocturn9x> true, but I clearly don't need it |
22:28:34 | FromDiscord | <nocturn9x> or should I use it just in case |
22:29:01 | FromDiscord | <nocturn9x> it really isn't terribly nice that changing a critical flag can make or break your code |
22:29:04 | FromDiscord | <nocturn9x> (edit) "it really isn't terribly nice that changing a critical ... flag" added "compiler" |
22:29:20 | FromDiscord | <nocturn9x> like if someone compiles with `--mm:refc` it'll explode :P |
22:29:32 | FromDiscord | <Elegantbeef> Good refc suuuucks |
22:29:41 | FromDiscord | <nocturn9x> I agree, but it's not the point :> |
22:29:43 | FromDiscord | <nocturn9x> (edit) ":>" => ":<" |
22:29:51 | FromDiscord | <nocturn9x> also nim's deferred refcount is pretty clever |
22:29:56 | FromDiscord | <nocturn9x> and decently performant too |
22:30:15 | FromDiscord | <nocturn9x> it's just not very good for modern memory management, since it doesn't handle cycles anyway |
22:30:28 | FromDiscord | <nocturn9x> (although to be fair, neither does ARC) |
22:31:00 | FromDiscord | <nocturn9x> also, fun name clashing: some languages define ARC as Atomically Reference Counted, rather than Automatically Reference Counted |
22:31:15 | FromDiscord | <nocturn9x> that sparked a confusing conversation about my thread safety issues a while ago |
22:32:17 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=bXFvJqTp |
22:32:19 | FromDiscord | <nocturn9x> is it a template thing |
22:32:25 | FromDiscord | <Elegantbeef> No |
22:32:32 | FromDiscord | <Elegantbeef> Robyn just likes having a giggle apparently |
22:32:34 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "why the parentheses around": Just did it for clarity |
22:32:41 | FromDiscord | <Elegantbeef> I mean it's not that refc is a bad idea |
22:32:43 | FromDiscord | <nocturn9x> considering nim's syntax |
22:32:48 | FromDiscord | <nocturn9x> I'd say that's a wee bit less clear |
22:32:53 | FromDiscord | <Elegantbeef> It's just badly implemented with all of Nim's modern features |
22:32:54 | FromDiscord | <nocturn9x> just personal taste though I guess |
22:32:55 | FromDiscord | <Robyn [She/Her]> Tho maybe `while cond` is better |
22:32:59 | FromDiscord | <nocturn9x> yeah |
22:33:03 | FromDiscord | <Robyn [She/Her]> In reply to @nocturn9x "I'd say that's a": How so? |
22:33:19 | FromDiscord | <nocturn9x> well, you don't need parentheses around conditionals in nim, so using them here is just confusing imo |
22:33:40 | FromDiscord | <Robyn [She/Her]> Don't get how it's confusing, but can add visual noise ig |
22:33:45 | FromDiscord | <nocturn9x> yeah, that |
22:33:54 | FromDiscord | <nocturn9x> I think it does the opposite of adding clarity, is all |
22:34:01 | FromDiscord | <Robyn [She/Her]> Fair |
22:37:18 | * | beholders_eye quit (Ping timeout: 268 seconds) |
22:44:18 | FromDiscord | <nocturn9x> one question |
22:44:42 | FromDiscord | <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:48 | FromDiscord | <nocturn9x> and reuse them instead of creating them every time? |
22:46:09 | FromDiscord | <polylokh_39446> that makes sense in general since there's an expense just in creating a thread |
22:46:20 | FromDiscord | <nocturn9x> yeah, fair enough |
22:46:21 | FromDiscord | <zumi.dxy> In reply to @nocturn9x "also, fun name clashing:": maybe it should be named AuRC? :p |
22:46:28 | FromDiscord | <nocturn9x> xD |
22:46:40 | FromDiscord | <polylokh_39446> it's also a good tunable, the size of your threadpool. |
22:46:41 | FromDiscord | <Elegantbeef> Gold RC interesting |
22:46:56 | FromDiscord | <nocturn9x> In reply to @polylokh_39446 "it's also a good": that is determined via UCI options, but yes |
22:47:01 | FromDiscord | <nocturn9x> I can add and remove workers at my leisure |
22:49:07 | FromDiscord | <nocturn9x> since when is `high` deprecated for seqs?? |
22:49:30 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=hevABZFR |
22:50:00 | FromDiscord | <nocturn9x> I don't think that `high()` is the same one I mean, haha (aka `len() - 1`) |
22:51:06 | FromDiscord | <Elegantbeef> You're doing `high(type)` |
22:51:16 | FromDiscord | <nocturn9x> ah, what a dumbass I am. I have shadowed `workers` (a seq), with an `int` |
22:51:24 | FromDiscord | <nocturn9x> facepalm |
22:51:49 | FromDiscord | <nocturn9x> I was so confused |
22:54:36 | FromDiscord | <nocturn9x> question |
22:54:46 | FromDiscord | <nocturn9x> does `deepCopy()` copy pointers or does it copy the underlying values too |
22:55:02 | FromDiscord | <nocturn9x> I need to pass basically a copy of `self` but with some values changed to multiple threads |
22:55:20 | FromDiscord | <nocturn9x> but I want the pointers to stay shared |
22:55:29 | FromDiscord | <Elegantbeef> I don't think deep copy deep copies pointers |
22:55:36 | FromDiscord | <nocturn9x> okay so they should stay the same |
22:55:37 | FromDiscord | <Elegantbeef> Only refs |
22:55:41 | FromDiscord | <nocturn9x> gotcha |
23:07:44 | FromDiscord | <nocturn9x> question |
23:07:46 | FromDiscord | <nocturn9x> can I pass `var T` to threads |
23:07:59 | FromDiscord | <nocturn9x> I'm getting weird type errors in `createThread` |
23:08:01 | FromDiscord | <Elegantbeef> No cause `var T` is not a valid field type |
23:08:17 | FromDiscord | <nocturn9x> got it |
23:12:18 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=NBhyyrRX |
23:12:20 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=ONZKBvEg |
23:13:04 | FromDiscord | <nocturn9x> (edit) "https://play.nim-lang.org/#pasty=IbjEHrDo" => "https://play.nim-lang.org/#pasty=ORkqgknC" |
23:14:32 | FromDiscord | <nocturn9x> ah ups |
23:14:43 | FromDiscord | <nocturn9x> I'm not passing it the proc.... |
23:14:47 | FromDiscord | <nocturn9x> what an idiot x2 |
23:14:54 | FromDiscord | <nocturn9x> it's late, I apologize for the noise |
23:15:16 | FromDiscord | <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:10 | FromDiscord | <nocturn9x> wow, this was surprisingly painless |
23:40:29 | FromDiscord | <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:30 | FromDiscord | <nocturn9x> _neat_ |
23:40:53 | FromDiscord | <Elegantbeef> Just mark all your thread procs as `raises: []` for style points |
23:41:56 | FromDiscord | <nocturn9x> XDD |
23:45:08 | * | xet7 joined #nim |
23:57:13 | FromDiscord | <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 |