00:29:25 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "there is this model": but can it run doom? |
00:38:06 | FromDiscord | <ollicron_53732> https://imgflip.com/i/a2o6me |
00:38:35 | FromDiscord | <ollicron_53732> How i feel right now I literally have no idea what I'm doing https://media.discordapp.net/attachments/371759389889003532/1403900299428757584/a2o6me.png?ex=68993b8a&is=6897ea0a&hm=322ee0c24a5bb342740da488129291b6ab44378980a3b853b0a0008a8f60989d& |
00:49:33 | FromDiscord | <Elegantbeef> Mine can run crisis, well existential crisis↵(@Robyn [She/Her]) |
01:37:33 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Mine can run crisis,": damn, you must have a top of the line brain |
01:38:00 | FromDiscord | <Robyn [She/Her]> too bad it's occupied by generating witty remarks |
01:41:55 | * | oz quit (Quit: EOF) |
01:47:07 | * | ox joined #nim |
01:47:07 | * | ox is now known as oz |
01:51:16 | FromDiscord | <.tokyovigilante> hey team, I know its OOP but not really, but can I not pass a ChildObject that inherits from ParentObject to a function expecting ParentObject? |
01:52:58 | FromDiscord | <mr_rowboto> In reply to @.tokyovigilante "hey team, I know": yes |
01:53:17 | FromDiscord | <mr_rowboto> you should be able to |
01:56:19 | FromDiscord | <.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=fUTWryLJ |
01:57:15 | FromDiscord | <.tokyovigilante> do I need something like `layoutAndRender[T: UIComponent](comp: T, ...)`? |
01:57:34 | FromDiscord | <mr_rowboto> can you show the full call? |
01:58:07 | FromDiscord | <.tokyovigilante> `layoutAndRender(modal, tui.terminalBox, modalRegion, emptyBindings, tui.themeManager)` |
02:00:53 | FromDiscord | <mr_rowboto> sent a code paste, see https://play.nim-lang.org/#pasty=pOzEPRgY |
02:00:55 | FromDiscord | <mr_rowboto> that compiles |
02:00:57 | FromDiscord | <mr_rowboto> and runs |
02:02:01 | FromDiscord | <mr_rowboto> oh, it's the var TerminalBuffer |
02:02:04 | FromDiscord | <.tokyovigilante> Thanks, that's exactly what I want to happen. I must be doing something dumb with my inheritance |
02:02:04 | FromDiscord | <mr_rowboto> (edit) "var TerminalBuffer" => "`var TerminalBuffer`" |
02:02:12 | FromDiscord | <mr_rowboto> no no, it's not that |
02:02:17 | FromDiscord | <mr_rowboto> your inheritance is perfect |
02:02:32 | FromDiscord | <mr_rowboto> `layoutAndRender` is expecting `buffer: var TerminalBuffer` on the second |
02:02:43 | FromDiscord | <mr_rowboto> and you're giving just ` [2] tui.terminalBox: TerminalBuffer` |
02:02:55 | FromDiscord | <mr_rowboto> could that be it? |
02:03:33 | FromDiscord | <.tokyovigilante> hmm, it should be the right type, but I am mid-refactor |
02:03:48 | FromDiscord | <mr_rowboto> [2] looks like it's not a `var` at all |
02:03:50 | FromDiscord | <.tokyovigilante> thanks for confirming it should work the way I want though |
02:03:54 | FromDiscord | <mr_rowboto> 😄 |
02:04:30 | FromDiscord | <mr_rowboto> try↵var a = tui.terminalBox↵and pass a just to see if it compiles |
02:04:47 | FromDiscord | <.tokyovigilante> I've got a couple of working calls with base objects above, and the same terminalBox (which is actually a TerminalBuffer) but will change it to var yup |
02:04:53 | FromDiscord | <mr_rowboto> (edit) "try↵var" => "try↵`var" | "tui.terminalBox↵and" => "tui.terminalBox`↵and" | "a" => "`a`" |
02:05:47 | FromDiscord | <mr_rowboto> you're playing with Tui? |
02:06:56 | FromDiscord | <.tokyovigilante> If by Tui you mean Terminal ui, then yes. Building a custom renderer based on https://github.com/johnnovak/illwill |
02:07:10 | FromDiscord | <mr_rowboto> cool! |
02:16:42 | FromDiscord | <Elegantbeef> Row missed me making my own pretend terminal last year for a now backburned project |
02:26:38 | FromDiscord | <.tokyovigilante> Will keep you updated once I've built the One True TUI Framework (TM) 😉 |
02:27:51 | FromDiscord | <.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=AXoOyqip |
02:29:18 | FromDiscord | <mr_rowboto> I have a really stupid question.↵Is it such a bad practice to put the proc signatures on top so I can bury the private procs at the bottom 🫣 |
02:29:20 | FromDiscord | <mr_rowboto> (edit) "🫣" => "🫣?" |
02:30:05 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=uflzgjgH |
02:31:03 | FromDiscord | <mr_rowboto> ohh |
02:31:09 | FromDiscord | <mr_rowboto> kinded enum? |
02:31:15 | FromDiscord | <mr_rowboto> hmmm |
02:31:46 | FromDiscord | <heysokam> In reply to @mr_rowboto "I have a really": More like it will be a pain for you to manage↵I had to do that once, and the file became immutable at some point↵I couldn't change the structure at all |
02:31:47 | FromDiscord | <Elegantbeef> I dislike it yes |
02:32:39 | FromDiscord | <heysokam> In reply to @mr_rowboto "I have a really": `{.experimental: "codeReordering".}` is a thing, btw. you might prefer it |
02:32:48 | FromDiscord | <mr_rowboto> well, yeah, you have to modify stuff in two places |
02:34:08 | FromDiscord | <mr_rowboto> sent a code paste, see https://play.nim-lang.org/#pasty=TTyqLLwY |
02:34:52 | FromDiscord | <heysokam> I could always import it as two different types, now that I think about it 🤔 |
02:34:57 | FromDiscord | <mr_rowboto> yeah |
02:35:03 | FromDiscord | <mr_rowboto> and just hard cast it |
02:35:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=YXRsrOrj |
02:35:54 | FromDiscord | <mr_rowboto> god |
02:35:55 | FromDiscord | <Elegantbeef> Make it a `tuple[width, height: int32]` if you really want |
02:36:00 | FromDiscord | <mr_rowboto> theres a {.union.} |
02:36:11 | FromDiscord | <Elegantbeef> Mostly for interop, but yea |
02:42:30 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=DzgobcVd |
02:42:46 | FromDiscord | <heysokam> width would just be `thing.width` |
02:43:20 | FromDiscord | <mr_rowboto> same memory layout tho |
02:43:24 | FromDiscord | <Elegantbeef> Then map it as a vec2 and have getters |
02:44:02 | FromDiscord | <heysokam> didn't think of the getters, good solution |
02:44:24 | FromDiscord | <heysokam> That's basically what they are for on the C side anyway |
03:08:10 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=tbPnNoEh |
03:09:20 | FromDiscord | <Elegantbeef> It'd make a type so nope |
03:09:35 | FromDiscord | <Elegantbeef> just make a proc take in a `pointer` and be done with it |
03:09:48 | FromDiscord | <Elegantbeef> Or if you want it to be specific `ptr A | ptr B | .....` |
03:10:02 | FromDiscord | <Elegantbeef> `importC` on a generic doesn't do any symbol madness so it's the same proc |
03:11:23 | FromDiscord | <heysokam> kk ty |
03:49:02 | FromDiscord | <albassort> In reply to @battery.acid.bubblegum "but can it run": yes! |
03:49:28 | FromDiscord | <albassort> depends on your machine but your brain can run doom |
03:49:30 | FromDiscord | <albassort> just imagine it |
03:59:58 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=aAMPZpFl |
04:01:01 | FromDiscord | <leorize> it happens because you're importc-ing it and using `header` at the same time |
04:01:10 | FromDiscord | <leorize> drop `header` unless you need some C macro that you can't replicate in nim or something |
04:02:02 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=GKgAMjid |
04:03:15 | FromDiscord | <Elegantbeef> compile pragma? |
04:03:44 | FromDiscord | <heysokam> which `.c` file do you add to compile pragma? I don't want an extra file in the project if I can avoid it 🙁 |
04:06:00 | FromDiscord | <leorize> make a `.c` with just those two lines and add it as `.compile`? |
04:07:00 | FromDiscord | <Elegantbeef> You also can probably do `{.passC:-Dtfb_Implementation.}` and use `{.header.}` |
04:18:41 | FromDiscord | <heysokam> I guess I'll have to live with the extra file, that did work 🙁 |
04:19:03 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=UBMCwLzq |
04:20:36 | FromDiscord | <leorize> start by not having `tinyfb.h` included in any nim module? |
04:20:59 | FromDiscord | <heysokam> wdym? I don't have it included 🤔 |
04:21:14 | FromDiscord | <leorize> do you have any `{.header.}`? |
04:21:39 | FromDiscord | <heysokam> what alternative do I have? the symbols were missing if I don't add it |
04:21:51 | FromDiscord | <leorize> what symbols? |
04:21:55 | FromDiscord | <heysokam> the types |
04:22:03 | FromDiscord | <heysokam> and constants, and etc |
04:22:05 | FromDiscord | <leorize> you should never need `header` to begin with |
04:22:18 | FromDiscord | <heysokam> I'll paste the other error then, sec |
04:23:15 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=fZGHSPGg |
04:23:38 | FromDiscord | <leorize> did you `{.importc.}` types? |
04:23:45 | FromDiscord | <heysokam> yea |
04:23:48 | FromDiscord | <leorize> don't do that |
04:23:59 | FromDiscord | <leorize> replicate the type exact structure, that's all you need |
04:24:07 | FromDiscord | <heysokam> why not? they don't map to the same type if I dont |
04:24:18 | FromDiscord | <heysokam> it happened with the wgpu bindings |
04:24:47 | FromDiscord | <leorize> wdym? |
04:24:49 | FromDiscord | <heysokam> and I get zigcc errors for strict type casting to incorrect types |
04:25:09 | FromDiscord | <leorize> that's what happens when you use `{.header.}` |
04:25:22 | FromDiscord | <leorize> because then you have to play ball with C source |
04:26:07 | FromDiscord | <leorize> if the C source use features that are semantically unreplicatable in Nim, then you are in for pain |
04:27:38 | FromDiscord | <heysokam> I see |
04:28:22 | FromDiscord | <heysokam> removing importc from types fixed the errors, ty leo |
05:05:53 | FromDiscord | <heysokam> hmm, this is really weird 🤔↵I'm getting a segfault on this line, but its coming from `free` internally↵And it does not happen on the C code natively, but only when the code is wrapped to Nim? 🧩 https://media.discordapp.net/attachments/371759389889003532/1403967568288415896/image.png?ex=68997a30&is=689828b0&hm=80df5a9f7f0f1c78d1e09c15f41578857d28e08d114dd1e87159b1784b350fba& |
05:09:24 | FromDiscord | <leorize> it meant your pointer is messed up |
05:09:26 | FromDiscord | <leorize> maybe because your object layout is different from the real object layout in C |
05:10:11 | FromDiscord | <leorize> if you have both the wrapper and the C header somewhere then I can proofread it real quick |
05:13:20 | FromDiscord | <heysokam> I do! This is the erroring line:↵https://github.com/heysokam/tinyfb/blob/3659fab06ec8c4a33e6f1edf089d9e49a4bb1ec1/src/tinyfb.h#L362↵And here are the nim bindings for that type:↵https://github.com/heysokam/tinyfb/blob/3659fab06ec8c4a33e6f1edf089d9e49a4bb1ec1/src/tinyfb.nim#L63 |
05:14:55 | FromDiscord | <leorize> btw `{.importc.}` does nothing for `const` |
05:16:08 | FromDiscord | <leorize> for `Pixels`, use `csize_t` instead of `uint` |
05:16:35 | FromDiscord | <heysokam> In reply to @leorize "for `Pixels`, use `csize_t`": I wanted a Nim api, with no C types |
05:16:57 | FromDiscord | <heysokam> In reply to @leorize "btw `{.importc.}` does nothing": Doesn't it import the type, though? |
05:17:29 | FromDiscord | <leorize> it doesn't |
05:17:40 | FromDiscord | <leorize> you're not gonna change the fact the structure was made with C typpes↵(@heysokam) |
05:17:42 | FromDiscord | <leorize> types\ |
05:18:08 | FromDiscord | <leorize> also, your `Fn_alloc` and `Fn_allocZ` are swapped |
05:18:09 | FromDiscord | <heysokam> In reply to @leorize "you're not gonna change": I guess I'll make the field private with getter/setter 🤷♂️ |
05:18:19 | FromDiscord | <leorize> the two parameters variant is `allocZ`, not `alloc` |
05:19:02 | FromDiscord | <heysokam> In reply to @leorize "also, your `Fn_alloc` and": what, where? 🤔 |
05:19:06 | FromDiscord | <heysokam> I can't see it |
05:19:35 | FromDiscord | <leorize> https://github.com/heysokam/tinyfb/blob/3659fab06ec8c4a33e6f1edf089d9e49a4bb1ec1/src/tinyfb.nim#L43-L44 |
05:19:38 | FromDiscord | <leorize> compare to https://github.com/heysokam/tinyfb/blob/3659fab06ec8c4a33e6f1edf089d9e49a4bb1ec1/src/tinyfb.h#L82-L83 |
05:19:49 | FromDiscord | <heysokam> ohhh I see now, in the typedef |
05:21:51 | FromDiscord | <heysokam> Fixed it. Doesn't seem to solve the issue though, but great catch! 🙏 |
05:23:21 | FromDiscord | <leorize> your definition of `gl_Uint` is incorrect |
05:23:40 | FromDiscord | <leorize> according to [Khronos](https://www.khronos.org/opengl/wiki/OpenGL_Type), `GLuint` is 32bit |
05:23:59 | FromDiscord | <leorize> yours is a flip-flop between 32 and 64 |
05:24:50 | FromDiscord | <heysokam> `typedef unsigned int GLuint;` I thought this `int` meant the same in C |
05:25:30 | FromDiscord | <leorize> no it's nominally 32bit |
05:25:43 | FromDiscord | <heysokam> didn't know, good to know |
05:26:08 | FromDiscord | <leorize> your `Screen.clear_disabled` is also wrong |
05:26:13 | FromDiscord | <leorize> C enums are mapped to `cint` by default |
05:26:25 | FromDiscord | <leorize> using `bool` makes it as small as a byte, which is very wrrong |
05:26:29 | FromDiscord | <leorize> wrong\ |
05:28:21 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=HapkcsBI |
05:28:45 | FromDiscord | <heysokam> wait, might be `3`, not `7` |
05:28:52 | FromDiscord | <leorize> nope |
05:28:55 | FromDiscord | <leorize> don't forget about endians |
05:29:13 | FromDiscord | <heysokam> I couldn't care less about big endian |
05:29:39 | FromDiscord | <heysokam> if it works on 95% of modern computers, I'm good |
05:30:05 | FromDiscord | <heysokam> otoh, I could make that field a getter/setter 🤔 |
05:30:37 | FromDiscord | <leorize> I'm glad you're getting more reasonable |
05:30:59 | FromDiscord | <leorize> alternatively just create a new `bool` enum with `{.size: sizeof(cint).}` with converters to normal `bool` |
05:33:03 | FromDiscord | <heysokam> that overload sounds not fun, ngl |
05:33:42 | FromDiscord | <leorize> that's about all the issues I noticed |
05:34:06 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=zcDXCIwL |
05:34:10 | FromDiscord | <heysokam> the last two |
05:34:43 | FromDiscord | <heysokam> wouldn't `{.alignas: .. .}` do the trick here? |
05:34:44 | FromDiscord | <leorize> it's more the ones in Screen and your faulty gl\_Uint |
05:35:21 | FromDiscord | <heysokam> In reply to @leorize "it's more the ones": its still not working though 🤷♂️ |
05:35:41 | FromDiscord | <leorize> I didn't notice you only wanted your code to work /some/ of the time |
05:36:32 | FromDiscord | <heysokam> wdym? |
05:36:36 | FromDiscord | <leorize> if your structures are not a 1\:1 representation of the C side, you can forget about making anything work |
05:38:34 | FromDiscord | <leorize> seems to me that you wrote the code on the C side too |
05:38:36 | FromDiscord | <leorize> any reason to use your own fancy bool? |
05:40:10 | FromDiscord | <heysokam> simplicity on the C side. doesn't affect this project much, though |
05:40:27 | FromDiscord | <heysokam> I copy/pasted from another where it does matter more |
05:40:46 | FromDiscord | <leorize> C99 \_Bool exists and it's compatible with nim bool |
05:41:57 | FromDiscord | <leorize> I guess you could just add to your `ffi.c` `typedef _Bool tfb_bool;` and `#define tfb_false (0)` `#define tfb_true (1)` |
05:42:48 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=llwhAsUI |
05:43:29 | FromDiscord | <leorize> that works |
05:44:25 | FromDiscord | <heysokam> how do I map it to nim, though? |
05:44:39 | FromDiscord | <leorize> I'm not a fan of what you do with the `union`, but it's valid C, so 🤷 |
05:44:46 | FromDiscord | <leorize> not valid C++, though |
05:44:48 | FromDiscord | <leorize> C bool should be the same as Nim's |
05:44:54 | FromDiscord | <heysokam> `type tfb_bool = bool`? |
05:45:11 | FromDiscord | <leorize> pretty much |
05:45:21 | FromDiscord | <heysokam> ty |
05:46:03 | FromDiscord | <heysokam> In reply to @leorize "I'm not a fan": me neither, but haven't figured out a nice api for it yet |
05:46:26 | FromDiscord | <leorize> for `tfb_Color`, either fix your Nim to use `uint32` or add `{.align: 4.}` to the object |
05:48:44 | FromDiscord | <heysokam> In reply to @leorize "for `tfb_Color`, either fix": I don't follow |
05:49:31 | FromDiscord | <leorize> your union has a natural alignment of `4` because it has a variant that's `uint32` |
05:49:35 | FromDiscord | <leorize> your `Color` however have a natural alignment of `1` because it's only `bytes` |
05:50:01 | FromDiscord | <heysokam> oh |
05:50:53 | FromDiscord | <heysokam> `type Color {.align: sizeof(uint32).}= object` like so? |
05:50:56 | FromDiscord | <leorize> I'd say to not bother with the other variants and just use a `distinct uint32` |
05:51:58 | FromDiscord | <heysokam> In reply to @leorize "I'd say to not": That'd change the API in between langs, which I'd rather avoid |
05:52:45 | FromDiscord | <leorize> it'd be `alignof(uint32)`↵(@heysokam) |
05:52:56 | FromDiscord | <leorize> just add accessors for the other variants↵(@heysokam) |
05:53:25 | FromDiscord | <leorize> defining `[]` and `.rgba` is trivial in nim |
05:54:17 | FromDiscord | <heysokam> yep! the align on the color was the issue! tytyty 🙏↵There is no way in hell I would have guessed that, lol |
05:55:05 | FromDiscord | <leorize> np, FFI is quite a science |
05:55:09 | FromDiscord | <heysokam> In reply to @leorize "defining `[]` and `.rgba`": but its `color.arr[]` not `color[]`, right? |
05:55:28 | FromDiscord | <heysokam> I love the `.rgba` field, much better than `.hex`. useful! |
05:55:49 | FromDiscord | <leorize> I once had to deal with a library that only crashes in skull but not nim, and turns out it was `enum` sizing |
05:56:22 | FromDiscord | <heysokam> you do have a point that `.arr[]` vs `[]` in nim, the latter is way better |
05:56:57 | FromDiscord | <heysokam> In reply to @leorize "I once had to": oh shoot. well I'm glad I'm able to leverage your research then! that's epic |
05:57:02 | FromDiscord | <leorize> you have to pick and choose what you want to show in each language |
05:57:39 | FromDiscord | <heysokam> In reply to @leorize "you have to pick": true, but if you don't pay attention/effort to keeping the apis the same, then they don't even resemble each other in the end |
05:57:47 | FromDiscord | <leorize> matrix lags behind by one message lol |
05:59:14 | FromDiscord | <leorize> btw you might not want to use `attribute((const))` |
05:59:18 | FromDiscord | <leorize> it doesn't work the way you think it does |
06:00:21 | FromDiscord | <heysokam> In reply to @leorize "it doesn't work the": how do you think I think it works? |
06:01:39 | FromDiscord | <leorize> you think it works like `{.noSideEffects.}` given how you plastered it on `tfb_init` and `tfb_close` |
06:02:39 | FromDiscord | <leorize> it doesn't even work for the `tfb_pixels_size` case |
06:04:51 | FromDiscord | <heysokam> sent a long message, see https://pasty.ee/TCYTJvyR |
06:04:59 | FromDiscord | <leorize> sent a long message, see https://pasty.ee/iKgpBnJT |
06:06:02 | FromDiscord | <leorize> you're calling `glfw` APIs, which definitely change state so it wouldn't even qualify for `{.noSideEffects.}` in Nim proper |
06:07:20 | FromDiscord | <leorize> and it wouldn't work for `tfb_pixels_size` because between two calls you could've modified the pixels object, which is then a violation of the contract |
06:08:09 | FromDiscord | <heysokam> but the object is passed in at the time of calling |
06:08:45 | FromDiscord | <heysokam> In reply to @leorize "you're calling `glfw` APIs,": that's true. but its the best one can do in C |
06:09:17 | FromDiscord | <leorize> don't add attributes that you can't guarantee to the letter |
06:09:37 | FromDiscord | <heysokam> I'd rather have a language-wide semantic pass, like noSideEffects from nim, but const is the closest alternative 🙁 |
06:09:40 | FromDiscord | <leorize> Nim does not care about `{.noSideEffects.}` other than as an advisory pragma |
06:10:01 | FromDiscord | <leorize> but C compilers can and will assume things the moment you slip |
06:10:25 | FromDiscord | <heysokam> I see |
06:10:44 | FromDiscord | <leorize> never put attributes you can't guarantee unless you are in for pain |
06:11:08 | FromDiscord | <leorize> for example `tfb_init` being `const` meant that if it's the only function called, the compiler is free to assume that it could just remove the call because it doesn't change state |
06:11:37 | FromDiscord | <leorize> I won't say that it will do that, but that attribute gives it a license to |
06:17:44 | FromDiscord | <leorize> sent a code paste, see https://play.nim-lang.org/#pasty=lvrYWzuN |
06:21:02 | FromDiscord | <heysokam> oh, I see what you mean |
07:53:20 | * | alexdaguy joined #nim |
08:31:07 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "yes!": based |
09:09:57 | * | shwouchk quit (Quit: WeeChat 4.5.2) |
09:12:41 | FromDiscord | <janakali> In reply to @albassort "just imagine it": just write down all calculations by hand for 1 frame per month performance |
09:26:48 | * | alexdaguy quit (Quit: WeeChat 4.7.0) |
09:30:53 | * | tiorock joined #nim |
09:30:53 | * | rockcavera is now known as Guest2333 |
09:30:53 | * | Guest2333 quit (Killed (copper.libera.chat (Nickname regained by services))) |
09:30:53 | * | tiorock is now known as rockcavera |
09:33:00 | * | tiorock joined #nim |
09:33:00 | * | tiorock quit (Changing host) |
09:33:00 | * | tiorock joined #nim |
09:33:00 | * | rockcavera quit (Killed (iridium.libera.chat (Nickname regained by services))) |
09:33:00 | * | tiorock is now known as rockcavera |
09:54:28 | FromDiscord | <Laylie> it is done↵(@nasuray) |
10:24:10 | * | tiorock joined #nim |
10:24:10 | * | tiorock quit (Changing host) |
10:24:10 | * | tiorock joined #nim |
10:24:10 | * | rockcavera quit (Killed (erbium.libera.chat (Nickname regained by services))) |
10:24:10 | * | tiorock is now known as rockcavera |
10:26:15 | * | tiorock joined #nim |
10:26:15 | * | tiorock quit (Changing host) |
10:26:15 | * | tiorock joined #nim |
10:26:15 | * | rockcavera is now known as Guest3155 |
10:26:15 | * | tiorock is now known as rockcavera |
10:29:10 | * | Guest3155 quit (Ping timeout: 260 seconds) |
10:40:31 | * | beholders_eye joined #nim |
10:50:05 | * | beholders_eye quit (Ping timeout: 265 seconds) |
10:51:45 | * | beholders_eye joined #nim |
11:18:40 | * | przmk quit (Remote host closed the connection) |
11:20:32 | * | przmk joined #nim |
11:23:38 | * | skippy8 quit (Quit: WeeChat 4.6.3) |
11:56:21 | * | przmk quit (Remote host closed the connection) |
12:13:37 | * | przmk joined #nim |
12:20:04 | FromDiscord | <aintea> In reply to @janakali "just write down all": Just use your gut bacteria to run it, it takes roughly 9 hours for one frame |
12:20:15 | FromDiscord | <aintea> (it has been done, 48x32 resolution) |
12:23:19 | * | beholders_eye quit (Ping timeout: 260 seconds) |
12:24:57 | * | beholders_eye joined #nim |
12:55:47 | * | andy-turner joined #nim |
14:01:48 | FromDiscord | <ollicron_53732> I am somewhere on this curve learning how to use macros https://media.discordapp.net/attachments/371759389889003532/1404102434942488606/Screenshot_2025-07-28_at_8.png?ex=6899f7cb&is=6898a64b&hm=316d98be38ba37121b74ff2f80d44560d89efa411c1b93d0e1003a32323c70d1& |
14:02:17 | FromDiscord | <ollicron_53732> probably the slope of enlightenment |
14:24:34 | * | nils` quit (Ping timeout: 245 seconds) |
14:35:54 | FromDiscord | <heysokam> I'm definitely in the valley of despair about macros, and its so comfortable around here!↵Proceduralism and explicitness have their summer homes on this valley! |
14:36:50 | FromDiscord | <heysokam> (edit) "here!↵Proceduralism" => "here!↵Proceduralism, imperativeness" | "valley!" => "valley too! 🏖️" |
14:54:01 | FromDiscord | <0xfab_10> kid named typeclasses with macros: |
15:23:50 | * | nils` joined #nim |
15:26:00 | FromDiscord | <Robyn [She/Her]> In reply to @ollicron_53732 "I am somewhere on": macros aren't really that hard though? |
15:26:08 | FromDiscord | <Robyn [She/Her]> AST is just data |
15:40:05 | FromDiscord | <mr_rowboto> In reply to @heysokam "I'm definitely in the": I also sit in the comfort of not fucking up the AST. |
15:40:35 | FromDiscord | <mr_rowboto> I have more than enough with my stuff |
16:01:08 | FromDiscord | <heysokam> does the `a in B` operator call `B.items()` internally? |
16:07:35 | FromDiscord | <heysokam> ah, I just found the answer in the manual. never saw this section↵https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-implicit-itemsslashpairs-invocations |
16:12:08 | * | joast quit (Quit: Leaving.) |
16:17:44 | * | ehmry quit (Read error: Connection reset by peer) |
16:18:46 | * | ehmry joined #nim |
16:47:26 | * | joast joined #nim |
17:06:09 | * | skippy8 joined #nim |
17:23:47 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=ptJkdYWv |
17:36:32 | FromDiscord | <Elegantbeef> @heysokam It's a union so use the union pragma |
17:37:05 | FromDiscord | <Elegantbeef> If you don't want it to be overlapping don't use the union keyword in C |
17:37:20 | FromDiscord | <Elegantbeef> `size_of(tfb_Color) == sizeof(uint8_T)` |
17:37:47 | FromDiscord | <heysokam> Its not a union? |
17:38:02 | FromDiscord | <leorize> union meant every entries share memory |
17:38:11 | FromDiscord | <heysokam> oh... wait I'm retarded. I forgot to remove my type to `struct`!!! |
17:38:11 | FromDiscord | <leorize> so that union of yours is 1 byte sized |
17:38:30 | FromDiscord | <heysokam> classic sokam misread 🐠 |
17:38:33 | FromDiscord | <Elegantbeef> Leo always repeating what I say, it's unfair |
17:42:16 | FromDiscord | <leorize> if saying it once doesn't work saying it twice should, right? |
17:42:39 | FromDiscord | <Elegantbeef> You have a way with words |
18:08:05 | FromDiscord | <heysokam> I solved the gpu drivers segfault by removing `union`, but now I'm back to segfaulting on `free( the ptr )` from NIm, and not from regular C 🙁 |
18:10:21 | FromDiscord | <leorize> send code and I can take a quick peek |
18:17:38 | FromDiscord | <heysokam> sent a long message, see https://pasty.ee/vhefxRcI |
18:18:23 | FromDiscord | <heysokam> the `ColorRGBX` type is the same I had before without the align:↵https://github.com/heysokam/tinyfb/blob/a40dec3079c8bbc8c4b7e66b9cbdc173930dbbc7/src/tinyfb.h#L378 |
18:18:37 | FromDiscord | <heysokam> (edit) "align:↵https://github.com/heysokam/tinyfb/blob/a40dec3079c8bbc8c4b7e66b9cbdc173930dbbc7/src/tinyfb.h#L378" => "align:↵https://github.com/treeform/chroma/blob/master/src/chroma/colortypes.nim#L24-L29" |
18:21:56 | FromDiscord | <leorize> tfb\_init\_args definition of clear\_color doesn't match C side |
18:23:42 | FromDiscord | <heysokam> In reply to @leorize "tfb\_init\_args definition of clear\_color": why not? |
18:24:18 | FromDiscord | <leorize> one is pointer the other is struct |
18:24:46 | FromDiscord | <heysokam> `result = tfb_init(args.addr)` 🤔 |
18:25:23 | FromDiscord | <heysokam> `proc tfb_init (args :ptr tfb_init_args) :Screen {.importc:"tfb_init", cdecl.}` |
18:25:36 | FromDiscord | <leorize> you're missing half of my statement |
18:26:04 | FromDiscord | <heysokam> I don't understand your statement at all if you say that |
18:26:27 | FromDiscord | <leorize> look at clear\_color |
18:27:45 | FromDiscord | <heysokam> I'm looking, and I don't see anything |
18:28:04 | FromDiscord | <heysokam> also, never trust me with "look at X". I'll 1000000000000000% miss it |
18:28:21 | FromDiscord | <leorize> this is a pointer\: https://github.com/heysokam/tinyfb/blob/a40dec3079c8bbc8c4b7e66b9cbdc173930dbbc7/src/tinyfb.h#L152this isn't\: https://github.com/heysokam/tinyfb/blob/a40dec3079c8bbc8c4b7e66b9cbdc173930dbbc7/src/tinyfb.nim#L77 |
18:28:27 | * | ftajhii quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
18:29:44 | FromDiscord | <leorize> thanks to that your struct is probably 4 bytes short of it's real size |
18:30:09 | FromDiscord | <heysokam> jezuz, that was it. insane catch |
18:30:53 | FromDiscord | <heysokam> 💐 tysm, once again. there is no way in hell I'd have solved these two issues on my own 🙏 |
18:31:49 | FromDiscord | <leorize> your dream of having one impl multiple wrappers is definitely not scaling well lol |
18:37:32 | * | ftajhii joined #nim |
18:43:52 | FromDiscord | <0xfab_10> man do I miss some rust stuff in nim, like a `Box<[T]>` equivalent |
18:44:25 | FromDiscord | <0xfab_10> there's `seq[T]` but that's like `Vec<T>` and I don't think it properly communicates intention |
18:44:49 | FromDiscord | <0xfab_10> "make your own" yeah but ugh |
18:45:16 | FromDiscord | <0xfab_10> then I need to dig in the guts of `seq[T]` to have a `to_boxed_slice` equivalent |
18:46:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=GDwqkTYQ |
18:46:54 | FromDiscord | <leorize> why RTTI |
18:47:07 | FromDiscord | <leorize> and also box is single owner |
18:47:59 | FromDiscord | <Elegantbeef> Sorry my mind was thinking box as in the C# variety |
18:48:30 | FromDiscord | <0xfab_10> fixed size heap array |
18:48:47 | FromDiscord | <0xfab_10> runtime sized |
18:48:52 | FromDiscord | <Elegantbeef> That's not what a box is though |
18:48:59 | FromDiscord | <Elegantbeef> A box is just a single owner heap allocation |
18:49:18 | FromDiscord | <Elegantbeef> If you want a fixed size heap array just do `ref array[10000000, int]` |
18:50:24 | FromDiscord | <0xfab_10> yes a box is a single owner heap allocator |
18:50:41 | FromDiscord | <0xfab_10> a `Box<[T]>` is a single owner, heap allocated, runtime sized array |
18:50:46 | FromDiscord | <leorize> you can just make your own with `ptr UncheckedArray`↵(@0xfab_10) |
18:50:54 | FromDiscord | <ieltan> In reply to @fabric.input_output "man do I miss": I'm working on exactly that atm |
18:50:56 | FromDiscord | <0xfab_10> In reply to @fabric.input_output "then I need to": . |
18:51:16 | FromDiscord | <Elegantbeef> Box is not an array though |
18:51:35 | FromDiscord | <ieltan> Best I could do is a BoxArray[T] which is backed by a `ptr UncheckArray[T] ` |
18:51:43 | FromDiscord | <ieltan> (edit) "UncheckArray[T]" => "UncheckedArray[T]" |
18:52:03 | FromDiscord | <0xfab_10> In reply to @Elegantbeef "Box is not an": box isn't, `Box<[T]>` is |
18:52:20 | FromDiscord | <ieltan> In reply to @Elegantbeef "Box is not an": Well `BoxSeq` sounded less cool in my mind lol |
18:52:40 | FromDiscord | <ieltan> And I still think it get the point across anyways |
18:53:11 | FromDiscord | <ieltan> You cannot grow a `Box<[T]>` for instance |
18:53:46 | FromDiscord | <Elegantbeef> Oh god there is a `Box<T>` and `Box<[T]>` |
18:53:54 | FromDiscord | <ieltan> |
18:53:57 | FromDiscord | <ieltan> Yes |
18:54:08 | FromDiscord | <leorize> rust just happens to have a real slice type |
18:54:08 | FromDiscord | <ieltan> I was also kinda confused at first though |
18:54:11 | FromDiscord | <0xfab_10> `Box<[T]>` is just `Box<U>` for `U: [T]` |
18:54:16 | FromDiscord | <Elegantbeef> `std::vector<std::bool>` isn't looking too bad now |
18:54:28 | FromDiscord | <0xfab_10> In reply to @leorize "rust just happens to": slices are so good 😭 |
18:54:34 | FromDiscord | <leorize> it'd be `Box[openArray[T]]` in Nim lingo |
18:54:45 | FromDiscord | <leorize> except that nim openarrays doesn't work that way |
18:54:54 | FromDiscord | <Elegantbeef> I don't like specializations that change the intent 😄 |
18:54:56 | FromDiscord | <0xfab_10> lowkey hate openarrays |
18:55:03 | FromDiscord | <ieltan> I though rust was supposed to be very verbose so I was waiting to see `Box<Slice<T>>` or something, what's up with that hm? |
18:55:03 | FromDiscord | <Elegantbeef> Lowkey hate you |
18:55:28 | FromDiscord | <Elegantbeef> Anyway then yea just wrap it in a `ptr UncheckedArray[T]` and cry when you have memory issues |
18:55:30 | FromDiscord | <0xfab_10> In reply to @ieltan "I though rust was": `Slice<T>` is just `[T]` because it's so fundamental to the language |
18:55:59 | FromDiscord | <ieltan> Openarray are cool, they just view types to be in the language for real |
18:56:10 | FromDiscord | <ieltan> And maybe an actual usable name... |
18:56:18 | FromDiscord | <ieltan> (edit) "Openarray are cool, they just ... view" added "need" |
18:57:57 | FromDiscord | <ieltan> In reply to @fabric.input_output "`Slice<T>` is just `[T]`": Makes sense |
19:07:55 | FromDiscord | <leorize> rust has a rather clear separation between refs and concrete types, for better or worse |
19:09:19 | FromDiscord | <0xfab_10> I think it's better |
19:09:46 | FromDiscord | <0xfab_10> In reply to @Elegantbeef "`std::vector<std::bool>` isn't looking too": you scared of fat pointers? |
19:12:56 | FromDiscord | <Elegantbeef> Specializations changing behaviour is always fun, though I also do it, so perhaps I'm just annoying |
19:12:57 | FromDiscord | <Elegantbeef> No |
19:14:43 | FromDiscord | <0xfab_10> well it's not some random struct changing behavior through specialization, it's just a core language mechanic |
19:15:16 | FromDiscord | <Elegantbeef> I mean it is |
19:15:46 | FromDiscord | <Elegantbeef> `Box<[T]>` Behaves differently than `Box<T>` and that's 'some random struct changing behaviour through specialization' |
19:15:53 | FromDiscord | <0xfab_10> no it doesn't |
19:16:03 | FromDiscord | <leorize> it's the same beef |
19:16:41 | FromDiscord | <0xfab_10> `Box<U>` keeps a `U` and when `U: [T]` it holds a `[T]` which is a fat pointer |
19:16:42 | FromDiscord | <leorize> Rust openArray happens to be valid standalone |
19:16:44 | FromDiscord | <0xfab_10> that's a thing the language does |
19:17:44 | FromDiscord | <Elegantbeef> Ehhh |
19:18:11 | FromDiscord | <Elegantbeef> I'll agree only due to ignorance |
19:18:46 | FromDiscord | <0xfab_10> nothing crazy level as `std::vector<bool>` transforming into a bitset or the `std::string`s doing short string optimizations |
19:21:23 | FromDiscord | <leorize> it's powerful but you run into `&String` and `&str` real quick↵(@0xfab_10) |
19:22:18 | FromDiscord | <0xfab_10> I don't see an issue |
19:22:27 | FromDiscord | <0xfab_10> I like the distinction |
19:23:23 | FromDiscord | <0xfab_10> besides `&String` kindof a useless thing, you either `&mut String` or `&str` |
19:23:51 | FromDiscord | <0xfab_10> `Box<str>` 😎 |
19:24:07 | FromDiscord | <leorize> yes but generics exist and it will mint `&String`, like it or not |
19:24:54 | FromDiscord | <leorize> I know how to avoid it, but it's a kind of splinter from having this sort of types |
19:25:41 | FromDiscord | <0xfab_10> I don't get it, just don't have `&String` happen? |
19:28:08 | FromDiscord | <leorize> it doesn't happen because you write it, it happens because generics specialize into it |
19:28:33 | FromDiscord | <0xfab_10> yes but what is a situation where you give it to a generic that turns it into `&String` |
19:28:34 | FromDiscord | <leorize> not that big of a deal, but it's annoying nevertheless |
19:28:47 | FromDiscord | <leorize> `Option<T>` |
19:29:25 | FromDiscord | <leorize> you get `&String` out from a simple `.as_ref` |
19:29:28 | FromDiscord | <0xfab_10> oh I forgot that could happen |
19:29:35 | FromDiscord | <leorize> but like I said, it's not really a big deal |
19:29:54 | FromDiscord | <0xfab_10> `Option<&T>` is just discarded or transformed immediately |
19:29:57 | FromDiscord | <0xfab_10> usually |
19:30:07 | FromDiscord | <leorize> but it's an extra thing to be aware of in Rust |
19:30:16 | FromDiscord | <leorize> I prefer not having that if possible |
19:31:28 | FromDiscord | <0xfab_10> `impl Option<String> { pub fn as_str(&self) -> Option<&str> { self.map(String::as_str) } }` :^) |
19:32:13 | FromDiscord | <0xfab_10> I'm usually completely unaware of things like this 90% of the time |
19:32:26 | * | skippy8 quit (Quit: WeeChat 4.6.3) |
19:32:30 | FromDiscord | <leorize> the fact you have to create a specialization is something I don't like to see |
19:56:13 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#pasty=JRjzjKJI |
19:56:56 | FromDiscord | <leorize> false 0 true? |
19:57:03 | FromDiscord | <heysokam> 42, 42, 46&2 |
19:57:17 | FromDiscord | <ieltan> In reply to @leorize "false 0 true?": yup |
19:57:38 | FromDiscord | <ieltan> it was kinda surprising to me but maybe i am just not knowledgeable about how closure iterators work |
19:57:47 | FromDiscord | <heysokam> > reference for the `46&2` one:↵> https://www.youtube.com/watch?v=GIuZUCpm9hc |
19:58:00 | FromDiscord | <ieltan> In reply to @heysokam "42, 42, 46&2": is that supposed to mean it's ud? |
19:58:19 | FromDiscord | <ieltan> In reply to @heysokam "> reference for the": oh lol |
19:58:37 | FromDiscord | <ieltan> (idontgetit) |
19:58:44 | FromDiscord | <heysokam> In reply to @ieltan "is that supposed to": it means you answered life two times, and then blasted some metal in celebration. who cares about the bug! |
19:59:49 | FromDiscord | <ieltan> I'll blast the metal after the "bug" is blasted too :p |
20:00:01 | FromDiscord | <ieltan> But i am not even sure if that's even a bug |
20:00:04 | FromDiscord | <ieltan> gotta ask araq |
20:00:06 | FromDiscord | <leorize> iterators stop at `yield` then pick back up from there, so I agree that it can be very confusing.The last iterations were just continuing from the last yield, because technically that's not where the iterator code stops (it still has to hit the `for` line to check and exit), and if you didn't yield (because you're exiting), you get the default value↵(@ieltan) |
20:01:56 | FromDiscord | <leorize> the representation of most closure iterators will always be off-by-one because of this |
20:02:49 | FromDiscord | <leorize> the best way to model it is actually to consider `finished` more like `not hasValue`, then only interpret the value according to it |
20:03:53 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#pasty=yTdaPeyC |
20:04:31 | FromDiscord | <ieltan> I never really deal with `emit` so i don't understand anything |
20:04:53 | FromDiscord | <ieltan> `ClE_0` has to be the closure environment |
20:05:04 | FromDiscord | <ieltan> but it's totally type erased so i cannot just do stuff |
20:05:58 | FromDiscord | <ieltan> In reply to @leorize "iterators stop at `yield`": Hm yeah i get how i have the 0 now. But shouldn't `finished` take this into account ? |
20:11:41 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#pasty=bgxEueOd |
20:13:31 | FromDiscord | <ieltan> sent a long message, see https://pasty.ee/FdGTGjrg |
20:15:53 | FromDiscord | <leorize> add an echo to the end of your iterator and you will see why finished doesn't just fire at the last yield |
20:19:53 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#pasty=hgfwmmQM |
20:21:00 | FromDiscord | <ieltan> ok so at the fifth iteration it's still stuck at the last `yield` |
20:21:24 | FromDiscord | <ieltan> it's not until i call the iterator again that it's "unstuck" is that right ? |
20:21:39 | FromDiscord | <leorize> yep |
20:22:25 | FromDiscord | <ieltan> that's just great lol i wonder if it's possible to even work around that somehow but i don't think it is |
20:37:56 | FromDiscord | <leorize> it doesn't even make sense to, closure iterators are just built different |
21:28:34 | * | andy-turner quit (Quit: Leaving) |
21:28:38 | FromDiscord | <.tokyovigilante> Are there any best practices for custom [] operators, or custom operators in general? E.g. proc vs template. |
21:29:33 | FromDiscord | <leorize> operators are just callables, pick `proc`/`template`/etc. as you would with other callables |
21:38:28 | FromDiscord | <blashyrk> Nim + GCC15 = magic↵Nim + MSVC = poopoo↵↵Or I guess MSVC = poopoo in general |
21:38:50 | FromDiscord | <blashyrk> (edit) "Nim + GCC15 = magic↵Nim + MSVC = poopoo↵↵Or I guess MSVC = poopoo in general" => "sent a long message, see https://pasty.ee/uZwgWBlf" |
21:40:20 | FromDiscord | <leorize> just use clang if you must interact with other msvc stuff |
21:41:39 | FromDiscord | <blashyrk> I use it anyway since it seems to produce better machine code than anything else on Windows, but I still get better performance in WSL2 than a native Windows binary because GCC15 seems to knock heavy fp math out of the park with little extra guidance |
21:42:20 | FromDiscord | <leorize> you can also use gcc on windows |
21:42:53 | FromDiscord | <leorize> linux might just be better at fp math to start by not requiring register spilling for certain function signatures |
21:43:05 | FromDiscord | <blashyrk> Gcc as in not mingw? Because mingw also produces inferior binaries for whatever reason |
21:43:21 | FromDiscord | <leorize> mingw uses the same internal transformer |
21:43:50 | FromDiscord | <leorize> mind the objects you pass around, it could be the source of your bad code due to some annoying Win32 calling convention requirements |
21:43:59 | FromDiscord | <blashyrk> Hmm that's strange, one would think that ABI differences wouldn't result in 20-30% performance diff |
21:44:31 | FromDiscord | <leorize> in hot fp loops whether you get to keep your data in registers directly influence performance |
21:44:41 | FromDiscord | <blashyrk> I'll have to dig deeper to see what's really going on, just wish there was something like perf on windows |
21:44:47 | FromDiscord | <leorize> there is |
21:45:25 | FromDiscord | <blashyrk> WPT doesn't work for me I can generate a report with the xperf tool but can't open it in the viewer for whatever reason |
21:45:55 | FromDiscord | <leorize> you can also just use intel vtune |
21:46:25 | FromDiscord | <blashyrk> Probably the amd's thingy instead since I have a 7950x |
21:51:55 | FromDiscord | <blashyrk> Lol well the thing is useless unfortunately https://media.discordapp.net/attachments/371759389889003532/1404220742626705569/image.png?ex=689a65fa&is=6899147a&hm=fe385d87bda6c2de14c05bfbe13e0a865943ee9b4b9d3056afe590c6b33c202e& |
21:52:31 | FromDiscord | <leorize> maybe that's why WPT didn't work for you lol |
21:52:59 | FromDiscord | <blashyrk> Yeah but having to drop virtualization in uefi so you can profile your code is nuts |
21:53:37 | FromDiscord | <leorize> no you only have to drop windows virtualization-based separation |
21:54:06 | FromDiscord | <leorize> that feature runs the entire system in a hyper-v VM |
21:54:16 | FromDiscord | <blashyrk> https://media.discordapp.net/attachments/371759389889003532/1404221337333141605/image.png?ex=689a6687&is=68991507&hm=91259cb8a07b886c0f92ccae9c98395c1af87f2fc0a21918c96c563e5f81fb9d& |
21:54:39 | FromDiscord | <leorize> maybe don't bother with windows lol |
21:54:49 | FromDiscord | <blashyrk> In reply to @leorize "maybe don't bother with": I guess that's the best course of action hahah |
21:54:53 | FromDiscord | <leorize> use linux perfs to get the hotspot then just disassemble your windows code to look at them |
22:52:58 | * | ChanServ quit (shutting down) |
23:17:05 | * | beholders_eye quit (Ping timeout: 248 seconds) |
23:19:10 | * | beholders_eye joined #nim |
23:23:34 | * | adigitoleo quit (Server closed connection) |
23:25:42 | * | adigitoleo joined #nim |