<< 09-10-2024 >>

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:38FromDiscord<eightbit_dboy> Posted my text editor to the forum: https://forum.nim-lang.org/t/12546
00:35:34FromDiscord<kiloneie> im pretty sure you can use backticks for variable names, but not values
00:36:52FromDiscord<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:12FromDiscord<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:55FromDiscord<odexine> In reply to @majortrips1763 "Thank you, I wasn't": why not? you can have leading underscores in importc/exportc
04:18:28FromDiscord<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:16FromDiscord<Elegantbeef> Though if you know that the compiler always appends `_` it's not rocket science
04:22:33FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=THkKwclo
04:22:53FromDiscord<xkonti> (edit) "https://play.nim-lang.org/#pasty=HhmgTcub" => "https://play.nim-lang.org/#pasty=tjEmFsij"
04:23:54FromDiscord<Elegantbeef> I do see a lot of casts that I'm dubious of
04:26:09FromDiscord<Elegantbeef> Well it's not the cause but I did see `readBytes`
04:26:19FromDiscord<Elegantbeef> First off `toSeq` in there is redundant
04:26:29FromDiscord<Elegantbeef> Second off, make a `readStr` 😄
04:27:00FromDiscord<Elegantbeef> Without using cast
04:30:35FromDiscord<Elegantbeef> If not already I'd suggest using `-d:usuMalloc` and run it through valgrind
04:30:49FromDiscord<Elegantbeef> It's `-d:useMalloc --debugger:native`\
04:41:12*alexdaguy joined #nim
05:33:02FromDiscord<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:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=tupjfsTk
05:57:41FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=GgCOFWAU
06:01:37FromDiscord<swrge> `toOpenArray` doesn't allocate
06:07:25FromDiscord<Elegantbeef> `a[..] =` assigns a slice
06:07:29FromDiscord<Elegantbeef> It takes an `openArray`
06:11:50FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=FqITWcVZ
06:12:39FromDiscord<xkonti> I understand that the `result[0..numberOfbytes.int]` as the left side of the `[]=` isn't a string anymore...
06:13:07FromDiscord<xkonti> (edit) "I" => "~I" | "anymore..." => "anymore...~"
06:13:54FromDiscord<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:58FromDiscord<Elegantbeef> I guess I take it all back
06:15:00FromDiscord<Elegantbeef> `import std/strbasics` and do `newSeqOfCap(numberOfBytes)` then `result.add reader.data.toOpenArray(...)` 😄
06:31:11FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=afnoRHKV
06:32:08FromDiscord<Elegantbeef> Whoops `newString`
06:33:48FromDiscord<Elegantbeef> I also forgot it was `seq[uint8]` so I guess.... yea
06:34:02FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=psvBheph
06:34:07FromDiscord<Elegantbeef> Gotta cast somewhere but `seq[uint8]` -\> `seq[char]` is better
06:34:27FromDiscord<xkonti> instead of seq[uint8] -> string?
06:34:42FromDiscord<Elegantbeef> `cast[seq[char]](reader.data).toOpenArray...`
06:34:52FromDiscord<Elegantbeef> That'll 'work' and removes one possible source of issues
06:36:51FromDiscord<xkonti> Compiles! I'm gonna try to plug that into decoding strings.
06:59:39FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=dzFnbpRN
06:59:55FromDiscord<Elegantbeef> `newStringOfCap` 😄
07:00:13FromDiscord<Elegantbeef> `toOpenArray` does not allocate a new seq
07:00:17FromDiscord<Elegantbeef> It's like `Span`
07:01:50FromDiscord<Elegantbeef> I assume it fixed it cause of it having `\0`
07:02:16FromDiscord<xkonti> Huh. So the `someSeq[a..b]` does allocate?↵↵As for `newStringOfCap` I understand avoids the unnecessary resizing?
07:02:53FromDiscord<Elegantbeef> Yes
07:04:37FromDiscord<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:50FromDiscord<Elegantbeef> That's' my point
07:05:27FromDiscord<Elegantbeef> Strings have \\0
07:05:34FromDiscord<Elegantbeef> seqs do not
07:05:40FromDiscord<Elegantbeef> So that cast did not provide everything it needed
07:06:45FromDiscord<Elegantbeef> It otherwise would look right
07:08:12FromDiscord<arnetheduck> In reply to @xkonti "Huh. So the `someSeq[a..b]`": this is reason alone to deprecated `[]` in the std lib
07:08:15FromDiscord<arnetheduck> (edit) "deprecated" => "deprecate"
07:08:43FromDiscord<arnetheduck> (edit) "lib" => "lib, it's nuts"
07:09:12FromDiscord<Elegantbeef> I say it's reason for view types 😄
07:12:13FromDiscord<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:26FromDiscord<Elegantbeef> I don't pretend they're close
07:13:11FromDiscord<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:32FromDiscord<Elegantbeef> It exists for `string` for C interop
07:15:36*pbsds3 quit (Quit: The Lounge - https://thelounge.chat)
07:16:24FromDiscord<Elegantbeef> I assume it used `.cstring` to print out interall
07:26:18FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=KzIUqqrT
07:28:21FromDiscord<Elegantbeef> An empty string is free to allocate
07:28:21FromDiscord<Elegantbeef> There is no heap part
07:29:32FromDiscord<xkonti> Still an operation to perform though...
07:29:57FromDiscord<Elegantbeef> It's writing 0 twice
07:30:56*pbsds3 joined #nim
07:31:22FromDiscord<Elegantbeef> If writing two words is your issue, what are we doing
07:35:23FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=qXLTbjse
07:37:58FromDiscord<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:24FromDiscord<Elegantbeef> If the C compiler does not reason that it's unneeded and does it anyway
07:39:34FromDiscord<xkonti> In reply to @Elegantbeef "If the C compiler": Can nim use the zig compiler instead of the default MingW on Windows?
07:40:01FromDiscord<Elegantbeef> Sure
07:40:29FromDiscord<Elegantbeef> https://github.com/enthus1ast/zigcc makes it the easiest
07:41:43FromDiscord<xkonti> Wow! Is there any benefit other than cross compilation? Things like performance, safety, etc?
07:41:52FromDiscord<Elegantbeef> It's clang
07:42:22FromDiscord<Elegantbeef> The code is likely more optimised in my experience over GCC
07:42:36FromDiscord<Elegantbeef> I find clang also generally makes smaller binaries
07:42:50FromDiscord<Elegantbeef> So clang is generally just a better default than GCC in my experience
07:43:27FromDiscord<xkonti> I'll add it to my "Things to tinker with" list 🙂
07:44:03FromDiscord<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:12FromDiscord<Elegantbeef> Why are you passing a random path to `compilerArgs`?
07:45:42FromDiscord<Elegantbeef> If you want to provide a system path, it's `sysPath`
07:45:42FromDiscord<eightbit_dboy> In reply to @Elegantbeef "Why are you passing": That was temporary, it was originally `getClangIncludePath()`
07:46:13FromDiscord<Elegantbeef> using clang for your system path for a nintendo 64 compiler is likely to explode
07:46:15FromDiscord<eightbit_dboy> But that was the path to my clang include directory
07:46:27FromDiscord<Elegantbeef> Right but why are you passing it as a compiler arg?
07:46:36FromDiscord<eightbit_dboy> I'm not trying to compile with clang, I'm trying to generate a wrapper.
07:46:41FromDiscord<Elegantbeef> A path provided to a C compiler attempts to compile it
07:46:58FromDiscord<Elegantbeef> Right but the thing is that you want to use your compilers system include to ensure definitions match
07:47:16FromDiscord<Robyn [She/Her]> In reply to @xkonti "Wow! Is there any": crosscompilation with zigcc is easy
07:47:29FromDiscord<eightbit_dboy> So `compilerArg` should be passed the libdragon include path?
07:47:31FromDiscord<Elegantbeef> Even if you just want to generate headers it's not wise to rely on the Clang sys path
07:47:42FromDiscord<Elegantbeef> No `compilerArgs` should not be used since you want `sysPath`
07:47:50FromDiscord<eightbit_dboy> Okay
07:47:55FromDiscord<Elegantbeef> `sysPath` is the path to your system include
07:48:23FromDiscord<Elegantbeef> Hehe robyn you responded to "what does Zigcc do other than CC" with "It does CC"
07:49:05FromDiscord<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:15FromDiscord<Elegantbeef> You might even be able to omit the `compilerArg` and `sysPath` cause it searches for it
07:49:44FromDiscord<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:11FromDiscord<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:20FromDiscord<Elegantbeef> What's the point of writing docs if no one will read them 😄
07:50:20FromDiscord<eightbit_dboy> https://media.discordapp.net/attachments/371759389889003532/1293480658148130816/naylib64.nim?ex=6707873c&is=670635bc&hm=777887cb4773b76478c997d2158894b957c06b090780048cc19c3bbc5d7daa2c&
07:50:50FromDiscord<eightbit_dboy> Docs are for programmers who help programmers who don't read docs, lol
07:51:53FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Hehe robyn you responded": oh
07:52:04FromDiscord<Robyn [She/Her]> i blame the rain droplets on my glasses
07:54:01FromDiscord<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:42FromDiscord<eightbit_dboy> Not sure what these postfix numbers are about.
07:59:25FromDiscord<eightbit_dboy> Are those like private variables not meant to be exposed to other units?
08:09:32Amun-RaI think futhark does that to prevent name clashes
08:10:21Amun-Ralike "enum FooBar" and "FOO_BAR" from C to nim, something I had to fight making my own sdl wrapper
08:26:27FromDiscord<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:19Amun-Raeightbit_dboy: I encountered the problem twice, I just added Enum at the end of the type name ;)
08:35:18Amun-Raand EventType instead of Event (as in: https://github.com/amnr/nsdl3/blob/master/src/nsdl3/sdl3inc/sdl3events.nim#L24 )
08:36:55FromDiscord<eightbit_dboy> In reply to @Amun-Ra "and EventType instead of": Okay, but how do you make futhark do that?
08:37:09Amun-Raah, I get it now, I don't use one
08:37:12FromDiscord<eightbit_dboy> Trying to find your file that uses futhark
08:37:14FromDiscord<eightbit_dboy> ...
08:37:48FromDiscord<eightbit_dboy> So what are you using to generate bindings?
08:38:02Amun-RaI do it by hand
08:38:36FromDiscord<eightbit_dboy> You generate all your bindings by hand?
08:38:51Amun-Rayes
08:39:24Amun-Raand I write with the intention of not exposing low level types to the user
08:39:55FromDiscord<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:25Amun-RaI was just addressing the question why furthark makes these names
08:40:35Amun-RaI wasn't addressing anything else
08:40:57Amun-Rasorry for the confusion
08:41:46FromDiscord<eightbit_dboy> But you knew that was the problem I was experiencing
08:41:52Amun-Rano
08:42:13Amun-RaI only answered the question regarding enum names
08:43:32*beholders_eye joined #nim
08:43:36FromDiscord<eightbit_dboy> I give up.
08:43:52Amun-Ranever give up
08:44:02FromDiscord<eightbit_dboy> Dude
08:44:19FromDiscord<eightbit_dboy> https://media.discordapp.net/attachments/371759389889003532/1293494238557765674/image.png?ex=670793e2&is=67064262&hm=44c991ad93d2cdbfea399bd78221795f414988d502483ed86194c845999d69fe&
08:44:52FromDiscord<eightbit_dboy> Like, how did you not understand what I thought you were implying, here?
08:45:09Amun-Rasimply - I'm not you
08:45:19FromDiscord<eightbit_dboy> Holy fucking shit, dude.
08:45:44Amun-RaI haven't added "futhark", and I should have added additional info that I'm not talking about futhark in the following sentence
08:45:56FromDiscord<eightbit_dboy> Yeah, you should have.
08:46:04FromDiscord<eightbit_dboy> No shit.
08:46:34Amun-RaI said I'm sorry for the confusion, no need to be such an ass
08:49:08FromDiscord<nnsee> ayo guys let's not fight
08:49:29FromDiscord<nnsee> i think the right person to ping for issues with futhark's internals is @pmunch
08:51:39PMunch@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:50PMunchSo you don't use the mangled names anywhere in your code
08:52:02FromDiscord<nnsee> (also, as a side note, if you want people to help you, coming off as overly combative is not the way)
08:53:09PMunchAlso, please behave @eightbit_dboy, Amun-Ra was just trying to help, he even said sorry for confusing you
08:53:21FromDiscord<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:41PMunchWhy do you want it to not do that?
08:53:58PMunchI 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:09PMunchBecause the name mangling is there for a reason
08:54:33PMunchAnd as I said Futhark creates aliases to the mangled names so you never use the mangled names in your code anyways
08:55:08FromDiscord<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:30FromDiscord<eightbit_dboy> As I speculated here: https://discord.com/channels/371759389889003530/371759389889003532/1293482940843560981
08:56:03PMunchNo, it basically creates `type mangledName_2312323 = <actual type definition>; type mangledName = mangledName_2412323`
08:56:16FromDiscord<eightbit_dboy> Gotcha
08:56:17PMunchSo in your code you just use `mangledName` without all the numbers
08:56:38FromDiscord<eightbit_dboy> It's late here, so brain not brain good.
08:57:05FromDiscord<eightbit_dboy> Thank you!
08:57:14PMunchYou can use `-d:nodeclguards` as explained in the README to disable this feature, but again, it's there for a reason :)
08:58:19Amun-RaPMunch: how do you resolve name collisions?
09:01:10FromDiscord<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:03FromDiscord<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:27FromDiscord<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:42Amun-Rayes
09:05:55FromDiscord<eightbit_dboy> Thanks!
09:38:01FromDiscord<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:09FromDiscord<eightbit_dboy> Well, it looks like I won't need to override anything, so it works out.
09:54:10Amun-Rapmunch: 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:43PMunchBy the way, I'm holding a Futhark talk for NimConf, anything in particular I should include?
10:39:00PMunchObviously 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:24FromDiscord<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:39FromDiscord<eightbit_dboy> Because it really can be that fast.
12:53:27FromDiscord<eightbit_dboy> Also, is there a way to have it generate a wrapper without spitting out a binary?
13:15:24PMunchOoh, that's a good idea
13:15:35PMunchUnfortunately no way to not spit out a binary
13:15:47PMunchIt was meant to be part of your build
13:32:29FromDiscord<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:11FromDiscord<einjonas> has Nimlang Labels like Rust
13:33:17FromDiscord<einjonas> to break loops
13:33:34PMunch`block somename: break somename`?
13:33:50FromDiscord<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:48FromDiscord<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:49FromDiscord<majortrips1763> Just missing `continue <arg>`
13:57:48PMunchYeah for continue you need an some infinite loops and blocks
13:57:55PMunchWe discussed this the other day actually
13:58:36FromDiscord<majortrips1763> Yah, just shell let's you `continue <N>` to jump to the top of an outer loop.
14:00:48FromDiscord<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:02FromDiscord<determiedmech1> what's the recursion limit supposed to be for release and danger?
14:09:04PMunchWell this would be like Pythons for/else https://play.nim-lang.org/#pasty=pCUckLFS
14:09:15FromDiscord<odexine> In reply to @determiedmech1 "what's the recursion limit": 2 million iirc but its configurable
14:09:20FromDiscord<determiedmech1> ah
14:09:35FromDiscord<odexine> youll be told how to configure it when you hit the limit
14:09:45FromDiscord<odexine> (aka i forgot and cant be assed to check how xd)
14:11:02PMunch--maxLoopIterations or something like that
14:11:13FromDiscord<majortrips1763> In reply to @PMunch "Well this would be": Yah, but how to do something similar to `continue <label>` ?
14:11:18FromDiscord<determiedmech1> sent a code paste, see https://play.nim-lang.org/#pasty=OpzldaRD
14:11:33FromDiscord<determiedmech1> (edit) "https://play.nim-lang.org/#pasty=yvlTJkSX" => "https://play.nim-lang.org/#pasty=QMpMVAix"
14:12:13PMunchThat's possibly just stack frame sizes or something like that
14:12:17FromDiscord<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:27PMunchExactly
14:12:35FromDiscord<determiedmech1> oh fair
14:12:57FromDiscord<majortrips1763> W/out some sort of tail recursion that knows that it can reuse the current stack.
14:13:30FromDiscord<odexine> im surprised nim doesnt have tail call optimisation
14:13:35FromDiscord<determiedmech1> I could just leave it running without the printing stuff and see what happens
14:13:36FromDiscord<majortrips1763> (edit) "stack." => "stack pointer."
14:13:48PMunch@majortrips1763, you could do it like this: https://play.nim-lang.org/#pasty=teJqyvfs
14:13:58FromDiscord<odexine> i dont think its the echo call thats inflating the stack frame size no?
14:14:10PMunch@odexine, I think C can add it in some cases
14:14:46PMunchBut yeah, native tail-end recursion would be neat
14:14:46*PMunch quit (Quit: Leaving)
14:15:30FromDiscord<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:42FromDiscord<determiedmech1> does `break label` break from "label" or to "label"
14:16:18FromDiscord<majortrips1763> In reply to @determiedmech1 "does `break label` break": from, we are tryin to imagine code for `continue` to an outer label
14:16:23FromDiscord<determiedmech1> ok
14:17:04FromDiscord<majortrips1763> C of course has `goto`, and POSIX sh has `continue <N>`
14:18:13FromDiscord<majortrips1763> There are some situations in which it is really nice to have (up there with optimizing tail recursion).
14:20:04FromDiscord<majortrips1763> Honestly, when I saw that Nim had `break <label>` I completely expected it to include `continue <label>`.
14:20:57FromDiscord<majortrips1763> @pmunch I think the easiest solution is to nest multile `block <label>:`
14:22:05FromDiscord<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:49FromDiscord<majortrips1763> @pmunch https://play.nim-lang.org/#pasty=giJnFqlS maybe?
14:50:39FromDiscord<threefour> In reply to @odexine "im surprised nim doesnt": Is that on the roadmap at all?
14:51:03FromDiscord<odexine> no clue
15:00:17FromDiscord<majortrips1763> Ahh no ... here we go .. this one catches all 3 branch conditions ... 😣 ↵https://play.nim-lang.org/#pasty=FIdAcjYD
15:01:48FromDiscord<pmunch> Now for bonus points create a template out of it to ease the readability
15:03:49FromDiscord<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:02FromDiscord<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:28FromDiscord<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:35FromDiscord<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:43FromDiscord<odexine> continue label apparently jumps within the loop, to the top
15:27:38FromDiscord<spotlightkid> What's the difference to normal continue then?
15:29:25FromDiscord<odexine> jump to arbitrary loop, if nested
15:37:03FromDiscord<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:34FromDiscord<determiedmech1> hey chat quick question
15:42:51FromDiscord<determiedmech1> if pointers are the same size as inte
15:42:56FromDiscord<determiedmech1> (edit) "inte" => "ints"
15:43:30FromDiscord<determiedmech1> and the int type is an int32
15:43:46FromDiscord<odexine> int type is not int32
15:43:56FromDiscord<odexine> or do you mean in this case?
15:44:32FromDiscord<determiedmech1> Going off this https://media.discordapp.net/attachments/371759389889003532/1293599991520301217/image0.jpg?ex=6707f65f&is=6706a4df&hm=122fc6e7aa1a347695d4a4c994ef98cb4069aad16f6f7013993a0a4506ca1f5f&
15:44:37FromDiscord<odexine> why are there fifteen billion people typing
15:44:38FromDiscord<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:43FromDiscord<determiedmech1> does that mean pointers are 32 bits
15:44:50FromDiscord<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:03FromDiscord<odexine> In reply to @chronos.vitaqua "if int has the": basically yeah
15:45:08FromDiscord<Robyn [She/Her]> In reply to @determiedmech1 "does that mean pointers": Do `sizeof pointer == sizeof int`
15:45:17FromDiscord<odexine> or nim and the c compiler is in 32 bit
15:45:51FromDiscord<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:25FromDiscord<determiedmech1> Because currently I am talking to someone who is crashing out over 32bit pointers
15:46:35FromDiscord<Robyn [She/Her]> In reply to @determiedmech1 "Because currently I am": ...huh? why?
15:46:47FromDiscord<odexine> In reply to @determiedmech1 "Because currently I am": ?
15:47:25FromDiscord<Robyn [She/Her]> do they not realise 32 bit CPUs exist?-
15:47:39FromDiscord<odexine> ? https://media.discordapp.net/attachments/371759389889003532/1293600773565054996/image.png?ex=6707f71a&is=6706a59a&hm=f788bde8b2ab4316d351a54e77c463d1c2997082ae8e8186933a8b98c848aebe&
15:48:48FromDiscord<determiedmech1> https://media.discordapp.net/attachments/371759389889003532/1293601064880312341/image0.jpg?ex=6707f75f&is=6706a5df&hm=5cbf63a298f15e5fc593c866f2f57e182107857fafa0d99de64d8f326ebcaeab&
15:49:12FromDiscord<determiedmech1> chat is this real
15:49:22FromDiscord<odexine> I Think Your Friend Is Misunderstanding Something
15:49:39FromDiscord<determiedmech1> their other complaint is the case/underscore insensitivity
15:49:57FromDiscord<michaelb.eth> In reply to @determiedmech1 "their other complaint is": nice, that’s a good filter
15:49:58FromDiscord<odexine> i mean up to them for that thing
15:50:02FromDiscord<odexine> lol
15:50:16FromDiscord<odexine> go filtered me with its caps for public shenanigans
15:51:53FromDiscord<determiedmech1> Ok wait so now I need an explanation about why 32bit pointers aren't an issue
15:52:29FromDiscord<michaelb.eth> they’re 32 on a 32-bit system, 64 on a…
15:57:13FromDiscord<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:50FromDiscord<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:27FromDiscord<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:15FromDiscord<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:04FromDiscord<majortrips1763> Continuing to the top of an outer loop w/out executing items below the end of the inner loop.
16:05:43FromDiscord<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:34FromDiscord<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:20FromDiscord<majortrips1763> sent a long message, see https://pasty.ee/zNeBOxyv
16:12:25FromDiscord<majortrips1763> 🤔
16:16:50FromDiscord<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:01FromDiscord<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:26FromDiscord<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:47FromDiscord<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:02FromDiscord<spotlightkid> But if you have no implicit loop labels, it is just not adding anything.
16:22:26FromDiscord<majortrips1763> Well, unless you allowed it to `continue` to ` block` label
16:22:32FromDiscord<majortrips1763> (edit) "` block`" => "`block`"
16:23:16FromDiscord<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:04FromDiscord<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:23FromDiscord<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:22FromDiscord<michaelb.eth> In reply to @spotlightkid "But if you have": true, maybe that
16:33:11FromDiscord<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:24FromDiscord<majortrips1763> Is c2nim still actively maintained?
17:02:49*ntat joined #nim
17:10:45FromDiscord<majortrips1763> https://github.com/nim-lang/c2nim/issues/215
17:14:36FromDiscord<nnsee> In reply to @majortrips1763 "Is c2nim still actively": i don't think so - most people these days use futhark
17:15:03FromDiscord<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:36FromDiscord<einjonas> this is what recript does
17:16:09FromDiscord<einjonas> recsript parses to ocaml
17:16:16FromDiscord<einjonas> (edit) "ocaml" => "js"
17:16:35FromDiscord<einjonas> or scheme c transpiler
17:25:30FromDiscord<demotomohiro> In reply to @einjonas "i recommended to parse": Related issue: https://github.com/nim-lang/Nim/issues/21844
17:36:46FromDiscord<dawidek.2137> In reply to @determiedmech1 "their other complaint is": wait until he learns macros and pragmas exist
17:36:59FromDiscord<dawidek.2137> (all three are optional features)
18:34:46FromDiscord<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:41FromDiscord<albassort> In reply to @determiedmech1 "": no chat, this is false
19:21:44FromDiscord<albassort> (edit) "In reply to @determiedmech1 "": no chat, this is false ... " added "or a meme"
19:22:12FromDiscord<albassort> oh nobody actually explained it to you
19:23:29FromDiscord<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:05FromDiscord<majortrips1763> sent a long message, see https://pasty.ee/SjDgBYlI
20:10:50*ntat quit (Quit: Leaving)
20:10:59FromDiscord<Elegantbeef> Don't use include is the first thing
20:11:12FromDiscord<Elegantbeef> Secondly don't use string in import
20:13:40FromDiscord<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:10FromDiscord<determiedmech1> so my misunderstanding led to her misunderstanding
20:18:50FromDiscord<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:50FromDiscord<Elegantbeef> Include copies the files so if someone imports the module later the type are incompatible
20:19:51FromDiscord<Elegantbeef> It's best to avoid using include wherever possible if you want to allow selective imports anywhere
20:21:24FromDiscord<majortrips1763> 🤔
20:22:38FromDiscord<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:34FromDiscord<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:08FromDiscord<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:29FromDiscord<Elegantbeef> I mean you can just `import` and `export consts` if you want to expose them
20:25:47FromDiscord<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:22FromDiscord<mrgaturus> In reply to @Elegantbeef "`include` makes it so": tl;dr, include is just like copy and paste the whole module
22:07:38FromDiscord<mrgaturus> (edit) "In reply to @Elegantbeef "`include` makes it so": tl;dr, include is just like ... copy" added "if you"
22:08:00FromDiscord<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:27FromDiscord<mrgaturus> (edit) "include" => "`include`"
22:11:54FromDiscord<Elegantbeef> Damn not reading such superfluous information, for shame!
22:43:31FromDiscord<.bobbbob> In reply to @demotomohiro "Related issue: https://github.com/nim-lang/Nim/issu": araq hates tail recursion, it's over
23:08:14FromDiscord<.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:31FromDiscord<majortrips1763> In reply to @.bobbbob "also Im under the": You mean to secretly convert a recursive call into a loop?
23:15:44FromDiscord<Elegantbeef> On the heap? That's not really required now is it
23:16:15FromDiscord<Elegantbeef> On the heap? That's not really required now is it
23:17:16FromDiscord<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:03FromDiscord<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:24FromDiscord<majortrips1763> (edit) removed "be"
23:20:11FromDiscord<majortrips1763> @ElegantBeef I refactored that code to remove `include`
23:23:54FromDiscord<Elegantbeef> Nice
23:27:53FromDiscord<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:31FromDiscord<nervecenter> https://nim-lang.org/docs/testament.html
23:32:41FromDiscord<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:28FromDiscord<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:06FromDiscord<Elegantbeef> I was curious about this a bout a month ago and found nothing
23:38:09FromDiscord<Elegantbeef> about even