<< 10-01-2024 >>

00:00:46*Jjp137 joined #nim
00:05:27*jmdaemon joined #nim
00:30:41NimEventerNew thread by widlet: Attempting to use newContext from std/net fails to compile, see https://forum.nim-lang.org/t/10862
00:31:58*jmdaemon quit (Ping timeout: 255 seconds)
00:48:19FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=html>
00:49:24FromDiscord<Elegantbeef> Read the 32bit then use `std/endianess` or auxym's package to swap them
00:49:49FromDiscord<Elegantbeef> https://github.com/auxym/bight
00:51:43*jmdaemon joined #nim
01:02:53*jmdaemon quit (Ping timeout: 240 seconds)
01:20:23*jmdaemon joined #nim
02:33:06FromDiscord<girvo> Dumb question for termer: can I make an array of stackstrings? StackString doesn't appear to be exported as a type?
02:33:59FromDiscord<girvo> Oh wait'
02:34:01FromDiscord<girvo> I see haha
02:34:33FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#ix=html>
02:36:09FromDiscord<girvo> Now the question is how do I unpack them... send size alongside it I guess? I think that's what you were getting at @ElegantBeef yesterday
02:39:52FromDiscord<Elegantbeef> Yea `len` plus `toOpenArray(0, len)` 😄
02:40:22FromDiscord<Elegantbeef> sorry `0, high` assuming there is a `high`
02:40:25FromDiscord<Elegantbeef> otherwise `len - 1` of course
02:41:32FromDiscord<Elegantbeef> Remember though that array is 10 \ sizeof(int) + 10 \ 512 bytes approximately
02:41:59FromDiscord<Elegantbeef> So if you do want to pass it around whilst not allocating `ref array` will let you `move` it
02:42:20FromDiscord<Elegantbeef> Though I'd suggest a `type LogBuffer = distinct ref array` so you can write your own hooks
02:43:25FromDiscord<Elegantbeef> It'd allow disabling `=copy` and `=dup` meaning there's only ever one owner
02:46:45FromDiscord<Elegantbeef> As always I've given girvo more than he wanted 😄
02:51:52FromDiscord<girvo> Haha nah that's pretty spot on
02:51:59FromDiscord<girvo> Though thankfully it doesn't actually need to be moved anywhere
02:52:40FromDiscord<girvo> Basically just act as a re-usable buffer for incoming `string` lines, that once we hit N lines we send off with as minimal copies as possible in the process, and re-using the buffer next time
02:53:52FromDiscord<girvo> As always, it's a allocation/space trade off, and paying the upfront maximum cost once is ideal here, though we pay for it in network transmission costs...
02:54:04FromDiscord<girvo> Fun trade offs 🥲
02:54:12FromDiscord<Elegantbeef> You do probably want to make it a ref anyway to not put it on the stack
02:54:16FromDiscord<Elegantbeef> That's a lot of stack space to eat up
02:54:21FromDiscord<girvo> Yeah it will be
02:54:28FromDiscord<Elegantbeef> Maybe making it `{.global.}` makes sense aswell 😄
02:55:12FromDiscord<girvo> btw does {.global.} then mean it's statically allocated at the C level? I sort of assumed that was true but never checked
02:55:21*jmdaemon quit (Ping timeout: 245 seconds)
02:55:25FromDiscord<Elegantbeef> I think it makes it `static`
02:55:30FromDiscord<girvo> yeah which is perfect
02:55:33FromDiscord<Elegantbeef> best look at the C to see
02:55:36FromDiscord<girvo> Yeah I'll check
03:47:34termergirvo You can make an array of stackstrings
03:47:53termerthe code pastes aren't loading on IRC anymore for some reason
03:53:43*azimut quit (Ping timeout: 240 seconds)
04:10:54*jmdaemon joined #nim
04:12:18*xet7 joined #nim
04:57:23*rockcavera quit (Remote host closed the connection)
05:08:52FromDiscord<girvo> Yeah I worked it out haha
05:09:06FromDiscord<girvo> I didn't realise they took a type param to specify size!
05:09:55FromDiscord<girvo> Hey yay the nim-libsodium upstream removed the `ptr cuchar` haha. Its now properly `ptr char`
05:18:26FromDiscord<Elegantbeef> @girvo I do wonder do you run with `--hint:Performance: on --hintAsError:Performance`?
05:18:54FromDiscord<Elegantbeef> That prevents any implicit copies from being made when a `sink` cannot be respected
05:25:00FromDiscord<girvo> Ooooooh
05:25:00FromDiscord<girvo> I do not
05:25:09FromDiscord<girvo> That's awesome, thanks
05:26:41termergirvo Using constant values as type params is one of my favorite things with Nim's type system in these situations
05:26:47FromDiscord<Elegantbeef> It does ruin a good part about Nim's move semantics, but in your case it makes sense
05:28:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
05:28:20FromDiscord<Elegantbeef> Static parameters really are magical
05:29:11FromDiscord<Elegantbeef> Speaking of @zectbumo need any help with the static default? \:d
05:30:43FromDiscord<Elegantbeef> Statics can get even crazier with `static procs` 😄
05:30:43FromDiscord<Elegantbeef> https://github.com/beef331/Nim/blob/b7330ccfea225833396ba0f41b77c44d0c59ef28/tests/statictypes/tstaticprocparams.nim
05:30:52FromDiscord<Elegantbeef> That might tickle your brain termer
05:31:31FromDiscord<Elegantbeef> Sadly though a PR needs to be done to remove `static T` from proc matches inside the proc parameters
05:32:09FromDiscord<Elegantbeef> The following is presently true `proc(i: static float i: int) isnot proc(i: int)`
05:32:52FromDiscord<Elegantbeef> I guess when it's inside the parameter list it does not make much sense to match
05:32:54FromDiscord<Elegantbeef> So I take it back
05:36:12termerElegantbeef What you just posted is insane
05:36:26FromDiscord<Elegantbeef> It's super cool though
05:36:50termertrying to think of what that could be used for
05:36:56FromDiscord<Elegantbeef> Girvo and I were talking about being able to do like `log[T: static proc(...){.nimcall.}]` and being able to pass it to a `proc(...){.nimcall.}`
05:37:05termerI guess it'd be faster than passing in a function pointer, maybe
05:37:33FromDiscord<Elegantbeef> It can be faster than passing in a pointer proc, it also can be inline, and also does not require any sort of environment to keep it
05:37:42termerso the sizeof for all those would the same right
05:37:51termeror is it actually stuffing the code for it in the type
05:37:53FromDiscord<Elegantbeef> So you can do like `const myLogger = myProc[logLogic]`
05:37:54termerthat can't be right
05:38:08FromDiscord<Elegantbeef> Static parameters are just generic parameters
05:38:16FromDiscord<Elegantbeef> So it create a instantiation with the value you provide
05:38:34FromDiscord<Elegantbeef> As such it's the exact same overhead as if you were to explicitly write the log proc there
05:38:39termerit's looking very C#-like
05:38:55termerwhat's the function for getting a type's size again
05:39:05termersizeof
05:39:10termernevermind
05:39:18FromDiscord<Elegantbeef> It's going to be `sizeof(pointer)`
05:39:28termerright
05:39:29FromDiscord<Elegantbeef> It emits a brand new procedure
05:39:30termerthat's what I figured
05:39:42FromDiscord<Elegantbeef> Even more craziness here https://github.com/beef331/nimtrest/blob/master/tremoterefs.nim
05:39:52FromDiscord<Elegantbeef> Per type allocators using `static proc`s 😄
05:40:34FromDiscord<Elegantbeef> The example I use for remote ref is when Girvo wanted to allocate using a SpiAllocator and to automatically dealloc/write there
05:40:54termertoo tired for this silliness
05:41:02FromDiscord<Elegantbeef> It's not silly!
05:41:11termertoo tired for this... COOLNESS!
05:41:13termerI wish I could use Nim again
05:41:17termerI miss its type system
05:41:42FromDiscord<Elegantbeef> I mean you can use it, just cry about web related techs
05:42:02termerwaiting, perhaps forever, for CPS
05:42:30termerI considered using the CPS impl available now to write something and just deal with the horrible compile times
05:42:51termerbut the problem is I don't have time to roll my own web framework
05:43:11termer2024 is the year of the Nim tech stack guys
05:43:26FromDiscord<Elegantbeef> Bold claim
05:43:44termer2025 will be the year of the Nim tech stack
05:43:53termer2026 will be the year of the Nim tech stack
05:44:08FromDiscord<Elegantbeef> Eventually something's gotta give
05:44:20FromDiscord<Elegantbeef> Meanwhile I'll write a language from scratch 😄
05:45:10FromDiscord<girvo> In reply to @termer "I guess it'd be": yeah, being able to avoid the overhead (small as it is) is really useful
05:45:27FromDiscord<Elegantbeef> It also prevents having to always provide the environment
05:45:34FromDiscord<girvo> indeed
05:45:41FromDiscord<Elegantbeef> So it makes it so you do not have to manually manage a closure
05:46:11FromDiscord<Elegantbeef> Though if Nim had closures that were stack allocated that'd reduce that issue
05:46:17FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#ix=html>
05:46:22FromDiscord<Elegantbeef> Since you could just do a stack capture of the address
05:46:39FromDiscord<Elegantbeef> there is also the `ensureMove` in 2.x to look forward to 😛
05:46:49FromDiscord<girvo> What languages do stack allocation of closures I wonder? I've not even really thought about it
05:47:03FromDiscord<girvo> ensureMove 😮
05:47:08termerare you writing a language Elegantbeef
05:47:08FromDiscord<Elegantbeef> C++'s lambads are stack allocated arent they?
05:47:22FromDiscord<girvo> In reply to @Elegantbeef "C++'s lambads are stack": I think thats about the only one?
05:47:39FromDiscord<Elegantbeef> No clue but Araq does express displeasure with the fact all closures are heap allocated
05:47:42FromDiscord<girvo> (modulo Rust perhaps)
05:48:40termersucks that they're heap allocated when they don't need to be
05:48:44FromDiscord<Elegantbeef> I mean I do not want to say yes termer cause then I have to hold myself to it, but I'm toying with a parser/lexer at the very least!
05:48:44FromDiscord<girvo> Yep just checked, Rust also stack allocates its closure environemnt
05:49:05FromDiscord<Elegantbeef> I've not wrote a parser/lexer before so it's about time 😄
05:49:17termeris it a scripting lang or are you making a compiler
05:49:21FromDiscord<girvo> Yeah closures are so nice, but sadly we have to avoid them without an MMU/due to heap fragmentation if we weren't careful
05:49:59FromDiscord<Elegantbeef> It being a scripting language does not dismiss a compiler
05:50:12termeris it dynamically typed
05:50:15FromDiscord<Elegantbeef> But I am more interested in having a compiled backend than a scripting language
05:50:23FromDiscord<Elegantbeef> Of course it's not dynamically typed
05:50:29termerok good
05:50:40termermy first and only language was dynamically typed and it was hilarious
05:51:06FromDiscord<Elegantbeef> The plan is an abomination of Nim + Odin influence
05:51:42termerwhat metaprogramming do you want to do with it
05:51:56termerand are you writing a compiler that actually outputs asm
05:52:43FromDiscord<Elegantbeef> Well you see my dumbass wants to output WASM so that it'd have compile time introspection without having to write a VM from scratch or rely on LLVM
05:53:14FromDiscord<Elegantbeef> I highly doubt it'll even get there, but the wish is to compile to wasm then also use wasm modules to implement other backends
05:53:36termerActually that was an idea I also had
05:53:44FromDiscord<Elegantbeef> Then WASM would be the first class target and all other targets could be implemented in userspace
05:54:02termerbut then my idea was I wanted to JIT compile macros and run them in the compiler, and then I'd have to bundle a wasm compiler if I did that
05:54:05termer*wasm runtime
05:54:33FromDiscord<Elegantbeef> I mean a wasm runtime is smaller than LLVM 😛
05:54:40termerbut how small and how fast
05:54:50termerand how useful do you want the lang to be
05:55:52FromDiscord<Elegantbeef> you see I do not want to say much more cause it'll just end up with me describing Nim but with a more usable type system and emphasis on generics, concepts, row polymorphism, and traits 😄
05:56:35FromDiscord<Elegantbeef> That's all a pipedream that is more likely just to be a half assed lexer/parser that does not even emit usable AST 😄
05:57:43termerI had an insane idea where you could write procedural code to describe how types are able to be used
05:57:57termerno generics, you just attach a procedural type guard, for example
05:58:03FromDiscord<Elegantbeef> Ugh
05:58:11termerand other things to augment everything
05:58:19FromDiscord<Elegantbeef> that's just pointless
05:58:25FromDiscord<Elegantbeef> Just make it so generics are checked generics
05:58:25termerultimately you can write macros and code for anything
05:58:42termerI was thinking about Java generics to make it easier
05:59:01FromDiscord<Elegantbeef> If you are describing the required implementation for a type to be passed as a generic you've just made checked generics manual
05:59:13termerthere'd be shorthand for it
05:59:18termerso yeah checked generics
05:59:24FromDiscord<Elegantbeef> The shorthand would be to do fucking nothing?
05:59:26termerbut also you could forgo that and write your own logic
05:59:42termerSo you can do TypeScript-style `is` return types basically
05:59:46FromDiscord<Elegantbeef> A procedure knows what a type needs to implement by looking at all usages of `T`, this of course fails when you have `when`
05:59:49termerbut in a compile-time way
06:00:02termerYou don't understand, I want to make a fun toy
06:00:10FromDiscord<Elegantbeef> Ah
06:00:10termerso I can do insane things and learn to write a compiler
06:00:21FromDiscord<Elegantbeef> I just want to do sane things
06:00:28termerwould rather use Nim and existing langs
06:00:39termeralso no pointers in the lang, compiler decides whether something becomes a reference or not
06:00:49FromDiscord<Elegantbeef> oh god
06:00:52termerif it's references outside where it could be on the stack, it's a reference
06:00:54FromDiscord<Elegantbeef> Go called they want their terrible idea back
06:01:01termerGo has references
06:01:14FromDiscord<Elegantbeef> The compiler decides when references are made
06:01:22termerthere are explicit references
06:01:34FromDiscord<Elegantbeef> Sure
06:01:38FromDiscord<Elegantbeef> But it still has implicit ones
06:01:43termeroh yeah for sure
06:02:03termerBasically I want TypeScript, but compiled, and insane macros
06:02:12FromDiscord<Elegantbeef> Nim does have that with closures, but that's it
06:02:25termerTypeScript not in the JS way, just in the TS ways
06:02:44FromDiscord<Elegantbeef> Hopefully this toy language would have actual overloading
06:02:50termerfor sure
06:02:54termerI like overloading
06:02:58FromDiscord<Elegantbeef> Imagine making a strongly typed language naming it typescript and not have overloading
06:03:11termerTypeScript has to live with a JS reality
06:03:26termerit tries not to generate JS code
06:03:36termerthere are very few things in TS that generate new JS code
06:04:45termerSo imagine this Elegantbeef
06:04:53termerYou have these things called "constraints"
06:05:00termerwhich are basically big event handlers for compiler events
06:05:25termerif you've ever programmed in Java, you may know about the whole "extends SomethingListener" classes
06:05:32termerwhere you override handlers that you want
06:05:58FromDiscord<Elegantbeef> I mean I know C# interfaces
06:06:08termerImagine that, but these effectively listener classes are for events that happen in the compiler
06:06:22termerand for each handler, you get passed context, including the current scope and all its data
06:06:22FromDiscord<Elegantbeef> You've just made term rewriting macros
06:07:09termercan those be attached to types
06:07:22FromDiscord<Elegantbeef> They can search for types
06:07:31FromDiscord<Elegantbeef> So yesn't
06:07:37termerthese could be attached to types, to variables, to functions
06:07:52FromDiscord<Elegantbeef> Yea TRMs can search for types, variables, functions
06:07:57FromDiscord<Elegantbeef> They use AST to pattern match
06:07:58termerthe write procedural code for how they can be used, how their usage is augmented, etc
06:08:44termerso you could have a constraint that limits instantiation of a generic param to only be a struct with 3 fields
06:08:58termerif you use a type for a struct with less than or more than 3 fields, it doesn't let you
06:09:08termerYou could do wild things like that
06:09:38FromDiscord<Elegantbeef> This is just concepts
06:10:07termeryeah except this has access to all contextual information as well
06:10:16termerso not just what's being passed in, but where and how
06:10:32termerand these constraints would be JIT compiled so they run pretty fast
06:10:44*khazakar joined #nim
06:12:08FromDiscord<Elegantbeef> https://hatebin.com/ikpysafbko
06:12:16FromDiscord<Elegantbeef> Couldn't help myself
06:12:35termerfucking hell
06:12:42termerhonestly I didn't know this could be done
06:13:11termerbut see, constraints could do CRAZIER things like require that the struct have as many fields as there are variables in the current scope
06:13:14FromDiscord<Elegantbeef> I said you were describing concepts
06:13:15termerjust to throw out something retarded
06:13:23FromDiscord<Elegantbeef> We can do that
06:13:42FromDiscord<Elegantbeef> Well sorta
06:18:36termerNope, my toy lang idea is more powerful
06:22:19FromDiscord<Elegantbeef> https://hatebin.com/hmybhoisig yep it can
06:25:36FromDiscord<Elegantbeef> Termer really will quickly realise that the only thing that stops a bad guy with a macro is a even bigger macro
06:26:59termerwait
06:27:01termerwhat's locals
06:27:15FromDiscord<Elegantbeef> It compiler magic that makes a tuple of all local variables
06:27:20termerwhat the FUCK
06:27:38termerwhere do I find docs on this
06:27:51termeris it even documented in the first place
06:27:58FromDiscord<Elegantbeef> It's in `system`
06:28:04FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#locals
06:29:00FromDiscord<Elegantbeef> It even gives them their names so it's `(a: "something", b: 4)` in that example
06:29:15termerthis is insane
06:29:21termerhow long have you been using Nim
06:29:39FromDiscord<Elegantbeef> Since 2020
06:30:13FromDiscord<Elegantbeef> And i've never wrote anything of consquence
06:30:33*adigitoleo quit (*.net *.split)
06:30:46*adigitoleo joined #nim
06:31:50termeryou've been writing it as long as me and yet know everything
06:31:59*pbsds quit (*.net *.split)
06:32:00*xutaxkamay quit (*.net *.split)
06:32:03termerI don't understand that
06:32:13termerI thought you would've been using it much much longer
06:32:16*jmdaemon quit (*.net *.split)
06:32:17*deadmarshal_ quit (*.net *.split)
06:32:17*redj quit (*.net *.split)
06:32:17*jkl quit (*.net *.split)
06:32:18*ehmry quit (*.net *.split)
06:32:18*hernan quit (*.net *.split)
06:32:19*m5zs7k quit (*.net *.split)
06:32:20FromDiscord<Elegantbeef> I was dropped as a child
06:32:23FromDiscord<Elegantbeef> A very long height
06:32:28*noeontheend quit (*.net *.split)
06:32:29*mhcat quit (*.net *.split)
06:32:29*mronetwo quit (*.net *.split)
06:32:29*dza quit (*.net *.split)
06:32:32*pbsds joined #nim
06:32:32*xutaxkamay joined #nim
06:32:35*pbsds quit (Max SendQ exceeded)
06:33:03*pbsds joined #nim
06:35:37*jmdaemon joined #nim
06:35:37*deadmarshal_ joined #nim
06:35:37*redj joined #nim
06:35:37*jkl joined #nim
06:35:37*ehmry joined #nim
06:35:37*hernan joined #nim
06:35:37*m5zs7k joined #nim
06:35:44*m5zs7k quit (Max SendQ exceeded)
06:35:49*noeontheend joined #nim
06:35:49*mhcat joined #nim
06:35:49*mronetwo joined #nim
06:35:49*dza joined #nim
06:35:57*m5zs7k_ joined #nim
06:36:36*casaca quit (Read error: Connection reset by peer)
06:37:45*adigitoleo quit (Ping timeout: 256 seconds)
06:37:47*noeontheend quit (Ping timeout: 240 seconds)
06:37:48*mhcat quit (Ping timeout: 240 seconds)
06:37:48*mronetwo quit (Ping timeout: 240 seconds)
06:38:55*mhcat joined #nim
06:39:02*mronetwo joined #nim
06:39:09*adigitoleo joined #nim
06:43:25*adigitoleo quit (Ping timeout: 256 seconds)
06:43:47*mhcat quit (Ping timeout: 268 seconds)
06:45:12*m5zs7k_ is now known as m5zs7k
06:47:29*mronetwo quit (Ping timeout: 268 seconds)
07:09:46*advesperacit joined #nim
07:54:37*adigitoleo joined #nim
07:56:45*noeontheend joined #nim
07:56:51*mhcat joined #nim
07:56:53*mronetwo joined #nim
08:00:15entikanwhat's the nim equivalent of "if foo in bar:" (or is that it and am I screwing something up?)
08:00:49Amun-Rasame
08:02:35entikanoh pff I did `is in` I'm an idiot
08:02:47Amun-Rathe type of the object that is searched for given value must have defined `contains` func iirc
08:02:53Amun-Raoh ;)
08:04:06*adigitoleo quit (Ping timeout: 258 seconds)
08:04:07*mronetwo quit (Ping timeout: 260 seconds)
08:04:07*mhcat quit (Ping timeout: 260 seconds)
08:04:07*noeontheend quit (Ping timeout: 260 seconds)
08:07:05*mronetwo joined #nim
08:07:27*noeontheend joined #nim
08:07:43*mhcat joined #nim
08:14:42*adigitoleo joined #nim
08:25:28FromDiscord<mratsim> In reply to @Elegantbeef "It compiler magic that": oooh is that new?↵Quite handy for custom closures
08:28:49FromDiscord<Elegantbeef> I know it was in 1.6
08:28:53FromDiscord<Elegantbeef> So I do not think it's new
08:32:35*mronetwo quit (Ping timeout: 260 seconds)
08:33:14*adigitoleo quit (Ping timeout: 258 seconds)
08:33:31*noeontheend quit (Ping timeout: 260 seconds)
08:33:59*mhcat quit (Ping timeout: 260 seconds)
08:42:58*noeontheend joined #nim
08:43:04*mhcat joined #nim
08:43:10*mronetwo joined #nim
08:43:24*adigitoleo joined #nim
08:43:36*adigitoleo quit (Read error: Connection reset by peer)
08:43:39*mronetwo quit (Read error: Connection reset by peer)
08:43:39*noeontheend quit (Write error: Connection reset by peer)
08:43:40*mhcat quit (Read error: Connection reset by peer)
08:43:49*adigitoleo joined #nim
08:43:56*mronetwo joined #nim
08:44:14*noeontheend joined #nim
08:44:55*mhcat joined #nim
08:48:08*adigitoleo quit (Read error: Connection reset by peer)
08:48:10*mhcat quit (Read error: Connection reset by peer)
08:48:10*noeontheend quit (Read error: Connection reset by peer)
08:48:11*mronetwo quit (Read error: Connection reset by peer)
08:50:19*mronetwo joined #nim
08:50:21*noeontheend joined #nim
08:55:07*adigitoleo joined #nim
09:01:03*noeontheend quit (Ping timeout: 260 seconds)
09:01:03*mronetwo quit (Ping timeout: 260 seconds)
09:02:22*adigitoleo quit (Ping timeout: 258 seconds)
09:25:46FromDiscord<pmunch> Locals has been around for quite a while
10:07:57*adigitoleo joined #nim
10:11:59*adigitoleo quit (Read error: Connection reset by peer)
10:12:54*noeontheend joined #nim
10:17:00*noeontheend quit (Ping timeout: 245 seconds)
10:20:01FromDiscord<nnsee> is there a sane way of parsing a string like `\x110a0b0c` into a `seq[char]` in std?
10:20:13FromDiscord<nnsee> also, side note, https://nim-lang.org/docs/sha1.html has broken links in the preamble
10:20:34FromDiscord<nnsee> the sha2 and sha3 ones
10:22:03FromDiscord<pmunch> Hmm, actually I wonder what the performance hit of accessing locals is
10:24:28FromDiscord<nnsee> In reply to @nnsee "is there a sane": actually i can just do `parseSecureHash(whateverString[2..^1])`, kind of cursed but whatever
10:26:46FromDiscord<loloof64> Hi ! I'm just starting to learn Nim. Is there a way to get common folders from Nim ? I mean Documents/Images/Configuration... ?
10:29:58FromDiscord<ayex> sent a long message, see <!doctype html>
10:30:20FromDiscord<Phil> I believe they mean fetching folders at runtime
10:30:25FromDiscord<loloof64> no
10:30:53FromDiscord<loloof64> I mean finding the Documents or Image folder on the user host machine for example
10:31:48FromDiscord<Phil> In reply to @loloof64 "Hi ! I'm just": Generally you can find the home directory, for "Document" or "Image" directories you'll need to write your own based on that (so `getHomeDir() & "/Documents` etc.)
10:32:23FromDiscord<loloof64> Thank you. I'm also wondering, will that work on both Linux and Windows ?
10:32:23FromDiscord<Phil> https://nim-lang.org/docs/appdirs.html#getHomeDir
10:32:39FromDiscord<Phil> It will get you both the correct home dir on linux and windows, the path after that is up to you.
10:32:53FromDiscord<Phil> Well, on linux, windows and macOs
10:33:21FromDiscord<loloof64> Thank you very much, that's exactly what I was looking for 😃
10:33:32FromDiscord<nnsee> In reply to @loloof64 "Thank you. I'm also": linux and windows generally have an entirely different structure for these directories, so you shouldn't expect `$HOME/Documents` to exist on linux (although it could very well be there)
10:34:37FromDiscord<loloof64> Indeed, I forgot this fact. But at least I can get the config folder 🙂
10:35:20FromDiscord<loloof64> (getConfigDir())
10:35:24FromDiscord<nnsee> depending on what you want this for you might also be interested in https://nim-lang.org/docs/appdirs.html#getConfigDir
10:35:25FromDiscord<nnsee> oh
10:35:26FromDiscord<nnsee> yes
10:35:27FromDiscord<nnsee> lol
10:36:19FromDiscord<loloof64> I think there I just have to create a subfolder dedicated to my application 🙂
11:02:32FromDiscord<mratsim> In reply to @nnsee "linux and windows generally": XDG has some standard for this, but in my own setup I didn't install the service that creates those
11:02:45FromDiscord<mratsim> I have Photos, no Pictures thank you
11:02:55FromDiscord<mratsim> (edit) "no" => "not"
11:03:11FromDiscord<Phil> I'm on arch, I didn't even set this up myself, I just got handed a Pictures dir
11:08:52FromDiscord<mratsim> In reply to @isofruit "I'm on arch, I": there is a package called xdg something that recreates those on login
11:09:27FromDiscord<salt rock lamp> xdg-user-dirs maybe, or something like that
11:09:35FromDiscord<Phil> In reply to @mratsim "there is a package": Sounds neat personally. It's nice to have unified standards
11:09:45FromDiscord<salt rock lamp> https://wiki.archlinux.org/title/XDG_user_directories
11:09:59FromDiscord<Phil> Maybe there are desktop portals for that kind of thing
11:10:05FromDiscord<mratsim> In reply to @salt rock lamp "xdg-user-dirs maybe, or something": yes this one
11:10:36FromDiscord<mratsim> In reply to @isofruit "Sounds neat personally. It's": I unified all programming lang on COBOL
11:11:31FromDiscord<Phil> The name of a directory where you put stuff is not at all comparable to the way you speak overall language to do things
11:11:34FromDiscord<mratsim> standards are there for easing collaboration. But user directories are personal? what's the point.
11:12:38FromDiscord<Phil> Providing sane defaults, e.g. to first look in a dir where a user would have images for any image manipulation software
11:13:00FromDiscord<Phil> Sure you can always ask the user during initial setup to specify directories, but sane defaults are nice
11:13:41FromDiscord<Phil> Sorry, that sentence was bad:↵"Providing sane defaults, e.g. for image manipulation software to first look for images in the dir a user would normally have images in"
11:14:13FromDiscord<bigcatnova> whats the nim equivalent to pythons `"yes" if something else "no"`
11:14:37FromDiscord<bigcatnova> (edit) "whats the nim equivalent to pythons `"yes" if something else "no"` ... " added "in string formatting"
11:14:40FromDiscord<nnsee> the point of the XDG user dir standard is that it's customizable - you can set env vars pointing to wherever you actually keep your documents, pictures, etc and applications which respect the xdg standard go looking for things there instead of the "defaults"
11:14:42FromDiscord<Phil> `if somebool: <stuff> else: <otherstuff>`
11:15:20FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:16:11FromDiscord<Phil> For usage in what python calls fstrings, nim got similarly working strformat with the fmt and & macros for inserting values into strings
11:16:16FromDiscord<bigcatnova> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:17:03FromDiscord<bigcatnova> https://media.discordapp.net/attachments/371759389889003532/1194600788220203068/Code_7tLTyi9V4l.png?ex=65b0f1ae&is=659e7cae&hm=a6fa1a925543df8879a5856870ec1246783d36ee546bc647388d881633eb88dc&
11:23:53FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:25:19FromDiscord<bigcatnova> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:29:17*flouer_ quit (Remote host closed the connection)
11:34:00*azimut joined #nim
12:14:19*rockcavera joined #nim
13:13:24NimEventerNew thread by lim1999: Custom constructors, see https://forum.nim-lang.org/t/10863
13:22:19FromDiscord<xtrayambak> In reply to @nnsee "linux and windows generally": I'm pretty sure the freedesktop spec ensures that there is one, on compliant distros, atleast
13:28:46FromDiscord<nnsee> In reply to @xtrayambak "I'm pretty sure the": nope, see https://discord.com/channels/371759389889003530/371759389889003532/1194600188547969094
13:30:20FromDiscord<nnsee> sent a code paste, see https://play.nim-lang.org/#ix=html>
13:30:44FromDiscord<nnsee> (edit)
14:02:53FromDiscord<fosster> guys, can anyone help me with creating nim bindings for a library?
14:04:40FromDiscord<Phil> Oof, c++ bindings I really can't help, never done that.↵I barely know how to manually wrap C
14:05:01FromDiscord<Phil> Generally regarding bindings I just blindly point in the direction of futhark and looking at what they provide
14:08:33FromDiscord<fosster> what is futhark?
14:08:52FromDiscord<Phil> Futhark is a project by PMunch about generating C-bindings 😅
14:09:31FromDiscord<fosster> i'm not having difficulties with bindings for classes and functions, but i just can't seem to bind the `[]` index function
14:09:41FromDiscord<Phil> Ther eare users on the discord side of things, though I only recall @jmgomez that did C++ bindings (I think).↵So potentially they might have decent sources to learn from there.
14:09:48FromDiscord<fosster> i'll check it out, hoping that it helps \:(↵(@Phil)
14:09:54FromDiscord<Phil> (edit) "Ther eare users on the discord side of things, though I only recall @jmgomez that did ... C++" added "bindings for" | removed "bindings"
14:10:28FromDiscord<Phil> (edit) "Ther eare users on the discord side of things, though I only recall @jmgomez that did bindings for C++ ... (I" added "projects"
14:12:17FromDiscord<nnsee> In reply to @fosster "guys, can anyone help": don't ask to ask, just ask. what issue are you having specifically?
14:12:26FromDiscord<fosster> unfortunately futhark doesn't seem to support c++ libs
14:14:24FromDiscord<fosster> basically i'm writing bindings for a c++ audio synthesis library called "stk", so far i've succesfully ported some classes and methods, but now i need to be able to use the index function to index an element inside the `StkFrames` type, which is like a vector of `StkFloat`s↵(@nnsee)
14:15:52FromDiscord<fosster> so far i've binded `StkFramesIterator {.importcpp: "stk::StkFrames::operator", header: "stk/Stk.h".} = object` to import the iterator (even though I think this is the problem) and `proc '[]'(self: StkFrames, index: csize_t): StkFloat {.importcpp: "#", header: "stk/Stk.h".}` to bind the index function
14:17:26FromDiscord<nnsee> you probably want `[]`, not '[]'
14:17:39FromDiscord<nnsee> if the bridge mangles it, backticks and not apostrophes
14:18:28FromDiscord<fosster> sent a code paste, see https://play.nim-lang.org/#ix=html>
14:19:51FromDiscord<fosster> i know i just placed the apostrophe insted of backticks to not fuck up the format for the message↵(@nnsee)
14:22:53FromDiscord<nnsee> i think your importcpp should be `#[#]`, no?
14:23:22FromDiscord<fosster> Untitled.png https://media.discordapp.net/attachments/371759389889003532/1194647676361396325/Untitled.png?ex=65b11d59&is=659ea859&hm=f63d91a8ec309bd2b03b16203538327499f9517f7422cb685b5e92fb57f2f0f3&
14:25:01FromDiscord<fosster> oh, after doing so i got rid of the error but when i iter on it i get `()`
14:25:25FromDiscord<nnsee> iirc iterators are a bit more complex to wrap
14:25:52FromDiscord<nnsee> but i don't know enough cpp to be helpful here
14:26:25FromDiscord<fosster> maybe should i create a `$` proc to correctly display `StkFloat`?
14:26:37*wheatengineer joined #nim
14:26:52FromDiscord<fosster> seems quite hard to do c++ bindings
14:36:05FromDiscord<demotomohiro> @fosster, there are example code to import c++ functions in Nim manual:↵https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-procs
14:38:07FromDiscord<demotomohiro> See `dictLookup` proc in example code to import `operator[]` in C++.
14:50:55FromDiscord<fosster> thank you for the hint
14:50:57FromDiscord<MDuardo> Anyone could get the Nim TreeSitter to work on Neovim?↵↵(I don't want to use Emacs)
14:57:03FromDiscord<leorize> you'll have to bug astronvim maintainer to update their commit
14:58:56FromDiscord<MDuardo> He's still on vacation
15:00:07FromDiscord<MDuardo> Well, I have to use Helix for now
15:05:29FromDiscord<leorize> you can probably override the commit yourself or use some other base configs \:p
15:06:31FromDiscord<fosster> guys, how can i represent a void raw pointer in nim?
15:07:15FromDiscord<sOkam! 🫐> In reply to @fosster "guys, how can i": 99% of the time you don't. you would use `ref` instead
15:07:41FromDiscord<sOkam! 🫐> only reason to use raw pointers (or any other unsafe memory access) is for C interop
15:07:45FromDiscord<Phil> The context is likely c++ bindings, they might not own that memory
15:07:51FromDiscord<fosster> but what if i wanted
15:07:56FromDiscord<sOkam! 🫐> that said, you have `pointer`
15:08:27FromDiscord<sOkam! 🫐> pointer is untyped, so its double unsafe
15:08:42FromDiscord<sOkam! 🫐> normally you use `ref` or `ptr Type`
15:08:43FromDiscord<Phil> I mean you can do `ptr <YourType>`
15:08:47FromDiscord<Phil> Dang, too slow
15:10:09FromDiscord<fosster> thanks, yes i'm still struggling with bindings \:(
15:10:36FromDiscord<Phil> I mean, what you're doing isn't necessarily of the easy variety.↵There's a reason very few languages actually have anything even remotely approaching C++ bindings
15:10:47FromDiscord<kiloneie> sent a long message, see <!doctype html>
15:11:28FromDiscord<Phil> Time for Super-PMunch?
15:11:34FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=html>
15:11:59FromDiscord<demotomohiro> When you wrap C/C++ function like `foo(void ptr)`, you can write `proc foo(ptr: pointer) {.importc.}`.
15:12:09FromDiscord<Phil> Oh? Importc also works for c++?
15:12:23*lucasta joined #nim
15:12:41FromDiscord<demotomohiro> Use `importcpp` for c++.
15:12:45FromDiscord<Phil> Ah, check
15:13:02FromDiscord<Phil> But given they appear to be similar that regard, I can provide pointers for the simpler aspects of it then at least
15:13:22FromDiscord<kiloneie> How do you wrap a C func if you made it like this:↵`declspec( dllexport ) int sum(int a, int b)` for compiling it as a DLL ?
15:13:47FromDiscord<leorize> just `proc sum(a, b: cint) {.importc.}` would do
15:14:07FromDiscord<kiloneie> it's not working...
15:14:25FromDiscord<kiloneie> i have 1x version from ages ago working, but this one doesn't want to
15:14:31FromDiscord<leorize> the declspec and stuff is just windows magic to mark the proc as accessible from the outside where as linux just make everything visible by default
15:15:18FromDiscord<leorize> you'll need some error messages because "doesn't want to" is not helpful \:p↵(@kiloneie)
15:15:57FromDiscord<demotomohiro> In reply to @kiloneie "How do you wrap": If that function is exported from C DLL and call it from Nim code:↵https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-import
15:15:57FromDiscord<kiloneie> `proc sum(a, b: cint) {.importc.}↵↵let c = sum(1, 2) #no idea...` this is what i did at first
15:16:16FromDiscord<fosster> i know, but i don't think there is much choice↵(@Phil)
15:18:51*xet7 quit (Remote host closed the connection)
15:24:37FromDiscord<kiloneie> my eye sight is -7.50, -7.75, but in coding it's like - 50
15:24:49FromDiscord<kiloneie> : cint was missing
15:24:54FromDiscord<kiloneie> after the proc
15:25:00FromDiscord<kiloneie> before importc pragma
15:26:59FromDiscord<kiloneie> and this `{.compile: "cSharedLibrary.c".}`
15:27:21FromDiscord<Phil (he/him)> sent a long message, see <!doctype html>
15:28:48FromDiscord<kiloneie> i don't understand though how {.compile: "logic.c".} made function not from logic.c to work... both worked the same...
15:28:52FromDiscord<leorize> do you have a trace?
15:29:33FromDiscord<fosster> a way to bind c++ structs?
15:30:42FromDiscord<Phil (he/him)> tsan.txt https://media.discordapp.net/attachments/371759389889003532/1194664623039852685/tsan.txt?ex=65b12d21&is=659eb821&hm=637c0110daf3a37f407b9b66e964d61c720cec9b8b3d6bc6590750817f1c4a78&
15:30:43FromDiscord<Phil (he/him)> Sure, for reference I set "doSleep" in there to "false" for now.
15:31:49FromDiscord<leorize> are you using d\:useMalloc?
15:32:05FromDiscord<Phil> Oh god damnit this isn't my own test-suite
15:32:08FromDiscord<Phil> No I didn't
15:32:14FromDiscord<Phil> 🤦
15:32:19FromDiscord<leorize> yea the stdlib allocator is not threadsafe
15:32:21FromDiscord<leorize> now you know
15:32:41FromDiscord<Phil> Hey, that brings me down 1 warning out of 3
15:33:18FromDiscord<Phil> Now it's complaining about the 2 destructors racing
15:33:26FromDiscord<Phil> Next stacktrace incoming, one sec
15:35:19FromDiscord<Phil (he/him)> It's a data race between 2 destructors
15:35:19FromDiscord<Phil (he/him)> Sadly the stacktraces don't really tell you where those destructor calls originate from
15:35:19FromDiscord<Phil (he/him)> But I assume one of them is Thread A and the other Thread B
15:35:20FromDiscord<Phil (he/him)> Which is... odd
15:35:20FromDiscord<Phil (he/him)> tsan.txt https://media.discordapp.net/attachments/371759389889003532/1194665786917261362/tsan.txt?ex=65b12e37&is=659eb937&hm=d058613091bf22c81a75b621246b9ae6b72658783bfde91373c2c15dab5186b2&
15:35:20FromDiscord<Phil (he/him)> Compiled with `nim r --path:"." --gc:arc --threads:on -d:useMalloc --cc:clang --debugger:native --passc:"-fsanitize=thread -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" --passl:"-fsanitize=thread -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" tests/tsmartptrsleak.nim` btw.
15:36:52FromDiscord<leorize> it literally said threadA and threadB in the traces so I'm not sure what you mean
15:38:31FromDiscord<Phil (he/him)> ... I have learned to ignore the first bit of the stacktracen and only stare at line-numbers, it appears I need to unlearn that
15:38:31FromDiscord<leorize> anyhow, this race is a little annoying to handle and I'm surprised that asan doesn't jump on you first
15:38:31FromDiscord<Phil (he/him)> I started with tsan on threading and don't plan to introduce asan with this PR specifically
15:38:33FromDiscord<Phil (he/him)> With this PR I only want to sneak Tsan into the pipeline.↵↵I'll try to push in asan with a separate PR down the line
15:39:10FromDiscord<Phil (he/him)> Because that'll need a bit of a rework of the general test-suite so that it re-reruns with multiple sanitizers, I'll need agreement with everyone involved that that's desireable yada yada yada
15:39:35FromDiscord<Phil (he/him)> Just thought the easy thing to do right now is first step, sneak in tsan.↵Second step, neak in asan as well and maybe more sans
15:40:47FromDiscord<leorize> this is an UAF at it's core
15:40:48FromDiscord<leorize> use-after-free
15:40:50FromDiscord<Phil (he/him)> Is it? The atomic should catch it I thought
15:40:50FromDiscord<Phil (he/him)> Oh wait, the atomic is in the freed memory
15:40:50FromDiscord<Phil (he/him)> Errr
15:40:51FromDiscord<Phil (he/him)> Well... nil check doesn't really do shit there either
15:40:52FromDiscord<leorize> well the nil is per-thread so...
15:41:12FromDiscord<leorize> maybe you should try reading some c++ shared\_ptr impl and see if you can fix this one \:p
15:41:14FromDiscord<Phil (he/him)> Yeah , one thread will have an un-nil'd thingy which is the issue
15:41:45FromDiscord<Phil (he/him)> Doesn't... that kinda mean smartptrs have a uaf problem already in their very principle?
15:41:58FromDiscord<leorize> in this implementation, yes
15:42:31FromDiscord<Phil (he/him)> Err... any quick fixes that don't mean I need to learn how to implement decent smartptrs?
15:42:43FromDiscord<leorize> just don't run tsan on it \:p
15:42:55FromDiscord<leorize> you know that you can have file-specific nim.cfg right?
15:43:08FromDiscord<Phil (he/him)> Not an option, then my primary goal of continuously proving correctness of what I want is not going to work (channels)
15:43:37FromDiscord<leorize> any fix would require learning how they should be implemented, unfortunately
15:44:00FromDiscord<Phil (he/him)> Crap, so it's not just an implementation but a conceptual problem?↵Gnaaa
15:44:02FromDiscord<leorize> I haven't learnt that either so I can't help you rn
15:44:27FromDiscord<Phil (he/him)> I'll look into file specific nim.cfg then
15:45:58FromDiscord<kiloneie> sent a long message, see <!doctype html>
15:46:11FromDiscord<leorize> no
15:46:30FromDiscord<leorize> `importc` doesn't do anything for them without `header` anyways
15:46:37FromDiscord<leorize> all you have to do is to make sure that the layout is the same
15:47:26FromDiscord<kiloneie> so i can get rid of importc pragma in it ?
15:48:20FromDiscord<Phil (he/him)> Waaaait a minute
15:49:51FromDiscord<kiloneie> wait, it actually crashed if i had importc in the struct
15:49:54FromDiscord<kiloneie> now it doesn't...
15:51:05FromDiscord<kiloneie> sent a long message, see <!doctype html>
15:51:28FromDiscord<leorize> it's not
15:51:29FromDiscord<kiloneie> with the function, i don't give it the body, so if it works, i know it's pulled from C, but here...
15:51:34FromDiscord<leorize> export on struct does absolutely nothing
15:51:45FromDiscord<kiloneie> ah
15:51:55FromDiscord<leorize> struct is a type, a way to interpret a bunch of bytes, it doesn't exist beyond your code
15:52:01FromDiscord<Phil> I think I understand more fundamentally the problem.↵It would be a non issue if the smartptrs were a locked datastructure I guess
15:52:32FromDiscord<kiloneie> i read that a long time ago, yeh that makes sense
15:52:34FromDiscord<Phil> Actually no, wait, wtf, that data race should be impossible, I change my opinion
15:53:16FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
15:53:22FromDiscord<Phil> One must happen after the other because that shit is atomic
15:53:36FromDiscord<Phil> They can not both get fetchSub == 0 to be true
15:54:01FromDiscord<leorize> they don't have to
15:54:09FromDiscord<leorize> the problem is the `fetchSub` itself
15:54:13FromDiscord<Phil> So that can't possibly race... ah shit unless the other thread already deallocated the entire pointer before the first even gets to fetchsub
15:54:36FromDiscord<leorize> it can't do that \:P
15:54:59FromDiscord<Phil> What, why wouldn't it be able to do that?
15:55:18FromDiscord<leorize> because if both of them hasn't hit the fetchsub, there's no way the count is `0`
15:55:45FromDiscord<leorize> the issue is that `fetchSub` is an atomic write
15:55:49FromDiscord<leorize> but `free` is not
15:55:53*lucasta quit (Read error: Connection reset by peer)
15:55:54FromDiscord<leorize> so the ordering is undefined
15:56:10FromDiscord<Phil> So what, change the entire thing to fence?
15:56:29FromDiscord<Phil> ~~I feel so smart to know about these modes after the atomic weapons talk~~
15:57:22FromDiscord<Phil> But yeah, basically, you'd need to be able to check "are you still allocated"
15:57:24FromDiscord<Phil> Which you kinda can't
15:58:11FromDiscord<Phil> You can check for "are you nil" but in the timeframe between passing that if and reaching the counter your ass might still get deallocated
15:58:27FromDiscord<Phil> (edit) "You can check for "are you nil" but in the timeframe between passing that if and reaching ... thethe" added "for" | "forthe counter your ass might still get ... deallocated" added "the pointer"
15:58:44FromDiscord<kiloneie> i don't really understand your code, but shouldn't you try to display the count somewhere to debug ?
15:58:56FromDiscord<Phil> This is less about explicit values
15:59:06FromDiscord<Phil> And more about "are there constellations that are problematic"
15:59:29FromDiscord<Phil> As in, where 2 threads might be running this code, a few CPU instructions apart, and a thing happening on one causes a segfault or the like in the other
16:00:08FromDiscord<leorize> this one might be an FP tbf
16:00:12FromDiscord<Phil> FP?
16:00:17FromDiscord<Phil> False positive
16:00:22FromDiscord<Phil> I mean, I'm not sure
16:01:09FromDiscord<Phil> As stated, both might get past the first if.↵One might already be past the second if and have deallocated the SharedPtr while the second is just about to reach the second if and tries p.val.counter when p.val just got deallocated
16:01:09FromDiscord<kiloneie> can you get id of a thread ?
16:01:13FromDiscord<Phil> getThreadId()
16:01:37FromDiscord<leorize> it's impossible for that to happen↵(@Phil)
16:02:00FromDiscord<kiloneie> idk i would just have both threads output their id to a separate file and go from there D:
16:02:40FromDiscord<Phil> In reply to @leorize "it's impossible for that": Is the amount of instructions between the two ifs so low that one can not get past the second if and have already deallocated before the second thread has gotten past the first and performed the second if?
16:03:08FromDiscord<leorize> because you can't deallocate if there's still at least one owner
16:03:23FromDiscord<leorize> that's what the refcount is for
16:03:31FromDiscord<leorize> you can't get 0 without being the last owner
16:04:02FromDiscord<Phil> ... right, my entire example was based upon both threads running decr with counter being value 1, which is impossible
16:04:05*wheatengineer quit (Remote host closed the connection)
16:04:18FromDiscord<Phil> hmmm
16:05:22FromDiscord<leorize> you can try the "slow" approach of changing fetchsub to sequentially consistent mode
16:06:52FromDiscord<Phil> Literally kills all tsan messages instantly
16:07:18FromDiscord<Phil> Well, not all, but the ones I was looking at
16:07:19FromDiscord<leorize> looks like `Release` is incorrect then
16:07:27FromDiscord<leorize> atomics are scary
16:07:57FromDiscord<leorize> https://en.cppreference.com/w/cpp/atomic/memory_order \<- you can try deciphering this
16:10:52FromDiscord<leorize> could still be a FP fwiw
16:13:23FromDiscord<Phil> I'd like to play around with using different mo's here
16:13:44FromDiscord<Phil> But the second I choose one I get told it doesn't compile, only Relaxed is somehow available, which seems wrong because the enum should be moRelaxed
16:14:10FromDiscord<kiloneie> sent a long message, see <!doctype html>
16:15:24FromDiscord<Phil> ... threading has its own atomics
16:15:30FromDiscord<Phil> Yeah no wonder
16:15:45FromDiscord<Phil> (edit) "Yeah no wonder ... " added "none of the enums match xD"
16:18:10FromDiscord<gogolxdong666> why the same type and value string doesn't equal == 0x6b2b16df7e6bedaa4d5b88e85348d44654a45838
16:18:47FromDiscord<gogolxdong666> https://media.discordapp.net/attachments/371759389889003532/1194676724428980386/image.png?ex=65b13867&is=659ec367&hm=cde81992bfc8eb10eaf7c06f9bdad117a5f7ebd8b8d4b4814bf4b5a26b99384e&
16:19:35FromDiscord<gogolxdong666> version 2.0.3
16:19:51FromDiscord<leorize> i'm reading more into this and I think I might require a few PhDs to figure it out
16:20:12FromDiscord<leorize> nim does not compare strings by its pointer↵(@gogolxdong666)
16:20:12FromDiscord<Phil> In that case I trust in tsan more than myself
16:20:57Amun-Ragogolxdong666: why one is uppercase and the second is lowercase?
16:21:14Amun-Raoh, sorry, first one is mixedcase ;)
16:21:19FromDiscord<leorize> Phil\: you can see if `AcquireRelease` works
16:21:26FromDiscord<Phil> Already done so, it does
16:22:04*azimut quit (Remote host closed the connection)
16:22:33FromDiscord<leorize> you could stick to that instead, it's "lighter"
16:22:43*azimut joined #nim
16:22:47FromDiscord<leorize> but might require testing on ARM
16:22:57FromDiscord<nnsee> @Phil I think I remember you saying you use prologue - how do you "return early" from a HandlerAsync? If I do a plain `return`, it complains about `Future[system.void]` not being a `HandlerAsync` (even though I can clearly see that's exactly what it is https://planety.github.io/prologue/plugin/core/context.html#HandlerAsync)
16:23:25FromDiscord<Phil> Give me a sec, writing a github PR comment that requries focus
16:23:33FromDiscord<nnsee> sure, sorry to bother
16:23:43FromDiscord<Phil> In reply to @leorize "but might require testing": Luckily the pipeline already has ARM in it
16:24:05Amun-RaI can bother anyone w/o feeling sorry (if anyone need that) ;)
16:24:10FromDiscord<Phil> Windows amd fails =/
16:24:27Amun-RaPhil: you wrote "fails" two times
16:24:32Amun-RaI'll see myself out
16:24:38FromDiscord<Phil> Welp, blows up for windows on all platforms
16:24:48FromDiscord<Phil> Both linux and macos take it like a champ
16:26:39Amun-Rahave you tried to cross-compile on linux with mingw and rerun on the os?
16:27:52FromDiscord<Phil> `clangclangclangclang: : : : error: unsupported option '-fsanitize=thread' for target 'x86_64-pc-windows-msvc'`↵↵OH FUCKING SHOOT ME
16:28:19FromDiscord<odexine> clang be hitting a pipe with a wrench at the start of that error message
16:28:38FromDiscord<Phil> Errr
16:28:48FromDiscord<Phil> Is this the time where I have to figure out how to add tsan to linux but not to windows?
16:29:24Amun-Rais *san on windows a thing either way?
16:30:33FromDiscord<Phil (he/him)> Oh god I can deal with data races but github pipeline configs give me migraines
16:30:48FromDiscord<odexine> In reply to @Amun-Ra "is *san on windows": asan is
16:31:00Amun-Rathanks
16:31:03FromDiscord<odexine> In reply to @Phil (he/him) "Oh god I can": who thought yaml as a programming language was a good idea
16:31:12FromDiscord<odexine> asan on msvc at least is a thing iirc
16:31:14Amun-Ra;>
16:31:18FromDiscord<odexine> not sure on other compilers
16:31:25FromDiscord<Phil (he/him)> Sure but that's for later, right now it's tsan all the way
16:31:42FromDiscord<Phil (he/him)> Does nim.cfg do when blocks?
16:31:50FromDiscord<odexine> iirc its a different syntax
16:31:56FromDiscord<odexine> i forgot what exactly
16:32:04FromDiscord<leorize> it's `@if windows ... @end`
16:32:23FromDiscord<Phil (he/him)> Well more "if not windows" would be the check
16:33:02FromDiscord<leorize> you can look at it
16:33:03FromDiscord<leorize> the nim.cfg shipped with the compiler have a bunch of those
16:36:04*zgasma joined #nim
17:48:19FromDiscord<Phil> Check and done
17:54:22FromDiscord<Phil> ... the heck
17:54:37FromDiscord<Phil> I have tests that fail on windows i386 and ONLY there
17:54:57FromDiscord<Phil> Everybody else is chill, but not windows
17:55:05FromDiscord<Phil> (edit) "Everybody else is chill, but not windows ... " added "i386"
18:07:30FromDiscord<leorize> if you give me the error I can help
18:08:35FromDiscord<Phil (he/him)> Turns out windows i386 does not like clang for reasons, does not fail when I remove --cc\:clang for windows.Failure here\:↵↵https://github.com/nim-lang/threading/actions/runs/7478815691/job/20354606772
18:09:03FromDiscord<Phil (he/him)> > Pointer size mismatch between Nim and C/C++ backend. You probably need to setup the backend compiler for target CPU.D\:\\a\\threading\\threading\\nim\\lib\\nimbase.h↵I don't really understand what that means
18:09:33FromDiscord<Phil (he/him)> Wait, is i386 32 bit and nim assumes 64bit pointers on clang by default and that's whats blowing up?
18:09:54FromDiscord<Phil (he/him)> ` D:\a\threading\threading\nim\lib\nimbase.hD:\a\threading\threading\nim\lib\nimbase.hnote: expression evaluates to '4 == 8':538:30: note: expression evaluates to '4 == 8'`↵↵Oh god damnit
18:11:07FromDiscord<leorize> the problem is that clang is 64bit
18:11:24FromDiscord<leorize> 32bit windows is "simulated" by using a 32bit gcc
18:11:28FromDiscord<Phil (he/him)> sent a code paste, see https://play.nim-lang.org/#ix=html>
18:11:59FromDiscord<leorize> you'd need to convince clang to build in 32bit mode on windows i386 \:p
18:12:12FromDiscord<leorize> pretty much just add `-m32` to build flags
18:13:14FromDiscord<Phil (he/him)> sent a code paste, see https://play.nim-lang.org/#ix=html>
18:13:42FromDiscord<Phil (he/him)> Well, if windows-i386 but not sure how that flag works
18:14:59FromDiscord<leorize> `@if windows and i386`
18:21:12FromDiscord<Phil> Alright, looking good so far
18:21:17FromDiscord<Phil> First victory!
18:21:30FromDiscord<Phil> Aaaaand we're golden! Clang for everybody!
18:25:48*noeontheend joined #nim
18:26:22*mronetwo joined #nim
18:29:52*mhcat joined #nim
18:32:29*adigitoleo joined #nim
18:41:29FromDiscord<leorize> is it green now?
18:41:41FromDiscord<Phil> Rolling in green
18:42:17FromDiscord<leorize> congrats on solving your first threading adventure
18:42:38FromDiscord<Phil> That depends on the changes getting accepted
18:42:58FromDiscord<leorize> they'll be accepted one way or another \:P
18:43:07FromDiscord<Phil> But yeah, first steps and so on. Thank you so much for explainers btw.
18:43:16FromDiscord<Phil> That managed to get me a first solid basis
18:43:26FromDiscord<Phil> That an Zevv force-feeding me the atomic weapons talk
18:45:36FromDiscord<Phil> In reply to @leorize "they'll be accepted one": Assume I'm slow, because I am
18:46:09FromDiscord<Phil> Particularly while sickly my social perceptiveness takes a nose-dive
18:52:50*TheLink left #nim (Bye!)
20:38:40*hernan quit (Ping timeout: 245 seconds)
20:40:27*hernan joined #nim
20:45:35*systemdsucks quit (Ping timeout: 264 seconds)
20:47:00*systemdsucks joined #nim
20:47:45FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=html>
20:48:28FromDiscord<user2m> (edit)
21:02:17FromDiscord<pengwyns> Is it possible to get the nimble dir (.nimble/pkgs2/ specifically) in a normal nim app?
21:06:18FromDiscord<pengwyns> Nvm, I found out its just getHomeDir + "/.nimble"
21:15:33*xet7 joined #nim
21:25:46FromDiscord<leorize> via `it`, that is
21:25:48FromDiscord<leorize> you can use `let it {.inject.} = req` in the template to let the body access `req`↵(@user2m)
21:34:26*pbsds quit (Quit: The Lounge - https://thelounge.chat)
21:35:51*pbsds joined #nim
21:54:28*casaca joined #nim
21:55:08*oddish quit (Changing host)
21:55:08*oddish joined #nim
21:55:53FromDiscord<user2m> In reply to @leorize "you can use `let": No way!! I can't believe that works!
21:57:44FromDiscord<leorize> it's the stuff behind sequtils \It templates
21:58:22FromDiscord<nnsee> huh, neat
22:00:48FromDiscord<user2m> love it
22:36:56*jjido joined #nim
22:53:52FromDiscord<MDuardo> Is there an alternative way of using `stdout.write`?I know you can do↵`stdin.readLine` -\> `readLine(stdin)`But haven't found an alternate for \`stdout.write"↵I like the parenthesis
22:54:40FromDiscord<MDuardo> Is there an alternative way of using `stdout.write`?I know you can do↵`stdin.readLine` -\> `readLine(stdin)`↵But haven't found an alternate for `stdout.write`↵I like the parenthesis
22:55:05FromDiscord<nnsee> you can use the exact same syntax
22:55:20FromDiscord<nnsee> write(stdout, whatever)
22:55:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:55:28FromDiscord<Elegantbeef> Works just fine
22:55:44FromDiscord<Elegantbeef> You also can do `stdout.write("hello, " world")`
22:56:08FromDiscord<nnsee> the first argument can always be moved in front of the proc call
22:56:22FromDiscord<nnsee> regardless of how many arguments the proc takes
22:59:43FromDiscord<MDuardo> Thank you guys, it was a little different than I expected
23:05:15*advesperacit quit ()
23:10:14*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
23:18:26*zgasma quit (Quit: Lost terminal)
23:24:20FromDiscord<hlsee> sent a long message, see <!doctype html>
23:26:29FromDiscord<hlsee> sent a code paste, see https://play.nim-lang.org/#ix=html>
23:27:09FromDiscord<hlsee> Thank you in advance in case I miss the chance to respond
23:27:42FromDiscord<hlsee> sent a code paste, see https://play.nim-lang.org/#ix=html>