00:00:10 | * | albe quit (Quit: The Lounge - https://thelounge.chat) |
00:03:26 | * | albe joined #nim |
00:20:04 | * | SchweinDeBurg joined #nim |
00:20:38 | FromDiscord | <eightbit_dboy> Posted my text editor to the forum: https://forum.nim-lang.org/t/12546 |
00:35:34 | FromDiscord | <kiloneie> im pretty sure you can use backticks for variable names, but not values |
00:36:52 | FromDiscord | <kiloneie> The hell, i saw messages from hours ago that i responded to(any bridge received it)... weird update thing. |
01:45:52 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
02:16:20 | * | rockcavera quit (Remote host closed the connection) |
02:33:12 | FromDiscord | <majortrips1763> I think one of the more interesting things about Nim is the regularity with which I forget I am working in a compiled language; ignoring that most of my work can run as NimScript as well. |
04:04:51 | * | albe quit (Quit: The Lounge - https://thelounge.chat) |
04:07:02 | * | SchweinDeBurg joined #nim |
04:16:55 | FromDiscord | <odexine> In reply to @majortrips1763 "Thank you, I wasn't": why not? you can have leading underscores in importc/exportc |
04:18:28 | FromDiscord | <Elegantbeef> As I understood it, they need to have the name that the C compiler emits, which means they have to use codegendecl to get the name 'right' |
04:19:16 | FromDiscord | <Elegantbeef> Though if you know that the compiler always appends `_` it's not rocket science |
04:22:33 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=THkKwclo |
04:22:53 | FromDiscord | <xkonti> (edit) "https://play.nim-lang.org/#pasty=HhmgTcub" => "https://play.nim-lang.org/#pasty=tjEmFsij" |
04:23:54 | FromDiscord | <Elegantbeef> I do see a lot of casts that I'm dubious of |
04:26:09 | FromDiscord | <Elegantbeef> Well it's not the cause but I did see `readBytes` |
04:26:19 | FromDiscord | <Elegantbeef> First off `toSeq` in there is redundant |
04:26:29 | FromDiscord | <Elegantbeef> Second off, make a `readStr` 😄 |
04:27:00 | FromDiscord | <Elegantbeef> Without using cast |
04:30:35 | FromDiscord | <Elegantbeef> If not already I'd suggest using `-d:usuMalloc` and run it through valgrind |
04:30:49 | FromDiscord | <Elegantbeef> It's `-d:useMalloc --debugger:native`\ |
04:41:12 | * | alexdaguy joined #nim |
05:33:02 | FromDiscord | <xkonti> In reply to @Elegantbeef "*Without using cast*": How would I make a readStr without casting? There's casting everywhere as I'm not sure what else to use :/ |
05:37:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=tupjfsTk |
05:57:41 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=GgCOFWAU |
06:01:37 | FromDiscord | <swrge> `toOpenArray` doesn't allocate |
06:07:25 | FromDiscord | <Elegantbeef> `a[..] =` assigns a slice |
06:07:29 | FromDiscord | <Elegantbeef> It takes an `openArray` |
06:11:50 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=FqITWcVZ |
06:12:39 | FromDiscord | <xkonti> I understand that the `result[0..numberOfbytes.int]` as the left side of the `[]=` isn't a string anymore... |
06:13:07 | FromDiscord | <xkonti> (edit) "I" => "~I" | "anymore..." => "anymore...~" |
06:13:54 | FromDiscord | <Elegantbeef> Oh wait that doesn't exist https://nim-lang.org/docs/system.html#%5B%5D%3D%2Cstring%2CHSlice%5BT%3A%20Ordinal%2CU%3A%20Ordinal%5D%2Cstring 😄 |
06:13:58 | FromDiscord | <Elegantbeef> I guess I take it all back |
06:15:00 | FromDiscord | <Elegantbeef> `import std/strbasics` and do `newSeqOfCap(numberOfBytes)` then `result.add reader.data.toOpenArray(...)` 😄 |
06:31:11 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=afnoRHKV |
06:32:08 | FromDiscord | <Elegantbeef> Whoops `newString` |
06:33:48 | FromDiscord | <Elegantbeef> I also forgot it was `seq[uint8]` so I guess.... yea |
06:34:02 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=psvBheph |
06:34:07 | FromDiscord | <Elegantbeef> Gotta cast somewhere but `seq[uint8]` -\> `seq[char]` is better |
06:34:27 | FromDiscord | <xkonti> instead of seq[uint8] -> string? |
06:34:42 | FromDiscord | <Elegantbeef> `cast[seq[char]](reader.data).toOpenArray...` |
06:34:52 | FromDiscord | <Elegantbeef> That'll 'work' and removes one possible source of issues |
06:36:51 | FromDiscord | <xkonti> Compiles! I'm gonna try to plug that into decoding strings. |
06:59:39 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=dzFnbpRN |
06:59:55 | FromDiscord | <Elegantbeef> `newStringOfCap` 😄 |
07:00:13 | FromDiscord | <Elegantbeef> `toOpenArray` does not allocate a new seq |
07:00:17 | FromDiscord | <Elegantbeef> It's like `Span` |
07:01:50 | FromDiscord | <Elegantbeef> I assume it fixed it cause of it having `\0` |
07:02:16 | FromDiscord | <xkonti> Huh. So the `someSeq[a..b]` does allocate?↵↵As for `newStringOfCap` I understand avoids the unnecessary resizing? |
07:02:53 | FromDiscord | <Elegantbeef> Yes |
07:04:37 | FromDiscord | <xkonti> I don't know what the issue previously was. Lengths of strings were all fine, concatenating with `&` worked well, there were no `\0` anywhere in the byte data, only `echo` was causing trouble. |
07:04:50 | FromDiscord | <Elegantbeef> That's' my point |
07:05:27 | FromDiscord | <Elegantbeef> Strings have \\0 |
07:05:34 | FromDiscord | <Elegantbeef> seqs do not |
07:05:40 | FromDiscord | <Elegantbeef> So that cast did not provide everything it needed |
07:06:45 | FromDiscord | <Elegantbeef> It otherwise would look right |
07:08:12 | FromDiscord | <arnetheduck> In reply to @xkonti "Huh. So the `someSeq[a..b]`": this is reason alone to deprecated `[]` in the std lib |
07:08:15 | FromDiscord | <arnetheduck> (edit) "deprecated" => "deprecate" |
07:08:43 | FromDiscord | <arnetheduck> (edit) "lib" => "lib, it's nuts" |
07:09:12 | FromDiscord | <Elegantbeef> I say it's reason for view types 😄 |
07:12:13 | FromDiscord | <arnetheduck> everyone keeps talking about them as if they were on the cusp of becoming real, for the past 3 years or so |
07:12:26 | FromDiscord | <Elegantbeef> I don't pretend they're close |
07:13:11 | FromDiscord | <xkonti> In reply to @Elegantbeef "Strings have \\0": Oh. I thought `string` type doesn't have the `\0`, but the `cstring` has. Or is it that they both have, just `string` hides it? |
07:13:32 | FromDiscord | <Elegantbeef> It exists for `string` for C interop |
07:15:36 | * | pbsds3 quit (Quit: The Lounge - https://thelounge.chat) |
07:16:24 | FromDiscord | <Elegantbeef> I assume it used `.cstring` to print out interall |
07:26:18 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=KzIUqqrT |
07:28:21 | FromDiscord | <Elegantbeef> An empty string is free to allocate |
07:28:21 | FromDiscord | <Elegantbeef> There is no heap part |
07:29:32 | FromDiscord | <xkonti> Still an operation to perform though... |
07:29:57 | FromDiscord | <Elegantbeef> It's writing 0 twice |
07:30:56 | * | pbsds3 joined #nim |
07:31:22 | FromDiscord | <Elegantbeef> If writing two words is your issue, what are we doing |
07:35:23 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=qXLTbjse |
07:37:58 | FromDiscord | <xkonti> An in theory those 2 zeros less times several million times when decoding results of larger DB queries. Might be a few nanoseconds difference after all 😄 |
07:38:24 | FromDiscord | <Elegantbeef> If the C compiler does not reason that it's unneeded and does it anyway |
07:39:34 | FromDiscord | <xkonti> In reply to @Elegantbeef "If the C compiler": Can nim use the zig compiler instead of the default MingW on Windows? |
07:40:01 | FromDiscord | <Elegantbeef> Sure |
07:40:29 | FromDiscord | <Elegantbeef> https://github.com/enthus1ast/zigcc makes it the easiest |
07:41:43 | FromDiscord | <xkonti> Wow! Is there any benefit other than cross compilation? Things like performance, safety, etc? |
07:41:52 | FromDiscord | <Elegantbeef> It's clang |
07:42:22 | FromDiscord | <Elegantbeef> The code is likely more optimised in my experience over GCC |
07:42:36 | FromDiscord | <Elegantbeef> I find clang also generally makes smaller binaries |
07:42:50 | FromDiscord | <Elegantbeef> So clang is generally just a better default than GCC in my experience |
07:43:27 | FromDiscord | <xkonti> I'll add it to my "Things to tinker with" list 🙂 |
07:44:03 | FromDiscord | <eightbit_dboy> Anyone know `futhark` well enough to help me with this? https://media.discordapp.net/attachments/371759389889003532/1293479076211855421/image.png?ex=670785c3&is=67063443&hm=4aa674d46826d70dde96dabb74ea7c5d3ce2e384de39dbb7ac5ca2e220f51724& https://media.discordapp.net/attachments/371759389889003532/1293479076505321472/image.png?ex=670785c3&is=67063443&hm=41bdd36f71cb85c8d59cc22ddf6f8147185ab4be6a557f49c1aa8c17929ff626& |
07:45:12 | FromDiscord | <Elegantbeef> Why are you passing a random path to `compilerArgs`? |
07:45:42 | FromDiscord | <Elegantbeef> If you want to provide a system path, it's `sysPath` |
07:45:42 | FromDiscord | <eightbit_dboy> In reply to @Elegantbeef "Why are you passing": That was temporary, it was originally `getClangIncludePath()` |
07:46:13 | FromDiscord | <Elegantbeef> using clang for your system path for a nintendo 64 compiler is likely to explode |
07:46:15 | FromDiscord | <eightbit_dboy> But that was the path to my clang include directory |
07:46:27 | FromDiscord | <Elegantbeef> Right but why are you passing it as a compiler arg? |
07:46:36 | FromDiscord | <eightbit_dboy> I'm not trying to compile with clang, I'm trying to generate a wrapper. |
07:46:41 | FromDiscord | <Elegantbeef> A path provided to a C compiler attempts to compile it |
07:46:58 | FromDiscord | <Elegantbeef> Right but the thing is that you want to use your compilers system include to ensure definitions match |
07:47:16 | FromDiscord | <Robyn [She/Her]> In reply to @xkonti "Wow! Is there any": crosscompilation with zigcc is easy |
07:47:29 | FromDiscord | <eightbit_dboy> So `compilerArg` should be passed the libdragon include path? |
07:47:31 | FromDiscord | <Elegantbeef> Even if you just want to generate headers it's not wise to rely on the Clang sys path |
07:47:42 | FromDiscord | <Elegantbeef> No `compilerArgs` should not be used since you want `sysPath` |
07:47:50 | FromDiscord | <eightbit_dboy> Okay |
07:47:55 | FromDiscord | <Elegantbeef> `sysPath` is the path to your system include |
07:48:23 | FromDiscord | <Elegantbeef> Hehe robyn you responded to "what does Zigcc do other than CC" with "It does CC" |
07:49:05 | FromDiscord | <eightbit_dboy> In reply to @Elegantbeef "`sysPath` is the path": Well, I just commented out the `compilerArg` line and it compiled... for some reason. ↵↵But it did spit out a `naylib64.nim`, so that's good. |
07:49:15 | FromDiscord | <Elegantbeef> You might even be able to omit the `compilerArg` and `sysPath` cause it searches for it |
07:49:44 | FromDiscord | <Elegantbeef> From the docs↵> sysPath denotes system paths, these will be passed to Øpir to make sure Clang knows where to find all the definitions. This can also be passed with -d\:sysPath\:\<path 1\>\:\<path 2\> if you want to automatically generate these. By default Futhark tries to find the sysPath automatically and you don't need to specify this yourself. |
07:50:11 | FromDiscord | <eightbit_dboy> Well, this is what I have: https://media.discordapp.net/attachments/371759389889003532/1293480618696642590/image.png?ex=67078733&is=670635b3&hm=31e24c1db37f4cba02e49bb0933b0b9fe38d5035a21b4f320911d23f0d33f77b& |
07:50:20 | FromDiscord | <Elegantbeef> What's the point of writing docs if no one will read them 😄 |
07:50:20 | FromDiscord | <eightbit_dboy> https://media.discordapp.net/attachments/371759389889003532/1293480658148130816/naylib64.nim?ex=6707873c&is=670635bc&hm=777887cb4773b76478c997d2158894b957c06b090780048cc19c3bbc5d7daa2c& |
07:50:50 | FromDiscord | <eightbit_dboy> Docs are for programmers who help programmers who don't read docs, lol |
07:51:53 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Hehe robyn you responded": oh |
07:52:04 | FromDiscord | <Robyn [She/Her]> i blame the rain droplets on my glasses |
07:54:01 | FromDiscord | <eightbit_dboy> Looks like futhark is creating some mangled names. Gonna have to figure that out. https://media.discordapp.net/attachments/371759389889003532/1293481579888508989/image.png?ex=67078818&is=67063698&hm=9cde8ae46d9da8093ac08c4f2119eb99527fc887749c65132792e5d7a9a8ec8d& |
07:57:42 | FromDiscord | <eightbit_dboy> Not sure what these postfix numbers are about. |
07:59:25 | FromDiscord | <eightbit_dboy> Are those like private variables not meant to be exposed to other units? |
08:09:32 | Amun-Ra | I think futhark does that to prevent name clashes |
08:10:21 | Amun-Ra | like "enum FooBar" and "FOO_BAR" from C to nim, something I had to fight making my own sdl wrapper |
08:26:27 | FromDiscord | <eightbit_dboy> In reply to @Amun-Ra "like "enum FooBar" and": How'd you fix it? Because I have a fuckload of these mangled names in here. |
08:34:19 | Amun-Ra | eightbit_dboy: I encountered the problem twice, I just added Enum at the end of the type name ;) |
08:35:18 | Amun-Ra | and EventType instead of Event (as in: https://github.com/amnr/nsdl3/blob/master/src/nsdl3/sdl3inc/sdl3events.nim#L24 ) |
08:36:55 | FromDiscord | <eightbit_dboy> In reply to @Amun-Ra "and EventType instead of": Okay, but how do you make futhark do that? |
08:37:09 | Amun-Ra | ah, I get it now, I don't use one |
08:37:12 | FromDiscord | <eightbit_dboy> Trying to find your file that uses futhark |
08:37:14 | FromDiscord | <eightbit_dboy> ... |
08:37:48 | FromDiscord | <eightbit_dboy> So what are you using to generate bindings? |
08:38:02 | Amun-Ra | I do it by hand |
08:38:36 | FromDiscord | <eightbit_dboy> You generate all your bindings by hand? |
08:38:51 | Amun-Ra | yes |
08:39:24 | Amun-Ra | and I write with the intention of not exposing low level types to the user |
08:39:55 | FromDiscord | <eightbit_dboy> Hold on, you already knew I was using futhark for this, yet you gave me an example that didn't use it... |
08:40:25 | Amun-Ra | I was just addressing the question why furthark makes these names |
08:40:35 | Amun-Ra | I wasn't addressing anything else |
08:40:57 | Amun-Ra | sorry for the confusion |
08:41:46 | FromDiscord | <eightbit_dboy> But you knew that was the problem I was experiencing |
08:41:52 | Amun-Ra | no |
08:42:13 | Amun-Ra | I only answered the question regarding enum names |
08:43:32 | * | beholders_eye joined #nim |
08:43:36 | FromDiscord | <eightbit_dboy> I give up. |
08:43:52 | Amun-Ra | never give up |
08:44:02 | FromDiscord | <eightbit_dboy> Dude |
08:44:19 | FromDiscord | <eightbit_dboy> https://media.discordapp.net/attachments/371759389889003532/1293494238557765674/image.png?ex=670793e2&is=67064262&hm=44c991ad93d2cdbfea399bd78221795f414988d502483ed86194c845999d69fe& |
08:44:52 | FromDiscord | <eightbit_dboy> Like, how did you not understand what I thought you were implying, here? |
08:45:09 | Amun-Ra | simply - I'm not you |
08:45:19 | FromDiscord | <eightbit_dboy> Holy fucking shit, dude. |
08:45:44 | Amun-Ra | I haven't added "futhark", and I should have added additional info that I'm not talking about futhark in the following sentence |
08:45:56 | FromDiscord | <eightbit_dboy> Yeah, you should have. |
08:46:04 | FromDiscord | <eightbit_dboy> No shit. |
08:46:34 | Amun-Ra | I said I'm sorry for the confusion, no need to be such an ass |
08:49:08 | FromDiscord | <nnsee> ayo guys let's not fight |
08:49:29 | FromDiscord | <nnsee> i think the right person to ping for issues with futhark's internals is @pmunch |
08:51:39 | PMunch | @eightbit_dboy, if you look further in the output of Futhark then you will see that it also creates aliases to those mangled names |
08:51:50 | PMunch | So you don't use the mangled names anywhere in your code |
08:52:02 | FromDiscord | <nnsee> (also, as a side note, if you want people to help you, coming off as overly combative is not the way) |
08:53:09 | PMunch | Also, please behave @eightbit_dboy, Amun-Ra was just trying to help, he even said sorry for confusing you |
08:53:21 | FromDiscord | <eightbit_dboy> In reply to @PMunch "<@327881349924913152>, if you look": Yeah, I'm trying to figure out how to make it not do that without having to enumerate every one :\ |
08:53:41 | PMunch | Why do you want it to not do that? |
08:53:58 | PMunch | I mean there's a very simple way to get it to stop, but I want to know that you actually have a good reason for it |
08:54:09 | PMunch | Because the name mangling is there for a reason |
08:54:33 | PMunch | And as I said Futhark creates aliases to the mangled names so you never use the mangled names in your code anyways |
08:55:08 | FromDiscord | <eightbit_dboy> Well, just for some types that are meant to be exposed to the programmer(s). I'm assuming the mangled names are just for private variables. |
08:55:30 | FromDiscord | <eightbit_dboy> As I speculated here: https://discord.com/channels/371759389889003530/371759389889003532/1293482940843560981 |
08:56:03 | PMunch | No, it basically creates `type mangledName_2312323 = <actual type definition>; type mangledName = mangledName_2412323` |
08:56:16 | FromDiscord | <eightbit_dboy> Gotcha |
08:56:17 | PMunch | So in your code you just use `mangledName` without all the numbers |
08:56:38 | FromDiscord | <eightbit_dboy> It's late here, so brain not brain good. |
08:57:05 | FromDiscord | <eightbit_dboy> Thank you! |
08:57:14 | PMunch | You can use `-d:nodeclguards` as explained in the README to disable this feature, but again, it's there for a reason :) |
08:58:19 | Amun-Ra | PMunch: how do you resolve name collisions? |
09:01:10 | FromDiscord | <eightbit_dboy> That said, it'd be nice to be able to drop the `struct_` from the front of `struct_Vector3`, which is meant to be used by the programmers. |
09:02:03 | FromDiscord | <eightbit_dboy> Or wait, is that what's going on, here? https://media.discordapp.net/attachments/371759389889003532/1293498701813125231/image.png?ex=6707980a&is=6706468a&hm=29a7481ee238d4e4152fae8bbf43ed56e5b7eaabfe02cee2c70397c18946d82e& |
09:03:27 | FromDiscord | <eightbit_dboy> No, wait. It's this, isn't it? https://media.discordapp.net/attachments/371759389889003532/1293499053379682386/image.png?ex=6707985e&is=670646de&hm=225d6a8fb5b310dd0149b22b5624dcaece1b5fb0e6e4242ba4fbd567849b2892& |
09:05:42 | Amun-Ra | yes |
09:05:55 | FromDiscord | <eightbit_dboy> Thanks! |
09:38:01 | FromDiscord | <pmunch> In reply to @Amun-Ra "<@392962235737047041>: how do you": https://github.com/PMunch/futhark?tab=readme-ov-file#hard-names-and-overrides |
09:40:09 | FromDiscord | <eightbit_dboy> Well, it looks like I won't need to override anything, so it works out. |
09:54:10 | Amun-Ra | pmunch: thanks |
10:01:19 | * | ovelny joined #nim |
10:22:15 | * | beholders_eye quit (Ping timeout: 276 seconds) |
10:23:53 | * | beholders_eye joined #nim |
10:38:43 | PMunch | By the way, I'm holding a Futhark talk for NimConf, anything in particular I should include? |
10:39:00 | PMunch | Obviously not deep technical stuff |
10:39:16 | * | beholders_eye quit (Ping timeout: 265 seconds) |
10:48:53 | * | ovelny quit (Quit: leaving) |
12:28:05 | * | ntat joined #nim |
12:36:31 | * | beholders_eye joined #nim |
12:50:45 | * | alexdaguy quit (Quit: WeeChat 4.4.2) |
12:52:24 | FromDiscord | <eightbit_dboy> In reply to @PMunch "By the way, I'm": I think you writing a script to generate a wrapper in real time would be a cool way to show it off. |
12:52:39 | FromDiscord | <eightbit_dboy> Because it really can be that fast. |
12:53:27 | FromDiscord | <eightbit_dboy> Also, is there a way to have it generate a wrapper without spitting out a binary? |
13:15:24 | PMunch | Ooh, that's a good idea |
13:15:35 | PMunch | Unfortunately no way to not spit out a binary |
13:15:47 | PMunch | It was meant to be part of your build |
13:32:29 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "Though if you know": Yah, not all compilers actually behave the same way. Historically I used autoconf scripts which built a simple object and then inspected it and then set the #define to decide which macro to use. |
13:33:11 | FromDiscord | <einjonas> has Nimlang Labels like Rust |
13:33:17 | FromDiscord | <einjonas> to break loops |
13:33:34 | PMunch | `block somename: break somename`? |
13:33:50 | FromDiscord | <zumi.dxy> yea: https://nim-lang.org/docs/manual.html#statements-and-expressions-block-statement |
13:35:58 | * | beholders_eye quit (Ping timeout: 252 seconds) |
13:55:48 | FromDiscord | <majortrips1763> In reply to @PMunch "`block somename: break somename`?": `break <arg>` and `discard <arg>` remind me of shell's `break N` and `: <arg>` |
13:56:49 | FromDiscord | <majortrips1763> Just missing `continue <arg>` |
13:57:48 | PMunch | Yeah for continue you need an some infinite loops and blocks |
13:57:55 | PMunch | We discussed this the other day actually |
13:58:36 | FromDiscord | <majortrips1763> Yah, just shell let's you `continue <N>` to jump to the top of an outer loop. |
14:00:48 | FromDiscord | <majortrips1763> I suspect that trying to do something similar using break+continue would end up with similar patterns as Python's for:else: |
14:04:20 | * | Batzy joined #nim |
14:05:56 | * | deadmarshal_ left #nim (Leaving) |
14:07:06 | * | Batzy_ quit (Ping timeout: 246 seconds) |
14:09:00 | * | beholders_eye joined #nim |
14:09:02 | FromDiscord | <determiedmech1> what's the recursion limit supposed to be for release and danger? |
14:09:04 | PMunch | Well this would be like Pythons for/else https://play.nim-lang.org/#pasty=pCUckLFS |
14:09:15 | FromDiscord | <odexine> In reply to @determiedmech1 "what's the recursion limit": 2 million iirc but its configurable |
14:09:20 | FromDiscord | <determiedmech1> ah |
14:09:35 | FromDiscord | <odexine> youll be told how to configure it when you hit the limit |
14:09:45 | FromDiscord | <odexine> (aka i forgot and cant be assed to check how xd) |
14:11:02 | PMunch | --maxLoopIterations or something like that |
14:11:13 | FromDiscord | <majortrips1763> In reply to @PMunch "Well this would be": Yah, but how to do something similar to `continue <label>` ? |
14:11:18 | FromDiscord | <determiedmech1> sent a code paste, see https://play.nim-lang.org/#pasty=OpzldaRD |
14:11:33 | FromDiscord | <determiedmech1> (edit) "https://play.nim-lang.org/#pasty=yvlTJkSX" => "https://play.nim-lang.org/#pasty=QMpMVAix" |
14:12:13 | PMunch | That's possibly just stack frame sizes or something like that |
14:12:17 | FromDiscord | <majortrips1763> In reply to @determiedmech1 "yeah I was wondering": Wouldn't it depend on your available stack size? I would expect that w/ debugging the stack should fill up quite a bit more quickly. |
14:12:27 | PMunch | Exactly |
14:12:35 | FromDiscord | <determiedmech1> oh fair |
14:12:57 | FromDiscord | <majortrips1763> W/out some sort of tail recursion that knows that it can reuse the current stack. |
14:13:30 | FromDiscord | <odexine> im surprised nim doesnt have tail call optimisation |
14:13:35 | FromDiscord | <determiedmech1> I could just leave it running without the printing stuff and see what happens |
14:13:36 | FromDiscord | <majortrips1763> (edit) "stack." => "stack pointer." |
14:13:48 | PMunch | @majortrips1763, you could do it like this: https://play.nim-lang.org/#pasty=teJqyvfs |
14:13:58 | FromDiscord | <odexine> i dont think its the echo call thats inflating the stack frame size no? |
14:14:10 | PMunch | @odexine, I think C can add it in some cases |
14:14:46 | PMunch | But yeah, native tail-end recursion would be neat |
14:14:46 | * | PMunch quit (Quit: Leaving) |
14:15:30 | FromDiscord | <majortrips1763> In reply to @PMunch "<@661414156846628885>, you could do": Yah, but if there is code "after" the `block: outer` then the code is going to have to run some other stuff that isn't necessarily desired. Some sort of book-keeping variable ends up being needed to decide if a `continue` to the top of `block outer:` |
14:15:42 | FromDiscord | <determiedmech1> does `break label` break from "label" or to "label" |
14:16:18 | FromDiscord | <majortrips1763> In reply to @determiedmech1 "does `break label` break": from, we are tryin to imagine code for `continue` to an outer label |
14:16:23 | FromDiscord | <determiedmech1> ok |
14:17:04 | FromDiscord | <majortrips1763> C of course has `goto`, and POSIX sh has `continue <N>` |
14:18:13 | FromDiscord | <majortrips1763> There are some situations in which it is really nice to have (up there with optimizing tail recursion). |
14:20:04 | FromDiscord | <majortrips1763> Honestly, when I saw that Nim had `break <label>` I completely expected it to include `continue <label>`. |
14:20:57 | FromDiscord | <majortrips1763> @pmunch I think the easiest solution is to nest multile `block <label>:` |
14:22:05 | FromDiscord | <majortrips1763> (edit) "multile" => "multiple" | "<label>:`" => "<label>:`'s and selectively break to each one and let those blocks choose to continue or break.. just seems sub optimal to have multiple `jmp`'s in the final code like that. I wonder if the compiler will optimize it out" |
14:47:49 | FromDiscord | <majortrips1763> @pmunch https://play.nim-lang.org/#pasty=giJnFqlS maybe? |
14:50:39 | FromDiscord | <threefour> In reply to @odexine "im surprised nim doesnt": Is that on the roadmap at all? |
14:51:03 | FromDiscord | <odexine> no clue |
15:00:17 | FromDiscord | <majortrips1763> Ahh no ... here we go .. this one catches all 3 branch conditions ... 😣 ↵https://play.nim-lang.org/#pasty=FIdAcjYD |
15:01:48 | FromDiscord | <pmunch> Now for bonus points create a template out of it to ease the readability |
15:03:49 | FromDiscord | <majortrips1763> The pain is it wont be able the readability, but the final code emitted to the C compiler. A `goto <label>` (`continue <label>`) is just like .. 1 instruction.. |
15:05:02 | FromDiscord | <majortrips1763> adding a stack of if/elif/else and jmps, even if it is hidden away for readability .. is still a huge stack of garbage |
15:18:28 | FromDiscord | <spotlightkid> `continue <label>` makes no sense to me semantically. If I jump out if the loop, I am breaking the loop, not continuing anything. |
15:18:35 | FromDiscord | <spotlightkid> `continue <label>` makes no sense to me semantically. If I jump out of the loop, I am breaking the loop, not continuing anything. |
15:25:43 | FromDiscord | <odexine> continue label apparently jumps within the loop, to the top |
15:27:38 | FromDiscord | <spotlightkid> What's the difference to normal continue then? |
15:29:25 | FromDiscord | <odexine> jump to arbitrary loop, if nested |
15:37:03 | FromDiscord | <spotlightkid> yeah, my point is, then it's a break, isn't it? |
15:39:10 | * | beholders_eye quit (Ping timeout: 252 seconds) |
15:42:34 | FromDiscord | <determiedmech1> hey chat quick question |
15:42:51 | FromDiscord | <determiedmech1> if pointers are the same size as inte |
15:42:56 | FromDiscord | <determiedmech1> (edit) "inte" => "ints" |
15:43:30 | FromDiscord | <determiedmech1> and the int type is an int32 |
15:43:46 | FromDiscord | <odexine> int type is not int32 |
15:43:56 | FromDiscord | <odexine> or do you mean in this case? |
15:44:32 | FromDiscord | <determiedmech1> Going off this https://media.discordapp.net/attachments/371759389889003532/1293599991520301217/image0.jpg?ex=6707f65f&is=6706a4df&hm=122fc6e7aa1a347695d4a4c994ef98cb4069aad16f6f7013993a0a4506ca1f5f& |
15:44:37 | FromDiscord | <odexine> why are there fifteen billion people typing |
15:44:38 | FromDiscord | <michaelb.eth> In reply to @spotlightkid "yeah, my point is,": that’s true even if `continue` is used without a label:↵> A continue statement is syntactic sugar for a nested block↵↵https://nim-lang.org/docs/manual.html#statements-and-expressions-continue-statement |
15:44:43 | FromDiscord | <determiedmech1> does that mean pointers are 32 bits |
15:44:50 | FromDiscord | <Robyn [She/Her]> if int has the size of 4 (aka int32), that means:↵1. The platform is 32 bit↵2. A pointer is 4 bytes |
15:45:03 | FromDiscord | <odexine> In reply to @chronos.vitaqua "if int has the": basically yeah |
15:45:08 | FromDiscord | <Robyn [She/Her]> In reply to @determiedmech1 "does that mean pointers": Do `sizeof pointer == sizeof int` |
15:45:17 | FromDiscord | <odexine> or nim and the c compiler is in 32 bit |
15:45:51 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "or nim and the": or that, but functionally no difference if you're intending to run code on a 32 bit system |
15:46:25 | FromDiscord | <determiedmech1> Because currently I am talking to someone who is crashing out over 32bit pointers |
15:46:35 | FromDiscord | <Robyn [She/Her]> In reply to @determiedmech1 "Because currently I am": ...huh? why? |
15:46:47 | FromDiscord | <odexine> In reply to @determiedmech1 "Because currently I am": ? |
15:47:25 | FromDiscord | <Robyn [She/Her]> do they not realise 32 bit CPUs exist?- |
15:47:39 | FromDiscord | <odexine> ? https://media.discordapp.net/attachments/371759389889003532/1293600773565054996/image.png?ex=6707f71a&is=6706a59a&hm=f788bde8b2ab4316d351a54e77c463d1c2997082ae8e8186933a8b98c848aebe& |
15:48:48 | FromDiscord | <determiedmech1> https://media.discordapp.net/attachments/371759389889003532/1293601064880312341/image0.jpg?ex=6707f75f&is=6706a5df&hm=5cbf63a298f15e5fc593c866f2f57e182107857fafa0d99de64d8f326ebcaeab& |
15:49:12 | FromDiscord | <determiedmech1> chat is this real |
15:49:22 | FromDiscord | <odexine> I Think Your Friend Is Misunderstanding Something |
15:49:39 | FromDiscord | <determiedmech1> their other complaint is the case/underscore insensitivity |
15:49:57 | FromDiscord | <michaelb.eth> In reply to @determiedmech1 "their other complaint is": nice, that’s a good filter |
15:49:58 | FromDiscord | <odexine> i mean up to them for that thing |
15:50:02 | FromDiscord | <odexine> lol |
15:50:16 | FromDiscord | <odexine> go filtered me with its caps for public shenanigans |
15:51:53 | FromDiscord | <determiedmech1> Ok wait so now I need an explanation about why 32bit pointers aren't an issue |
15:52:29 | FromDiscord | <michaelb.eth> they’re 32 on a 32-bit system, 64 on a… |
15:57:13 | FromDiscord | <majortrips1763> In reply to @spotlightkid "`continue <label>` makes no": `continue <label>` let's you jump to the top of an outer loop cleanly and in a single instruction. W/out it you either need:↵1. complicated `block`+`break` nesting↵2. outside variables at the tail of a loop to do a second check and continue to the top. |
15:58:50 | FromDiscord | <majortrips1763> Actually .. #2 would still need #1 .. it would just be an alternate way to orchestrate the break conditions .. instead of complicated nesting you get into a bunch of flow-control variables. |
16:02:27 | FromDiscord | <majortrips1763> Realistically, the argument for `break <label>` is symantically the exact same argument for `continue <label>` .. The end result is a jump to the bottom or the top of some block. I am not really certain I can see how one can say one is useful and the other isn't. |
16:04:15 | FromDiscord | <spotlightkid> You misunderstood me, I think. All I'm saying is that is doesn't make sense to me, to call it "continue", when it isn't continuing the current loop but breaking out of it (i.e. ending it). |
16:05:04 | FromDiscord | <majortrips1763> Continuing to the top of an outer loop w/out executing items below the end of the inner loop. |
16:05:43 | FromDiscord | <majortrips1763> You can certainly do it w/ a stack of flow control variables .. but the exact same thing is true for `break` .. you can construct a stack of flow control variables to remove the need for `break <label>` |
16:06:34 | FromDiscord | <majortrips1763> The only difference between the two is a `jmp` forward vs backward w/ or w/out a stack of flow-control logic. 1 instruction or a stack of instructions. |
16:10:20 | FromDiscord | <majortrips1763> sent a long message, see https://pasty.ee/zNeBOxyv |
16:12:25 | FromDiscord | <majortrips1763> 🤔 |
16:16:50 | FromDiscord | <spotlightkid> > The for/while loop doesn't have an innate label to jmp to.↵Yes, `continue <label>` only saving you lines when you have those implicit labels. Otherwise, you need an explicit label at the top of the body of the outer loop and then you could just use a `break <label>`. |
16:17:01 | FromDiscord | <spotlightkid> > The for/while loop doesn't have an innate label to jmp to.↵Yes, `continue <label>` only is saving you lines when you have those implicit labels. Otherwise, you need an explicit label at the top of the body of the outer loop and then you could just use a `break <label>`. |
16:18:26 | FromDiscord | <majortrips1763> Right, the nesting of `block` gets pretty convoluted. Particularly if you have an inner condition that needs to be checked more than once |
16:20:47 | FromDiscord | <michaelb.eth> since `continue` is already just sugar for `break`, it doesn't seem a big stretch to have `continue <label>` for convenience |
16:22:02 | FromDiscord | <spotlightkid> But if you have no implicit loop labels, it is just not adding anything. |
16:22:26 | FromDiscord | <majortrips1763> Well, unless you allowed it to `continue` to ` block` label |
16:22:32 | FromDiscord | <majortrips1763> (edit) "` block`" => "`block`" |
16:23:16 | FromDiscord | <majortrips1763> But yah, I dunno that that cleans it up, you end up with a `block` before and after the `while/for` if you want to `break` one vs `continue` the other. |
16:24:04 | FromDiscord | <majortrips1763> `continue <n>` like shell would maybe make more sense to avoid the label case, but can quickly introduce nightmares when refactoring code. |
16:27:23 | FromDiscord | <demotomohiro> This macro creates a while statement with named blocks so that you can easily leave or continue the while loop in double (or deeper) loop.↵https://github.com/demotomohiro/littlesugar/blob/main/src/littlesugar/namedWhile.nim |
16:32:22 | FromDiscord | <michaelb.eth> In reply to @spotlightkid "But if you have": true, maybe that |
16:33:11 | FromDiscord | <michaelb.eth> whoops, maybe that's why the Manual doesn't cover usage of `continue <label>` |
16:42:54 | * | lx12ucy joined #nim |
16:42:58 | * | lx12ucy quit (Client Quit) |
16:52:40 | * | Artea quit (Quit: ZNC 1.8.2 - https://znc.in) |
16:54:09 | * | ntat quit (Quit: Leaving) |
16:54:51 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
17:00:24 | FromDiscord | <majortrips1763> Is c2nim still actively maintained? |
17:02:49 | * | ntat joined #nim |
17:10:45 | FromDiscord | <majortrips1763> https://github.com/nim-lang/c2nim/issues/215 |
17:14:36 | FromDiscord | <nnsee> In reply to @majortrips1763 "Is c2nim still actively": i don't think so - most people these days use futhark |
17:15:03 | FromDiscord | <einjonas> In reply to @odexine "im surprised nim doesnt": i recommended to parse the recursion to while a few days ago it would solve the issue |
17:15:36 | FromDiscord | <einjonas> this is what recript does |
17:16:09 | FromDiscord | <einjonas> recsript parses to ocaml |
17:16:16 | FromDiscord | <einjonas> (edit) "ocaml" => "js" |
17:16:35 | FromDiscord | <einjonas> or scheme c transpiler |
17:25:30 | FromDiscord | <demotomohiro> In reply to @einjonas "i recommended to parse": Related issue: https://github.com/nim-lang/Nim/issues/21844 |
17:36:46 | FromDiscord | <dawidek.2137> In reply to @determiedmech1 "their other complaint is": wait until he learns macros and pragmas exist |
17:36:59 | FromDiscord | <dawidek.2137> (all three are optional features) |
18:34:46 | FromDiscord | <majortrips1763> so .. defining unions... |
18:39:17 | * | ttkap quit (Ping timeout: 248 seconds) |
18:40:14 | * | strogon14_ joined #nim |
18:41:02 | * | strogon14 quit (Read error: Connection reset by peer) |
18:45:00 | * | ttkap joined #nim |
19:21:41 | FromDiscord | <albassort> In reply to @determiedmech1 "": no chat, this is false |
19:21:44 | FromDiscord | <albassort> (edit) "In reply to @determiedmech1 "": no chat, this is false ... " added "or a meme" |
19:22:12 | FromDiscord | <albassort> oh nobody actually explained it to you |
19:23:29 | FromDiscord | <albassort> you're running it on a 64 bit cpu, so the heap isn't limited to 32 bits. The issue was never about the pointers being 32bits long (but im not sure how a 32 bit pointer can point to a byte in 64 bit virtual address space???) |
19:27:16 | * | coldfeet joined #nim |
19:57:08 | * | PMunch joined #nim |
20:10:05 | FromDiscord | <majortrips1763> sent a long message, see https://pasty.ee/SjDgBYlI |
20:10:50 | * | ntat quit (Quit: Leaving) |
20:10:59 | FromDiscord | <Elegantbeef> Don't use include is the first thing |
20:11:12 | FromDiscord | <Elegantbeef> Secondly don't use string in import |
20:13:40 | FromDiscord | <determiedmech1> In reply to @albassort "no chat, this is": Lol ok I think she was confused bc I didn't know it was platform dependent and I was testing it with my phone(32bit processor) |
20:14:10 | FromDiscord | <determiedmech1> so my misunderstanding led to her misunderstanding |
20:18:50 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "Don't use include is": Is there a particular reason for not using `include`, or is it just preference? |
20:19:50 | FromDiscord | <Elegantbeef> Include copies the files so if someone imports the module later the type are incompatible |
20:19:51 | FromDiscord | <Elegantbeef> It's best to avoid using include wherever possible if you want to allow selective imports anywhere |
20:21:24 | FromDiscord | <majortrips1763> 🤔 |
20:22:38 | FromDiscord | <Elegantbeef> Say you only need the types and the consts and someone does `import multiboot/consts/multiboot1` the types it gets are not compatible with `import multiboot1` since they were defined in different modules |
20:23:34 | FromDiscord | <Elegantbeef> `include` makes it so the module that defines it is the module which includes, this means each instance of `include` generates a new type and new constants and recompiles all of it. `import` on the otherhand shares definitions so only one compilation is required and the types are the same |
20:25:08 | FromDiscord | <majortrips1763> I am not attempting to use include to share the consts between modules or submodules, I just parked them off on the side out of habit and because I tend to not like super huge files. I suppose I could always park them in the `include` directory and modify the path so they can't be treated as a submodule |
20:25:29 | FromDiscord | <Elegantbeef> I mean you can just `import` and `export consts` if you want to expose them |
20:25:47 | FromDiscord | <Elegantbeef> Avoiding include is generally for everyone's best interest as it makes code more module imo |
20:41:33 | * | PMunch quit (Quit: leaving) |
21:12:54 | * | coldfeet quit (Remote host closed the connection) |
21:39:20 | * | rockcavera joined #nim |
22:07:22 | FromDiscord | <mrgaturus> In reply to @Elegantbeef "`include` makes it so": tl;dr, include is just like copy and paste the whole module |
22:07:38 | FromDiscord | <mrgaturus> (edit) "In reply to @Elegantbeef "`include` makes it so": tl;dr, include is just like ... copy" added "if you" |
22:08:00 | FromDiscord | <mrgaturus> (edit) "In reply to @Elegantbeef "`include` makes it so": tl;dr, include is just like if you copy and paste the whole module ... " added "code" |
22:08:27 | FromDiscord | <mrgaturus> (edit) "include" => "`include`" |
22:11:54 | FromDiscord | <Elegantbeef> Damn not reading such superfluous information, for shame! |
22:43:31 | FromDiscord | <.bobbbob> In reply to @demotomohiro "Related issue: https://github.com/nim-lang/Nim/issu": araq hates tail recursion, it's over |
23:08:14 | FromDiscord | <.bobbbob> also Im under the impression that any non-tail recursion function can be converted to using a while loop with a stack data structure (on the heap), avoiding stack overflows, are there any languages that do that automatically? |
23:15:31 | FromDiscord | <majortrips1763> In reply to @.bobbbob "also Im under the": You mean to secretly convert a recursive call into a loop? |
23:15:44 | FromDiscord | <Elegantbeef> On the heap? That's not really required now is it |
23:16:15 | FromDiscord | <Elegantbeef> On the heap? That's not really required now is it |
23:17:16 | FromDiscord | <majortrips1763> I think tail recursion is a situation in which it is easy to identify that the stack can be recycled, so i doesn't fall into any sort of halting problem, but I dunno if it i possible for the compiler to identify a recursive call and know how to translate it back into a non-recursive while loop .. I think the halting problem gets in the way. |
23:18:03 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "On the heap? That's": I think it is in reference to the feasibility of doing something like implementing quicksort in a loop w/out invoking recursion .. it can be certainly be done, but I dunno that the compiler could do it. |
23:18:24 | FromDiscord | <majortrips1763> (edit) removed "be" |
23:20:11 | FromDiscord | <majortrips1763> @ElegantBeef I refactored that code to remove `include` |
23:23:54 | FromDiscord | <Elegantbeef> Nice |
23:27:53 | FromDiscord | <majortrips1763> Hmm .. trying to figure out a semi-sane approach to writing unit/integration tests for this.. are there any guides for writing Nim tests? |
23:30:31 | FromDiscord | <nervecenter> https://nim-lang.org/docs/testament.html |
23:32:41 | FromDiscord | <eightbit_dboy> In reply to @PMunch "It was meant to": Is it needed for anything, or is it just for people who aren't using futhark to generate a wrapper? |
23:37:28 | FromDiscord | <majortrips1763> In reply to @nervecenter "https://nim-lang.org/docs/testament.html": Hmm .. anyone know of any modules for inspecting ELF binaries? Lools like the repo for `elfcore` has been removed. |
23:38:06 | FromDiscord | <Elegantbeef> I was curious about this a bout a month ago and found nothing |
23:38:09 | FromDiscord | <Elegantbeef> about even |