00:47:49 | * | proaxis quit (Ping timeout: 264 seconds) |
00:55:00 | * | proaxis joined #nim |
01:13:12 | * | proaxis_ joined #nim |
01:15:05 | * | proaxis quit (Ping timeout: 268 seconds) |
01:34:55 | * | proaxis_ quit (Remote host closed the connection) |
01:34:57 | * | proaxis__ joined #nim |
02:05:36 | * | azimut quit (Remote host closed the connection) |
02:06:23 | * | azimut joined #nim |
02:48:42 | * | azimut quit (Ping timeout: 260 seconds) |
02:49:00 | * | azimut joined #nim |
02:49:26 | * | Jjp137 quit (Quit: Leaving) |
02:52:34 | * | Jjp137 joined #nim |
03:14:59 | * | azimut quit (Remote host closed the connection) |
03:15:22 | * | azimut joined #nim |
03:58:35 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
03:58:59 | * | SchweinDeBurg joined #nim |
04:46:32 | * | krux02 quit (Remote host closed the connection) |
04:46:55 | * | krux02 joined #nim |
05:02:28 | * | krux02 quit (Remote host closed the connection) |
05:50:21 | * | rockcavera quit (Remote host closed the connection) |
06:10:46 | * | azimut quit (Ping timeout: 260 seconds) |
06:54:42 | FromDiscord | <sOkam! 🫐> In reply to @toma400 "I'm sorry if this": `let data = readFile("file.exe")` |
06:55:23 | FromDiscord | <sOkam! 🫐> you can use streams or strings, but if you use strings you get access to `treeform/binny` which is made to handle those things |
06:56:11 | FromDiscord | <Elegantbeef> You can just do `open("path")` and `File`s have a bunch of operations on them |
07:42:17 | * | ntat joined #nim |
07:47:59 | * | pmp-p joined #nim |
08:10:48 | * | al1ranger joined #nim |
08:17:51 | * | al1ranger quit (Quit: Leaving) |
08:37:47 | * | advesperacit joined #nim |
08:48:00 | FromDiscord | <viixzuu> hm |
09:00:46 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=FpoLibXIJLtC |
09:11:45 | FromDiscord | <intellij_gamer> sent a code paste, see https://play.nim-lang.org/#pasty=SgPIlwOOicDM |
09:15:35 | FromDiscord | <whisperecean> Does anybody know how I can configure nph globally for all Nim files in vscode? |
09:18:07 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=xVUBqHEzcAoX |
09:18:14 | FromDiscord | <sOkam! 🫐> (edit) "https://play.nim-lang.org/#pasty=MgeuHSfVkLxc" => "https://play.nim-lang.org/#pasty=pZRgFKQVDnDS" |
09:42:49 | FromDiscord | <intellij_gamer> sent a code paste, see https://play.nim-lang.org/#pasty=CoEKHAgxsLLV |
09:56:21 | FromDiscord | <sOkam! 🫐> interesting solution |
09:57:47 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=CLNLjxXYTruN |
09:58:32 | FromDiscord | <Elegantbeef> `var` I assume |
10:02:59 | FromDiscord | <sOkam! 🫐> do ref objects need var when passing them? |
10:03:14 | FromDiscord | <sOkam! 🫐> also, that didn't fix it for some reason 🤔 |
10:03:23 | FromDiscord | <sOkam! 🫐> (edit) "them?" => "them as arguments to functions?" |
10:03:51 | FromDiscord | <Elegantbeef> If you want to change where the ref points yes |
10:03:56 | FromDiscord | <Elegantbeef> If you just want to change the data no |
10:04:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=mbBawTbmkRve |
10:10:56 | FromDiscord | <sOkam! 🫐> might be that the generic is not accessible in the file? 🤔 |
10:11:07 | FromDiscord | <sOkam! 🫐> but its `` though... |
10:15:18 | FromDiscord | <Elegantbeef> https://wandbox.org/permlink/EYpv6QfPpK86QVJy that also works |
10:15:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=suwRdnvPMKlr |
10:16:04 | FromDiscord | <Elegantbeef> well fuck |
10:24:18 | FromDiscord | <sOkam! 🫐> In reply to @Elegantbeef "The only case this": which one is the intermediate generic? 🤔 |
10:25:05 | NimEventer | New Nimble package! selfpipe - Easy safe signal handling, see https://github.com/tdely/selfpipe |
10:25:06 | FromDiscord | <Elegantbeef> It'd be the one that calls `height=` if it exists |
10:26:07 | FromDiscord | <sOkam! 🫐> In reply to @Elegantbeef "It'd be the one": its not a generic, though. its just a function 🤔 |
10:27:11 | FromDiscord | <Elegantbeef> You wouldn't lie to me would you? |
10:32:55 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=AOvWCPPHnvvz |
10:36:09 | FromDiscord | <Elegantbeef> This module has the `height=` in it? |
10:36:31 | FromDiscord | <sOkam! 🫐> it imports the file, yeah. but don't know why its not resolving it 🤔 |
10:36:46 | FromDiscord | <Elegantbeef> `size` is the type you declared? |
10:37:37 | FromDiscord | <sOkam! 🫐> oh...↵`draw.nim(27, 37) Error: type mismatch: got 'int32' for 'height(wm.font) + 2' but expected 'u32 = uint32'` |
10:37:43 | FromDiscord | <sOkam! 🫐> so... the template was hiding the type error |
10:37:53 | FromDiscord | <sOkam! 🫐> changed all to func, and it showed this up |
10:38:05 | FromDiscord | <Elegantbeef> Yea stop using template where procs should be 😄 |
10:38:07 | FromDiscord | <sOkam! 🫐> and this is how I get remembered why I stopped using templates 🙈 |
10:38:27 | FromDiscord | <Elegantbeef> And with that I go |
10:38:36 | FromDiscord | <sOkam! 🫐> why would treeform use templates on vmath for this same usecase? |
10:38:49 | FromDiscord | <sOkam! 🫐> I was basically copying his setup |
11:56:49 | * | smlckz left #nim (WeeChat 4.1.1) |
12:43:53 | FromDiscord | <nikita4437> sent a code paste, see https://play.nim-lang.org/#pasty=AgMHrJcUUybw |
12:44:59 | FromDiscord | <djazz> bitsize pragma |
12:45:17 | FromDiscord | <djazz> <https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-bitsize-pragma> |
12:45:26 | FromDiscord | <nikita4437> thanks! |
13:37:09 | * | azimut joined #nim |
13:41:09 | * | deadmarshal_ quit (Ping timeout: 272 seconds) |
13:47:08 | * | xet7 joined #nim |
15:12:55 | * | deadmarshal_ joined #nim |
15:27:30 | * | azimut quit (Ping timeout: 260 seconds) |
16:06:12 | * | azimut joined #nim |
16:08:05 | * | ntat quit (Ping timeout: 272 seconds) |
16:10:39 | * | ntat joined #nim |
16:28:12 | FromDiscord | <Robyn [She/Her]> Trying to figure out the best way to implement functions on a variety of types that provide the same interface but may have differing functionality |
16:28:51 | FromDiscord | <Robyn [She/Her]> Like, some may be implemented as async, some may be implemented using cps |
16:28:57 | FromDiscord | <Robyn [She/Her]> Maybe a template? |
16:30:04 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=lwCtEVtfxLRv |
16:30:40 | FromDiscord | <odexine> "a uint32 rgba color" depends on what format we're talking about? |
16:30:51 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=UDzhKgrgPBQg |
16:30:56 | FromDiscord | <sOkam! 🫐> In reply to @odexine ""a uint32 rgba color"": whatever X11 uses |
16:31:20 | FromDiscord | <sOkam! 🫐> i know color formats make this different, but I just don't know exactly the type expected |
16:31:35 | * | disso-peach quit (Quit: Leaving) |
16:33:39 | FromDiscord | <odexine> In reply to @heysokam "whatever X11 uses": https://stackoverflow.com/questions/2434511/what-pixel-format-does-x-server-use |
16:34:19 | FromDiscord | <odexine> what part of x11 are you interfacing with |
16:35:23 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=GJlPCnlIeBiJ |
16:36:47 | FromDiscord | <odexine> likely your format should be ARGB -> A shl 24 + R shl 16 + G shl 8 + B |
16:38:35 | FromDiscord | <sOkam! 🫐> In reply to @odexine "what part of x11": xcb, currently initalizing the data so I can't see anything on the screen yet |
16:38:38 | FromDiscord | <odexine> if youre writing raw bytes, this would be BGRA on little endian and ARGB on big endian |
16:39:38 | FromDiscord | <odexine> what part of xcb |
16:40:51 | FromDiscord | <sOkam! 🫐> In reply to @odexine "what part of xcb": https://github.com/julian-goldsmith/dwm-xcb/blob/4515e6a70d49c506f6a6547bbcea951d7d40f807/dwm.c#L208 |
16:41:16 | FromDiscord | <sOkam! 🫐> that is an `uint32_t` value that is listed as `TODO: NOT YET DOCUMENTED` in the xcb docs |
16:41:57 | FromDiscord | <sOkam! 🫐> as we have `treeform/chroma` in Nim, I'm just skipping that function altogether, but I still need to produce an `uint32` that is compatible with it |
16:48:02 | FromDiscord | <sOkam! 🫐> In reply to @demotomohiro "How about to just": "just display" assumes I have code that renders anything on the screen↵this is before any of that, so very hard to render a color when you don't have anything rendering at all yet |
16:50:46 | FromDiscord | <sOkam! 🫐> will trial+error eventually I guess. seems like the only real option 😔 |
16:53:01 | FromDiscord | <odexine> seems like the case due to the underdocumented api |
16:56:40 | FromDiscord | <sOkam! 🫐> yep |
17:01:35 | FromDiscord | <sOkam! 🫐> is the address of an array the same as `arr[0].addr`?↵or does it happen like with sequences, that the data has more than the values? |
17:21:36 | * | cnx quit (Remote host closed the connection) |
17:22:26 | * | cnx joined #nim |
17:22:36 | FromDiscord | <m4ul3r> In reply to @heysokam "is the address of": Yeah, the address is described like that |
17:23:48 | FromDiscord | <odexine> In reply to @heysokam "is the address of": technically no. arr[0] can be the middle of the array because of custom indexing, so use arr[arr.low].addr |
17:25:14 | FromDiscord | <sOkam! 🫐> what i mean is if `arr.addr` is the same as `arr[arr.low].addr` |
17:25:51 | * | junaid_ joined #nim |
17:26:25 | FromDiscord | <odexine> i believe so yes |
17:31:47 | FromDiscord | <sOkam! 🫐> ty |
17:37:18 | FromDiscord | <m4ul3r> In reply to @odexine "technically no. arr[0] can": Wait, a[0] could be in the middle with custom indexing? |
17:37:35 | FromDiscord | <odexine> `array[-14..15, int]` |
17:38:49 | FromDiscord | <m4ul3r> That’s valid? It wouldn’t just make an array with 30 values and index at 0? |
17:40:01 | FromDiscord | <odexine> https://media.discordapp.net/attachments/371759389889003532/1213541334590160957/image.png?ex=65f5d970&is=65e36470&hm=57d8803be1b95dbf69f040b8194090891b0ab1df1e9856d8e1346a3425600b3c& |
17:40:25 | FromDiscord | <odexine> also why nim uses `^1` for backwards indexing instead of `-1` like some languages do |
17:40:40 | FromDiscord | <odexine> well not exactly, but yeah |
17:41:19 | * | junaid_ quit (Remote host closed the connection) |
17:44:18 | FromDiscord | <fosster> folks, anyone has been using atlas over nimble recently? |
17:45:23 | FromDiscord | <graveflo> In reply to @fosster "folks, anyone has been": ya |
17:46:08 | FromDiscord | <demotomohiro> In reply to @m4ul3r "That’s valid? It wouldn’t": It is the feature documented on Nim manual:↵https://nim-lang.org/docs/manual.html#types-array-and-sequence-types↵But I dont use array not starting from 0. |
17:48:57 | ehmry | fosster: I use atlas as a library over nimble as a library |
17:58:59 | * | rockcavera joined #nim |
18:01:18 | * | KhazAkar joined #nim |
18:08:18 | FromDiscord | <fosster> how is your experience so far↵(@graveflo) |
18:11:32 | FromDiscord | <fosster> I'm looking for documentation about the root file, but it seems it doesn't exist |
18:11:44 | FromDiscord | <fosster> something like "package.nimble" for nimble |
18:12:15 | FromDiscord | <nnsee> In reply to @odexine "": low key cursed |
18:12:47 | FromDiscord | <graveflo> In reply to @fosster "how is your experience": It does what it is supposed to do. There have been a few minor quirks, but nothing major. I prefer to use it whenever possible. Nimble is still coupled with several aspects of Nim so it's not easy to just pretend it doesn't exist, but I think that nimscript and some other changes could do away with it in theory. Overall I think it is worth using. I would use atlas and nimscript over nimble |
18:15:39 | FromDiscord | <sOkam! 🫐> sent a long message, see https://pasty.ee/VbiudpqjrEbA |
18:15:41 | FromDiscord | <graveflo> In reply to @fosster "something like "package.nimble" for": https://github.com/nim-lang/nimble?tab=readme-ov-file#nimble-reference↵Nimble has a nonsensical constraint on how .nimble files work, where the nimble file has to have the correct name, but you are also not allowed to have more than one .nimble file in the directory where it belongs. |
18:15:46 | FromDiscord | <sOkam! 🫐> (edit) "https://pasty.ee/OHNFaMBiLCbm" => "https://pasty.ee/RHwykHyHLtdW" |
18:15:47 | FromDiscord | <graveflo> but there is the documentation anyway |
18:16:16 | FromDiscord | <sOkam! 🫐> yeah, nimble restrictions make little sense, tbh |
18:18:24 | FromDiscord | <nnsee> shat about nimph |
18:18:29 | FromDiscord | <nnsee> what |
18:18:41 | FromDiscord | <graveflo> In reply to @heysokam "@fosster atlas has its": what does nimble make easier than nimscript? |
18:18:49 | FromDiscord | <fosster> what you mean by "as a library"↵(<@709044657232936960_ehmry=5b=49=52=43=5d>) |
18:18:50 | FromDiscord | <fosster> btw I'm saying this because nimble is giving me an error when it tries to fetch git libraries |
18:18:51 | FromDiscord | <fosster> sent a code paste, see https://play.nim-lang.org/#pasty=eKRuEDCZTwYT |
18:18:51 | FromDiscord | <fosster> git works fine on my machine, if I do `git clone https://github.com/planetis-m/naylib` works fine |
18:19:34 | FromDiscord | <sOkam! 🫐> In reply to @graveflo "what does nimble make": the implicit nimble tasks |
18:19:56 | FromDiscord | <fosster> what even is nimscript 😅 |
18:20:13 | FromDiscord | <sOkam! 🫐> In reply to @fosster "what even is nimscript": the language you have been using inside nimble files! |
18:20:23 | FromDiscord | <nnsee> nim, but at runtime |
18:20:34 | FromDiscord | <sOkam! 🫐> nimble files are just `.nims` files in disguise |
18:21:40 | FromDiscord | <fosster> owww really↵(@sOkam! 🫐) |
18:21:45 | FromDiscord | <fosster> so it isn't a nimble config file |
18:22:04 | FromDiscord | <sOkam! 🫐> nope, its a programming language |
18:22:13 | FromDiscord | <fosster> alright, but so how are you supposed to build packages with atlas? |
18:22:27 | FromDiscord | <sOkam! 🫐> `nim c yourfile` |
18:22:27 | FromDiscord | <fosster> so I suppose it is also used for other purposes↵(@sOkam! 🫐) |
18:22:44 | FromDiscord | <sOkam! 🫐> In reply to @fosster "so I suppose it": any purpose you would use `bash` for, or similar |
18:23:28 | FromDiscord | <sOkam! 🫐> but its very limited, there is very little effort put into good and useful tools for it, so it lacks a ton of features and needs to rely on `exec "someNativeCommand"`, which makes it really non-portable |
18:24:19 | FromDiscord | <sOkam! 🫐> for simple stuff is amazing, though. anything to get rid of bash syntax |
18:24:38 | FromDiscord | <sOkam! 🫐> bash or powershell. they are both equally guilty |
18:24:51 | FromDiscord | <nnsee> some background on how .nimble files work in the context of nimscript is detailed here https://peterme.net/how-to-embed-nimscript-into-a-nim-program-embedding-nimscript-pt-2.html |
18:25:00 | FromDiscord | <fosster> so basically there is this language called nimscript that runs on top of some sort of vm, and nimble uses it internally with .nimble files |
18:25:11 | FromDiscord | <sOkam! 🫐> In reply to @fosster "so basically there is": pretty much |
18:25:30 | FromDiscord | <nnsee> "internally" is a bit of a strech but yeah |
18:25:38 | FromDiscord | <sOkam! 🫐> it uses the nimvm, which is the same that the compiler uses at compiletime for `static` code |
18:25:47 | FromDiscord | <nnsee> stretch, even |
18:25:57 | FromDiscord | <nnsee> god i hate the ios keyboard |
18:26:03 | FromDiscord | <nnsee> keep making typos |
18:26:45 | FromDiscord | <fosster> mh so I suppose this lang was around before nimble |
18:26:54 | FromDiscord | <leorize> it didn't come before nimble |
18:27:05 | FromDiscord | <sOkam! 🫐> @odexine did anything come out of the nimpretty exploration you did a while back? 🤔 |
18:27:15 | FromDiscord | <leorize> nimscript come sometimes after and then nimble was modified to use it |
18:27:19 | FromDiscord | <leorize> (it's not a good fit, really) |
18:27:29 | FromDiscord | <graveflo> I wondered that too. The overall look of things suggested that it didn't. I guess that's suspicion confirmed |
18:27:38 | FromDiscord | <odexine> the formatter? not really, its likely better to look into extending nph |
18:27:52 | FromDiscord | <sOkam! 🫐> kk ty |
18:28:11 | FromDiscord | <fosster> mh interesting |
18:28:15 | FromDiscord | <odexine> i'm still going to look into formatting but i dont know, rn my opinion is to look into nph |
18:28:57 | FromDiscord | <fosster> so does astlas also use nimscript or something else? |
18:29:10 | FromDiscord | <leorize> atlas doesn't use nimscript |
18:29:44 | FromDiscord | <nnsee> doesn't atlas just call out nimble for some subcommands |
18:29:45 | FromDiscord | <graveflo> imo nimscript, atlas and nimble all need to grow up. Nimscript isn't going anywhere I don't think and I would want atlas to set the heading moving forward not nimble. I like the way atlas does things |
18:30:35 | FromDiscord | <graveflo> and by not going anywhere I mean that it's not going to be conceptually replaced anytime soon, I think |
18:31:13 | FromDiscord | <leorize> I'd be more interested in nimble moving away from nimscript |
18:32:08 | FromDiscord | <graveflo> so the environment constraints should just be structural or are you suggesting a more declarative style configuration? |
18:32:26 | FromDiscord | <leorize> yea, something declarative |
18:33:10 | FromDiscord | <leorize> it's dumb to require running the compiler just to get some metadata |
18:33:25 | FromDiscord | <leorize> fwiw nimble actually supports an ini form |
18:33:39 | FromDiscord | <graveflo> I feel like that would just have people using the declarative syntax to bootstrap something like nimscript. In the simple cases not so much, but you can easily get declarative-like syntax with Nim. I'm not sure what the point of dropping the capability would be |
18:33:48 | FromDiscord | <leorize> which is the original nimble file form and is what the nimble script produces |
18:34:09 | FromDiscord | <leorize> it's not about the syntax |
18:34:28 | FromDiscord | <leorize> it's about what tools have to do to consume nimble files |
18:34:45 | FromDiscord | <graveflo> actually that does make sense. I guess if you really wanted to avoid that there could be something like an .ini. Almost like how python has it's two styles of setup files |
18:35:12 | FromDiscord | <graveflo> I get it. I'll never worry about something my CPU will blast through in a couple microseconds, but that does make sense |
18:35:17 | FromDiscord | <sOkam! 🫐> declarative syntax makes buildsystems and their related files a ton more complicated than they need to be |
18:35:54 | FromDiscord | <graveflo> I'm exaggerating a bit 😛 |
18:36:37 | FromDiscord | <graveflo> In reply to @heysokam "declarative syntax makes buildsystems": That's exactly how I feel. I think it would be a mistake to limit the build system to that kind of config, but as long as it's just a simple case there is an argument for it |
18:36:48 | FromDiscord | <sOkam! 🫐> I dealt with declarative a lot with scons+cmake+make for an extremely complicated buildsystem that output 70+ different target files↵Moved to imperative, and the complexity went down dramatically |
18:37:01 | FromDiscord | <leorize> you know that cmake is nothing declarative, right? |
18:37:13 | FromDiscord | <graveflo> cmake is disgustingly awful |
18:37:37 | FromDiscord | <sOkam! 🫐> make is not better, and then scons tries to solve that by making the thing declarative... and it does not solve the problem |
18:37:48 | FromDiscord | <odexine> tbf something like what, nix, is still kinda complicated, but ig thats just because nix has some... questionable syntax choice |
18:37:57 | FromDiscord | <sOkam! 🫐> if anything it makes it more difficult to reason about what the hell will happen and when |
18:38:13 | FromDiscord | <sOkam! 🫐> In reply to @odexine "tbf something like what,": whats nix? |
18:38:25 | FromDiscord | <odexine> id say both imperative and declarative systems have difficulties in reasoning |
18:38:38 | FromDiscord | <odexine> in different ways |
18:38:48 | FromDiscord | <leorize> build systems are just hard in general |
18:38:52 | FromDiscord | <graveflo> I absolutely love it when CMake generates another CMake file that runs a python script that generates C code and then calls make. It's a beautiful thing |
18:39:03 | FromDiscord | <sOkam! 🫐> In reply to @graveflo "I absolutely love it": ⚰️ |
18:39:24 | FromDiscord | <odexine> In reply to @heysokam "whats nix?": https://nixos.org/ this 😛 |
18:39:51 | FromDiscord | <sOkam! 🫐> reading that sentence makes me so happy that I wrote confy and I don't have to deal with any of that garbo ever again in my life |
18:40:13 | FromDiscord | <sOkam! 🫐> make+cmake literally gave me ptsd lol |
18:40:42 | FromDiscord | <odexine> i dont think thats because of it being declarative |
18:40:47 | FromDiscord | <odexine> i think thats just cmake |
18:40:56 | FromDiscord | <graveflo> yes |
18:40:57 | FromDiscord | <sOkam! 🫐> In reply to @odexine "https://nixos.org/ this 😛": oh the OS? i know it, but since we are talking about buildsystems I didn't get how its realted |
18:41:01 | FromDiscord | <sOkam! 🫐> (edit) "realted" => "related" |
18:41:02 | FromDiscord | <leorize> make is also not that great of a language |
18:41:03 | FromDiscord | <odexine> In reply to @heysokam "oh the OS? i": not really |
18:41:09 | FromDiscord | <leorize> nix is a build system |
18:41:11 | FromDiscord | <odexine> its not just an os |
18:41:14 | FromDiscord | <leorize> nixos is an os built with that build system |
18:41:29 | FromDiscord | <sOkam! 🫐> huh? you just broke my brain |
18:41:32 | FromDiscord | <leorize> nixos is just an application, the real money is in nix |
18:41:35 | FromDiscord | <sOkam! 🫐> i guess i have some study to do |
18:41:48 | FromDiscord | <odexine> ok so theres a name problem with nix |
18:42:14 | FromDiscord | <odexine> nix can refer to the build system, the language, or a third thing i forgot whats mention |
18:42:18 | FromDiscord | <odexine> ed mentioned |
18:42:26 | FromDiscord | <leorize> build system, language or OS |
18:42:29 | FromDiscord | <odexine> so it can get confusing to refer to |
18:42:30 | FromDiscord | <leorize> there's like a diagram for it |
18:43:10 | FromDiscord | <sOkam! 🫐> i didn't know about this. ty for sharing. looks interesting |
18:43:42 | FromDiscord | <odexine> kinda fell out of it because of the language honestly |
18:43:53 | FromDiscord | <odexine> not really into guix either |
18:44:00 | FromDiscord | <odexine> (another similar syste) |
18:44:01 | FromDiscord | <odexine> (edit) "syste)" => "system)" |
18:44:11 | FromDiscord | <sOkam! 🫐> In reply to @leorize "make is also not": > ~~make~~ bash is also not a great language↵fixed that for you. every make problem comes from bash, and they just make the problem even worse |
18:44:24 | FromDiscord | <odexine> when the shellcheck |
18:44:24 | FromDiscord | <leorize> nix is like haskell but with rust syntax \:p |
18:44:29 | FromDiscord | <leorize> eh, `.PHONY` is nothing good either |
18:44:48 | FromDiscord | <odexine> In reply to @leorize "nix is like haskell": not reallyyyyyyyyyyyy i wouldnt say so |
18:44:50 | FromDiscord | <leorize> and don't get me started on deps files |
18:45:09 | FromDiscord | <odexine> its more like some weird haskell lisp amalgamation or smth |
18:45:12 | FromDiscord | <sOkam! 🫐> thankfully `zig cc` removes the need to ever deal with deps files forever |
18:45:31 | FromDiscord | <leorize> these days I use meson + ninja if I could |
18:46:27 | FromDiscord | <sOkam! 🫐> i looked into them, but they looked like the same issues are creeping in there too |
18:46:36 | FromDiscord | <sOkam! 🫐> better managed, but same issues |
18:47:21 | FromDiscord | <leorize> meson doesn't do extensions, at all |
18:47:27 | FromDiscord | <graveflo> I just don't understand where it all went wrong. All these languages and bloated tools. Can't we just use general purpose programming languages for general purpose and not do all this overly complicated shit |
18:47:41 | FromDiscord | <sOkam! 🫐> scons does a good job at simplifying all of that, but the rigidity of their system and the crappy python stdlib drove me away from them. but they got good ideas |
18:47:44 | FromDiscord | <leorize> so it avoided becoming a (bad) scripting language |
18:48:06 | FromDiscord | <sOkam! 🫐> In reply to @graveflo "I just don't understand": pretty much |
18:48:12 | FromDiscord | <odexine> In reply to @graveflo "I just don't understand": id say its a "general purpose languages may work but arent ideal" kinda things |
18:48:14 | FromDiscord | <odexine> (edit) "things" => "thing" |
18:48:25 | FromDiscord | <leorize> ninja is really good at building things, and that's what it's for |
18:48:54 | FromDiscord | <graveflo> and to make it ideal you get a bloated framework instead of just taking 10% more typing time.. not thinking time.. typing to get this "ideal" |
18:49:06 | FromDiscord | <graveflo> just use the general language.. it's easier |
18:49:08 | FromDiscord | <sOkam! 🫐> to be fair, I almost fell into the exact same trap myself recently. so i can relate to the problem somewhat↵I was trying to support multiple compilers... and confy was getting bloated by the minute↵remove them all, except for zigcc, and it all went down to normal again |
18:50:04 | FromDiscord | <sOkam! 🫐> I figure trying to solve so many compilers and tools in an abstract way is what makes them bloated and over-engineered |
18:50:08 | FromDiscord | <odexine> the problem with that is thats how you lose users |
18:50:12 | FromDiscord | <leorize> different tools for different problems, really |
18:50:20 | FromDiscord | <sOkam! 🫐> as they try to support every potential workflow in existence... and -that- is the issue imo |
18:50:21 | FromDiscord | <graveflo> I say ditch the losers |
18:50:31 | FromDiscord | <odexine> no comment, up to you |
18:50:48 | FromDiscord | <sOkam! 🫐> In reply to @graveflo "I say ditch the": that's just bad UX |
18:51:22 | FromDiscord | <sOkam! 🫐> "my users can use my tool, bad for them" is the worst ux mentality possible for making something usable |
18:51:29 | FromDiscord | <sOkam! 🫐> (edit) ""my users can use my tool, ... bad" added "too" |
18:51:51 | FromDiscord | <sOkam! 🫐> (edit) "can" => "cant" |
18:52:01 | FromDiscord | <sOkam! 🫐> fixed typos, sry |
18:52:06 | FromDiscord | <graveflo> well if the user is a programmer and the tool is a programming language I would have to discard that principal |
18:52:17 | FromDiscord | <leorize> it's not different |
18:52:39 | FromDiscord | <sOkam! 🫐> In reply to @graveflo "well if the user": buildsystems surface hits more than programmers |
18:52:39 | FromDiscord | <leorize> they might have more knowledge but they're still users |
18:53:28 | FromDiscord | <graveflo> well I'm not trying to say that you all are wrong, but always targeting the bottom line of competence is a disaster imo |
18:53:39 | FromDiscord | <leorize> users are not this generic group, you shape them according to your actual users |
18:53:53 | FromDiscord | <graveflo> plus it's not that hard to imagine that if you are using the language to write the code you can use it to do something else |
18:54:05 | FromDiscord | <odexine> i think its just that build systems go too specific and general prog languages are too general, that we havent exactly found the sweet spot between perhaps |
18:54:16 | FromDiscord | <graveflo> In reply to @leorize "users are not this": come on. be brave |
18:54:28 | FromDiscord | <sOkam! 🫐> In reply to @graveflo "well I'm not trying": its not about a bottom line of competence, its about making something usable↵usability has nothing to do with competence, and everything to do with ergonomics and intuitiveness |
18:54:50 | FromDiscord | <leorize> I know who my users are, that's why my vision for build system and package management is the way it is ;) |
18:54:56 | FromDiscord | <graveflo> so make the general purpose language usable and ergonomic. To birds one stone. |
18:55:08 | FromDiscord | <sOkam! 🫐> that's what nim is |
18:55:24 | FromDiscord | <graveflo> I know that's why I'm here |
18:55:27 | FromDiscord | <graveflo> 😛 |
18:55:50 | FromDiscord | <sOkam! 🫐> except then every nim buildsystem insists on using nimscript... and the usability goes out of the window because of nimscript lack of capabilities |
18:56:08 | FromDiscord | <graveflo> agreed. Nimscript needs attention |
18:56:18 | FromDiscord | <leorize> nimscript is not a configuration language |
18:56:20 | FromDiscord | <leorize> and it sure isn't a scripting language |
18:56:44 | FromDiscord | <graveflo> I think scripting language doesn't really have a good def... but I can see what you mean |
18:57:00 | FromDiscord | <leorize> it has not evolved at all since it's conception (which is to be a configuration language), which tells you how much everyone actually care about it \:p |
18:57:25 | FromDiscord | <leorize> actually, it wasn't even meant for configuration, it just happened to fit in as Araq played with making running only the VM a thing |
18:58:16 | FromDiscord | <graveflo> I think there is just a lot to do. It's not lack of caring. The fact that nimble is propped up by it is reason enough to assume that it is not forgotten. I imagine it would be better to address nimscript after other things are looked at |
18:58:50 | FromDiscord | <leorize> nimble using nimscript is not anything new |
18:58:56 | FromDiscord | <sOkam! 🫐> tooling in general is lacking. nimscript just happens to be one more in the list |
18:59:05 | FromDiscord | <leorize> it happens around the time nimscript was added |
18:59:07 | FromDiscord | <graveflo> that is not discounting the fact that additions could be made to the nimscript module that would be beneficial before then too |
18:59:11 | FromDiscord | <leorize> as a form of dogfooding |
19:01:18 | FromDiscord | <leorize> and btw if you want a build system, `nake` exists and is actually capable of doing things that only a real program could do |
19:01:42 | FromDiscord | <leorize> not that I endorse it, it basically got phased out once nimble gained nimscript |
19:01:58 | FromDiscord | <Robyn [She/Her]> I'm debating on if I should try building my chat app using cps rather than async hm... |
19:02:05 | FromDiscord | <graveflo> nake looks ugly |
19:02:11 | FromDiscord | <Robyn [She/Her]> `Confy` is a buildscript library if wanted |
19:02:39 | FromDiscord | <leorize> Robyn\: just build it \:p |
19:02:51 | FromDiscord | <Robyn [She/Her]> You import it and then use the tools it provides to do what you need, also means you aren't limited by Nimscript |
19:02:56 | FromDiscord | <leorize> but if you want cps help, you'd have to go to cps room because cps devs are not in here |
19:03:23 | FromDiscord | <Robyn [She/Her]> In reply to @leorize "Robyn\: just build it": That's what I did multiple times, then I kept restarting because I went in mostly blind- |
19:03:29 | FromDiscord | <Robyn [She/Her]> In reply to @leorize "but if you want": Makes sense |
19:04:06 | FromDiscord | <leorize> unless you didn't learn a thing everytime you restart, I'd say that it's a normal thing to do |
19:05:59 | FromDiscord | <Robyn [She/Her]> Fair enough |
19:08:27 | FromDiscord | <leorize> the nice thing about nim syntax is that it won't get in your way, so you can write and throw things away with ease |
19:08:30 | FromDiscord | <leorize> putting my cps dev hat on, I'd say write it with cps and keep us updated at https://matrix.to/#/#cps:matrix.org |
19:10:04 | FromDiscord | <Chronos& [She/Her]> Exactly why I thought I'd consider cps \:) |
19:10:09 | FromDiscord | <sOkam! 🫐> In reply to @leorize "and btw if you": nake is mandatory their rules, or get lost. its the same problem |
19:10:27 | FromDiscord | <leorize> that's just what build systems do \:p |
19:10:32 | FromDiscord | <sOkam! 🫐> no |
19:10:42 | FromDiscord | <sOkam! 🫐> buildsystems should be -libraries- not -binaries- |
19:10:47 | FromDiscord | <leorize> personally zig build caught my eye and I'm looking to implement a nim version of it |
19:11:01 | FromDiscord | <leorize> it's just semantics, really |
19:11:12 | FromDiscord | <sOkam! 🫐> is more than that |
19:11:21 | FromDiscord | <graveflo> It's not to me. I agree is sOkam on this one |
19:11:33 | FromDiscord | <graveflo> or at least I prefer that mentality |
19:11:49 | FromDiscord | <leorize> my vision splits this into two\: the graph and the runner |
19:12:00 | FromDiscord | <leorize> have those two pieces and it can be a library or a binary, however you want |
19:12:09 | FromDiscord | <sOkam! 🫐> In reply to @leorize "personally zig build caught": it has some really neat ideas. their language is really overcomplicated for buildsystems, so I didn't got with it. but their ideas are super good |
19:13:24 | FromDiscord | <leorize> I like my metadata declarative, but build code should be something like zig build |
19:14:22 | FromDiscord | <graveflo> that's fair. Once the metadata needs computation to be viable things start to get really messed up anyways |
19:14:50 | FromDiscord | <graveflo> or at least you can treat that computation on the other side of the boundary I would hope |
19:15:09 | FromDiscord | <leorize> fwiw nake is a library |
19:15:16 | FromDiscord | <leorize> the nake executable is nothing but a fancy wrapper for `nim c` |
19:15:27 | FromDiscord | <Robyn [She/Her]> > After Nim's update to 0.19.0, the check for NULL values was removed due to the removal of nil.↵Huh... |
19:17:27 | FromDiscord | <leorize> what a weird sentence \:p |
19:18:16 | FromDiscord | <Robyn [She/Her]> Nim removed `nil` at one point? |
19:18:46 | FromDiscord | <leorize> never |
19:18:54 | FromDiscord | <leorize> where did you find that one? |
19:18:57 | FromDiscord | <Robyn [She/Her]> Then that makes no sense at all |
19:19:06 | FromDiscord | <Robyn [She/Her]> https://nimble.directory/pkg/sqlbuilder |
19:19:35 | FromDiscord | <leorize> ah, they meant the `seq` and `string` change |
19:19:42 | FromDiscord | <leorize> those used to be nil-able |
19:19:46 | FromDiscord | <Robyn [She/Her]> Aah |
19:20:39 | FromDiscord | <leorize> I'm still sad that ormin is dead |
19:22:14 | FromDiscord | <Robyn [She/Her]> Fair, I did see that |
19:26:04 | FromDiscord | <m4ul3r> In reply to @demotomohiro "It is the feature": I am the same way, i've never not started an array at 0 ↵↵I don't program in matlab 😂 |
19:26:19 | FromDiscord | <m4ul3r> But it's cool that there's flexibility for that |
19:45:25 | * | deadmarshal_ quit (Ping timeout: 264 seconds) |
19:48:59 | FromDiscord | <morgan> so im wrapping the clap api headers, and i have ptr openarray of cstring in a struct i'm declaring. how do i declare all the cstrings to pass into it? i've tried stuff with casting and keep getting errors |
19:53:12 | FromDiscord | <demotomohiro> In reply to @morganalyssa "so im wrapping the": https://nim-lang.org/docs/system.html#allocCStringArray%2CopenArray%5Bstring%5D↵I don't know if this proc works for your case. |
19:53:21 | FromDiscord | <morgan> thanks ill take a look |
19:54:59 | FromDiscord | <morgan> ok i think that should work |
19:55:34 | FromDiscord | <morgan> cstringarray becomes `char`, and the header uses `const char const ` |
20:13:07 | * | deadmarshal_ joined #nim |
20:22:16 | * | tc424 quit (Ping timeout: 246 seconds) |
20:30:08 | FromDiscord | <Robyn [She/Her]> Struggling on figuring out how to better structure my code, since there's an async variation (and a cps variation when I implement it) |
20:30:18 | FromDiscord | <Robyn [She/Her]> Painful, honestly |
20:30:28 | FromDiscord | <Robyn [She/Her]> Wait actually, not an issue I think |
20:30:46 | FromDiscord | <Robyn [She/Her]> Probably not an issue, at least |
20:31:00 | FromDiscord | <Robyn [She/Her]> Async functions must return futures, and cps functions return `Continuations` so |
20:41:31 | FromDiscord | <Robyn [She/Her]> Is `testRequires` a thing for Nimble? |
20:43:04 | FromDiscord | <Robyn [She/Her]> Also, would it be a good idea to use concepts for representing a future and continuation? |
20:44:39 | * | ntat quit (Quit: Leaving) |
20:52:44 | * | tc424 joined #nim |
21:00:25 | * | tc424 quit (Ping timeout: 264 seconds) |
21:09:48 | * | tc424 joined #nim |
21:15:16 | FromDiscord | <morgan> In reply to @morganalyssa "ok i think that": seems to work, i can set it and echo it back out, tho hopefully that means other stuff will work with it fine |
21:21:17 | FromDiscord | <aintea> Are there already implemented data structures in nim ? For example if I want to use a Stack ? |
21:23:50 | Zevv | for a stack a seq is sufficient |
21:24:26 | FromDiscord | <leorize> Robyn\: cps functions return the return type |
21:24:39 | FromDiscord | <leorize> we don't have async's future return requirement |
21:24:51 | FromDiscord | <aintea> But I need to pop and push frequently, isn't a seq comparable to a vector in c++ or a list in python? |
21:25:37 | FromDiscord | <Robyn [She/Her]> In reply to @leorize "Robyn\: cps functions return": Ah |
21:25:52 | FromDiscord | <Robyn [She/Her]> Might be an issue for me then |
21:26:24 | FromDiscord | <leorize> cps is nowhere close to asyncdispatch |
21:26:28 | FromDiscord | <Robyn [She/Her]> Eh, might just duplicate the code then |
21:26:33 | FromDiscord | <leorize> you won't be able to shim in a way that it works with both \:p |
21:26:46 | FromDiscord | <nnsee> isn't it just conceptually different |
21:26:58 | FromDiscord | <leorize> you can invent an asyncdispatch shim for cps, though |
21:27:15 | Zevv | aintea: well what do you expect from a stack, alloc wise. i do it like this to avoid resizing the underlying storage too often, but this will not free popped element memory: https://github.com/zevv/npeg/blob/master/src/npeg/stack.nim |
21:27:34 | FromDiscord | <Robyn [She/Her]> In reply to @leorize "you won't be able": Yeah I know, I was gonna make multiple concepts for async, cps and sync |
21:28:05 | FromDiscord | <leorize> you can try to separate i/o from your protocol state machine |
21:28:10 | FromDiscord | <leorize> then it doesn't matter what do IO |
21:28:30 | FromDiscord | <leorize> basically something in the spirit of https://sans-io.readthedocs.io/ |
21:30:35 | FromDiscord | <Robyn [She/Her]> I was trying to do that, but I wanted to implement the functions on a type so it'd be cleaner, but I guess I could avoid that |
21:30:47 | FromDiscord | <Robyn [She/Her]> To be fair, my library is already very suited for that |
21:31:43 | FromDiscord | <Robyn [She/Her]> Since I use a `Buffer` type for everything (excluding the initial packet data, which I why I wanted to implement the bare minimum for that) |
21:31:54 | Zevv | thats a nice fit for the cps stream stuff we're working on. protocols just read and write from and to the lower and higher level streams and dont do io themselves |
21:32:26 | FromDiscord | <Robyn [She/Her]> cps stream? |
21:32:59 | FromDiscord | <leorize> if your type emits Future anywhere, it's not I/O independent \:p |
21:33:55 | FromDiscord | <leorize> if you want a `sans-io` thing, it must not touch any I/O related structures \:p |
21:34:02 | Zevv | yeah some toy experiments im working on. abstrct stream type that implements your baisc read and write, that composes very nicely. the poc has some stuff like http chunked, tls, websocket. you stack em like legos |
21:35:42 | Zevv | thats the idea, anyway |
22:01:06 | * | krux02 joined #nim |
22:06:32 | FromDiscord | <Robyn [She/Her]> Reading through the sans-io site rn, but struggling to see how I'd do that in a way compatible with the VarInt type since it's not doable without being able to read from the socket |
22:16:01 | FromDiscord | <Elegantbeef> Well my brief reading seems to imply it just reads the data into a buffer and you operate from that |
22:16:19 | FromDiscord | <Elegantbeef> https://sans-io.readthedocs.io/how-to-sans-io.html#how-to-write-i-o-free-protocol-implementations |
22:16:44 | FromDiscord | <Robyn [She/Her]> You can't read the data into a buffer if you don't know how much of it you need, though? |
22:16:50 | FromDiscord | <Elegantbeef> You peek |
22:17:10 | FromDiscord | <Elegantbeef> You peek the amount of data you most need |
22:17:24 | FromDiscord | <Robyn [She/Her]> Wdym? |
22:17:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=OQDmeXQXIjtg |
22:17:44 | FromDiscord | <Elegantbeef> Here is an implementation I recently wrote for leb128 var ints |
22:18:02 | FromDiscord | <Elegantbeef> Under the condition of `Peek` I peek 10 bytes off the buffer |
22:18:29 | FromDiscord | <Elegantbeef> But otherwise I just read the bytes sequentially as it's a buffer that knows it's position |
22:18:49 | FromDiscord | <Robyn [She/Her]> I already have an implementation, but how am I supposed to get the data from the socket without knowing how much data I'm reading from the socket |
22:18:54 | FromDiscord | <Elegantbeef> I could be wrong but sans-io seems not too disimilar to having a string stream inbetween your IO and your user code |
22:19:05 | FromDiscord | <Robyn [She/Her]> Unless you're suggesting to make a custom stream for socket ops |
22:19:49 | FromDiscord | <Elegantbeef> sent a long message, see https://pasty.ee/QmGnKogCppRy |
22:21:26 | FromDiscord | <Robyn [She/Her]> `receive_bytes` seems like it'd work weirdly, unless in Nim I'd make that using a callback or something that the user would supply? |
22:23:40 | FromDiscord | <Elegantbeef> > The major abstraction used by most of the sans-IO protocol stacks is to translate the bytes received from the network into “events”. Essentially, this abstraction defines a network protocol as a serialization mechanism for a sequence of semantic “events” that can occur on that protocol. |
22:24:13 | FromDiscord | <Elegantbeef> So in Nim that'd actually be better represented as a `array[EventEnum, proc(bytes: seq[int]): int]` |
22:24:54 | FromDiscord | <Elegantbeef> Where you grab the event ID then call the corresponding proc |
22:25:31 | FromDiscord | <Robyn [She/Her]> Huh? |
22:25:48 | FromDiscord | <Robyn [She/Her]> That makes no sense to me |
22:26:10 | FromDiscord | <Elegantbeef> Ok let's imagine a small chat client |
22:26:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=sysicKjjiVvs |
22:28:56 | FromDiscord | <Robyn [She/Her]> Okay |
22:33:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=AgaZmiSEOdNI |
22:33:17 | FromDiscord | <Elegantbeef> There we go we just made a sans-io chat client to the best of my understanding of it |
22:34:10 | FromDiscord | <Robyn [She/Her]> `.extract` is a thing?? |
22:34:15 | FromDiscord | <Elegantbeef> No |
22:34:18 | FromDiscord | <leorize> look at their http 1.1 library to see how data could flow |
22:34:25 | FromDiscord | <Elegantbeef> Draw the rest of the owl |
22:34:43 | FromDiscord | <Elegantbeef> I'd be better to use a stringstream instead of `openArray[byte]` probably |
22:34:44 | FromDiscord | <leorize> the idea with sans io is inversion of control |
22:34:48 | FromDiscord | <Elegantbeef> It'd\ |
22:35:05 | FromDiscord | <leorize> you don't control data going in, the user does |
22:36:02 | FromDiscord | <Elegantbeef> Is my example sufficiently sans-io'd? 😄 |
22:38:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=YSEuGaDJqPJs |
22:39:55 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=LaUzOmCBHMqV |
22:40:21 | FromDiscord | <sOkam! 🫐> never done vtables before in Nim, so its probably something silly/simple |
22:40:39 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Also robyn it's quite": Ah sweet, will keep for future reference :P |
22:41:33 | FromDiscord | <Elegantbeef> Or import constchar and use that instead of `cstring` |
22:41:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=LorvInZUukoY |
22:41:40 | FromDiscord | <Elegantbeef> What is it again `type ConstChar {.importc: "const char".} = char`? |
22:42:10 | FromDiscord | <sOkam! 🫐> the proc is what confused me |
22:42:27 | FromDiscord | <sOkam! 🫐> the cstring can be just string and converted oinly when passing it to C |
22:42:37 | FromDiscord | <sOkam! 🫐> ty |
22:44:04 | FromDiscord | <sOkam! 🫐> is the `cdecl` needed for nim procs? |
22:44:27 | FromDiscord | <Elegantbeef> It's needed for C interop if you want to ensure compatibillity |
22:44:30 | FromDiscord | <sOkam! 🫐> I figure its only required for passing the proc to C for interop, or when mapping C procs, and its not needed for native proc? |
22:44:41 | FromDiscord | <Elegantbeef> I'd use `{.nimcall.}` otherwise |
22:44:44 | FromDiscord | <Elegantbeef> Unless you want a closure |
22:44:51 | FromDiscord | <sOkam! 🫐> is nimcall default? |
22:45:09 | FromDiscord | <Elegantbeef> For top level procedures but not for type definitions |
22:45:18 | FromDiscord | <sOkam! 🫐> kk ty |
22:46:32 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=HhAESIIKYFVz |
22:47:14 | FromDiscord | <Elegantbeef> Sure |
22:57:13 | FromDiscord | <TӨMΛ ☠> In reply to @heysokam "you can use streams": `treeform/binny` is repo? Couldn't find it unfortunately :< |
22:57:29 | FromDiscord | <Elegantbeef> It's in flatty iirc |
22:59:10 | FromDiscord | <TӨMΛ ☠> Oh, I see. Still does feel pretty hard to parse for my brain, but should be helpful, thank you ✨ |
23:00:25 | * | advesperacit quit () |
23:00:40 | FromDiscord | <Elegantbeef> Eh you generally will want something more like `std/streams`' stringstream |
23:02:37 | FromDiscord | <sOkam! 🫐> In reply to @toma400 "`treeform/binny` is repo? Couldn't": its part of flatty, yep |
23:02:58 | FromDiscord | <sOkam! 🫐> what are you trying to do exactly, toma? |
23:03:07 | FromDiscord | <TӨMΛ ☠> In reply to @Elegantbeef "Eh you generally will": Yeah, this I have already, it's just me trying to consider how to make parser procedure and segment all bytes into respective portions↵I'm like, learning whole new topic from praxis and failing |
23:03:41 | FromDiscord | <TӨMΛ ☠> In reply to @heysokam "what are you trying": I wanted to make parser for binary files used for Morrowind modding, but in the same time I realised I need to learn about binary files in general 😄 |
23:04:10 | FromDiscord | <Elegantbeef> Heh coincidentally I just designed my own silly binary format |
23:04:12 | FromDiscord | <TӨMΛ ☠> Can't find good resources that would tell me anything more but basics though |
23:04:19 | FromDiscord | <TӨMΛ ☠> (edit) "Can't find good resources that would tell me anything more but ... basics" added "extreme" |
23:05:19 | FromDiscord | <sOkam! 🫐> In reply to @toma400 "Can't find good resources": that's because binary files are wildly different depending on the file |
23:05:25 | FromDiscord | <sOkam! 🫐> you need to find the spec of that file format |
23:05:57 | FromDiscord | <sOkam! 🫐> @TӨMΛ ☠ example: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#glb-file-format-specification-structure |
23:06:17 | FromDiscord | <sOkam! 🫐> without a spec, you are pretty much blind on what the 00010010 represent |
23:06:26 | FromDiscord | <sOkam! 🫐> which is essentially reverse engineering |
23:06:29 | * | om3ga quit (Ping timeout: 240 seconds) |
23:06:33 | FromDiscord | <sOkam! 🫐> (edit) "which is essentially ... reverse" added "the definition of" |
23:07:09 | FromDiscord | <Elegantbeef> Mod communities generally are nice and will write down their breakdown of binary formats |
23:07:34 | FromDiscord | <sOkam! 🫐> so, in short, find the spec of the file and then read it with binny or any other method whatever. the important part is knowing the structure of the file, otherwise there is no way to interpret it |
23:09:05 | FromDiscord | <TӨMΛ ☠> sent a long message, see https://pasty.ee/MWaceZNFecEu |
23:09:21 | FromDiscord | <TӨMΛ ☠> In reply to @heysokam "without a spec, you": As for spec, yeah, I think (?) I found it, it's very neatly written on UESP page |
23:10:03 | FromDiscord | <TӨMΛ ☠> (edit) "very" => "[very" | "page" => "page](<https://en.uesp.net/wiki/Morrowind_Mod:Mod_File_Format>)" |
23:11:54 | FromDiscord | <TӨMΛ ☠> In reply to @heysokam "<@656540400546480128> example: https://registry.khr": This looks very promising, thank you for the link ❤️ |
23:12:34 | FromDiscord | <sOkam! 🫐> In reply to @toma400 "This looks very promising,": you have a reference on how I implemented that `glb` format in `ngltf` if you need it |
23:12:43 | FromDiscord | <sOkam! 🫐> but the essence is what that gltf represents |
23:13:19 | FromDiscord | <sOkam! 🫐> they give you a header structure, with sizes and types contained in those bytes, and then you write a converter to turn the bytebufffer (aka string) into proper nim types |
23:13:24 | FromDiscord | <Elegantbeef> I do have that aforementioned binary format as well if you want something that is spec less 😄 |
23:15:18 | FromDiscord | <sOkam! 🫐> In reply to @toma400 "Yeah, I understood that": as for `'this is how you parse`.... you don't parse binaries at all. parsing is a very different concept↵what you do is you cast a certain number of `char` bytes into their respective `uint32` or whatever other type, based on the size that the spec tells you they represent |
23:15:41 | FromDiscord | <sOkam! 🫐> (edit) "cast" => "`cast[T]` or `memcpy`" |
23:15:51 | FromDiscord | <Elegantbeef> I mean that's wrongish |
23:16:00 | FromDiscord | <Elegantbeef> Converting a binary format to something usable is parsing |
23:16:15 | FromDiscord | <sOkam! 🫐> want me to go again into the "complicate it as much as you want, but it wont make it easier for him to first grasp simply"? |
23:16:22 | FromDiscord | <sOkam! 🫐> im using simple language, beef |
23:18:04 | FromDiscord | <sOkam! 🫐> In reply to @Elegantbeef "Converting a binary format": technically yes. but parsing, in simple terms, is going character by character and doing something different based on what that character contains. but that's not how you handle binary files in practice, even if the technical result is the same, as you would memcpy instead of interpreting char by char (each char isolated is nothing, as you know) |
23:18:23 | FromDiscord | <sOkam! 🫐> (edit) "In reply to @Elegantbeef "Converting a binary format": technically yes. but parsing, in simple terms, is going character by character and doing something different based on what that character contains. but that's not how you handle binary files in practice, even if the technical result is the same, as you would memcpy ... instead" added "a chunk of chars" |
23:18:47 | FromDiscord | <Elegantbeef> Depends on the binary format many are pretty much state machines that you then extract data from |
23:23:35 | FromDiscord | <TӨMΛ ☠> I think I understand the subtle difference, may be the cause of me trying to first save all the file, convert its entire string to bytes and then going few bytes each to distribute it along struct I would fill data in... which begs the question, I do not necessarily need to cast during stream, I just need to know how many bytes I need to use and to what type I want to cast them into? |
23:24:05 | FromDiscord | <TӨMΛ ☠> sent a code paste, see https://play.nim-lang.org/#pasty=JmTBcMfaHYPo |
23:24:11 | FromDiscord | <Elegantbeef> It wholly depends on the binary format |
23:24:11 | FromDiscord | <Elegantbeef> There are many different ways to encode an integer in binary |
23:24:25 | FromDiscord | <Elegantbeef> A Nim string is a `seq[byte]` |
23:24:33 | FromDiscord | <Elegantbeef> In Nim `char` is a distinct `uint8` |
23:25:58 | FromDiscord | <TӨMΛ ☠> Oh, so I should treat each `char` of that string as `byte`? (sorry if I understood it wrongly) |
23:26:08 | FromDiscord | <TӨMΛ ☠> (edit) "Oh, so ... I" added "should" | removed "should" |
23:26:45 | FromDiscord | <Elegantbeef> They're the same thing |
23:26:47 | FromDiscord | <Elegantbeef> Both are 8bit data types |
23:27:02 | FromDiscord | <Elegantbeef> They're only different to the type system |
23:27:28 | FromDiscord | <sOkam! 🫐> In reply to @toma400 "I think I understand": a string is made of bytes |
23:27:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=WcwFnJAVKJxU |
23:27:37 | FromDiscord | <sOkam! 🫐> (edit) "bytes" => "bytes↵you don't need to convert anything" |
23:27:44 | FromDiscord | <Elegantbeef> Whoops |
23:27:55 | FromDiscord | <Elegantbeef> `[1u8, 2, 3, 4]`\ |
23:29:12 | FromDiscord | <sOkam! 🫐> In reply to @toma400 "If the above is": `string is seq[byte] and string is seq[char] and string is seq[uint8]` |
23:29:35 | FromDiscord | <sOkam! 🫐> (edit) "In reply to @toma400 "If the above is": `string is seq[byte] and string is seq[char] and string is seq[uint8]`" => "sent a code paste, see https://play.nim-lang.org/#pasty=cvLBCNSOwJIi" |
23:29:51 | FromDiscord | <Elegantbeef> Uhhh |
23:29:51 | FromDiscord | <sOkam! 🫐> (edit) "https://play.nim-lang.org/#pasty=xIRvaeyYzEcq" => "https://play.nim-lang.org/#pasty=uKxexIYiTrMs" |
23:30:07 | FromDiscord | <sOkam! 🫐> well it probably wont because of types |
23:30:18 | FromDiscord | <sOkam! 🫐> but hopefully you get the idea |
23:30:49 | FromDiscord | <sOkam! 🫐> (edit) "https://play.nim-lang.org/#pasty=jmcQbIUukLDb" => "https://play.nim-lang.org/#pasty=EMcfzISQZKEB" |
23:34:50 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=ebBXRLExVXRd |
23:35:10 | FromDiscord | <morgan> sent a long message, see https://pasty.ee/DacsRNBYYvwC |
23:35:41 | FromDiscord | <morgan> (edit) "https://pasty.ee/PpaGctsSrmWI" => "https://pasty.ee/byoLRqkOpdmd" |
23:35:57 | FromDiscord | <sOkam! 🫐> In reply to @morganalyssa "i decided to not": yeah wrappers are always work-in-progress, sadly. but imagine the work if you did all of that manually ⚰️ |
23:36:19 | FromDiscord | <morgan> yeah im really glad futhark exists |
23:37:43 | FromDiscord | <morgan> the thing that made me decide to not bother with cplug, is it uses objc for au and mac standalone, and i'm pretty sure that's not necessary, but im not smart enough on that to figure out how to work around it. so im gonna rely on the official clap wrappers to handle au and vst3. i don't have a need for standalone builds other than it would be nice to have for testing |
23:38:30 | FromDiscord | <sOkam! 🫐> In reply to @morganalyssa "the thing that made": if the mac code deals with mac system functions directly, then it probably is necessary |
23:38:37 | FromDiscord | <morgan> eventually it would be cool to figure out direct api stuff for auv2/3 and vst3 and write a library over clap and those and maybe even standalone, but that |
23:38:44 | FromDiscord | <morgan> (edit) "that" => "that's for future me lol" |
23:38:50 | FromDiscord | <sOkam! 🫐> I had to do some objc crap too when wrapping wgpu because it had to get some objc-exclusive data from metal |
23:39:10 | FromDiscord | <TӨMΛ ☠> I'm beyond thankful to you guys, @sOkam! 🫐 and @ElegantBeef, I actually "parsed" first four bytes (/chars) into working data 🥳 |
23:39:21 | FromDiscord | <TӨMΛ ☠> Thanks once again for help, you are amazing ❤️ |
23:39:49 | FromDiscord | <sOkam! 🫐> big recommend treeform/binny. itsreally invaluable for that stuff |
23:40:12 | FromDiscord | <sOkam! 🫐> eventually you can probably get the couple of functions that you actually use, but in the meantime its really useful to have |
23:40:17 | FromDiscord | <morgan> In reply to @heysokam "if the mac code": i didn't go looking but sokol could make a standalone window just fine, and it really seems like the daw should handle opening the window and just give the plugin the handle, and thus the daw would have that direct objc interaction, but again im not smart enough on that stuff so i decided it was easier to just avoid that |
23:40:29 | FromDiscord | <morgan> (edit) "In reply to @heysokam "if the mac code": i didn't go looking but sokol ... could" added "(just c headers)" |
23:41:25 | FromDiscord | <Elegantbeef> Toma you should get comfortable with bitwise operations and thinking at that level it'll help quite a bit |
23:41:40 | FromDiscord | <sOkam! 🫐> In reply to @morganalyssa "i didn't go looking": reference: https://github.com/heysokam/nglfw/blob/776101ea2979444b57ea0c8320d23d67f23cf73a/src/nglfw/metal_glue.m#L13-L20 |
23:41:48 | FromDiscord | <morgan> In reply to @morganalyssa "eventually it would be": the only like abstraction layer thing i do have planned is something to handle a tree of callbacks and info to decide which branch, to process mouse and keyboard interactions into doing stuff |
23:41:51 | FromDiscord | <sOkam! 🫐> I had to do objc for opening a window |
23:41:56 | FromDiscord | <sOkam! 🫐> (edit) "I had to do objc for opening a ... window" added "native" |
23:41:56 | FromDiscord | <Elegantbeef> I challenge you to extract the sign of any signed integer only using bitwise ops |
23:43:04 | FromDiscord | <TӨMΛ ☠> In reply to @Elegantbeef "Toma you should get": If you'd have any helpful resources, I'd love to read them! I will happily learn more about that, I always wanted to eventually learn all those basics and dive deeper ^^ |
23:43:35 | FromDiscord | <TӨMΛ ☠> In reply to @heysokam "big recommend treeform/binny. itsreally": Yeah, I used exactly its `readStr`! It's indeed great, as everything from our dear treeform ❤️ |
23:44:54 | FromDiscord | <morgan> In reply to @heysokam "reference: https://github.com/heysokam/nglfw/blob/7": i looked into it a little and it seems like there's something with objc_msgsend that miiiiiight be possible to do from plain c but i didnt get very far on that |
23:45:25 | FromDiscord | <Elegantbeef> Pretty much any documentation about bitwise will suffice |
23:45:42 | FromDiscord | <Elegantbeef> I've mostly learned everything through pressure to my face to screen |
23:45:57 | FromDiscord | <Elegantbeef> So I don't have many good resources on anything |
23:47:34 | FromDiscord | <sOkam! 🫐> In reply to @toma400 "If you'd have any": sent a really handy link on dm |
23:52:34 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=kslDgzUOscvM As I cleaned it up and documented it here's that aforementioned binary format you can also use as a reference 😄 |
23:53:22 | FromDiscord | <TӨMΛ ☠> Thank you! Will give it a look tomorrow as well ^^ |
23:53:54 | FromDiscord | <Elegantbeef> It's a bit much so might not be the easiest toconsume |
23:54:04 | FromDiscord | <Elegantbeef> But you can always run it then use `hexdump -C` on the files it makes 😄 |
23:54:31 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1213635583860019220/image.png?ex=65f63137&is=65e3bc37&hm=4dd3d5e1c24dd4fd492820723fed305e82cb6d124cfbb938c69c214fe35a1965& |
23:54:33 | FromDiscord | <Elegantbeef> How hard could it be to understand! 😄 |