<< 01-05-2024 >>

00:00:46FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=EISVsVHzFNLR
00:06:04FromDiscord<Elegantbeef> Overloads
00:06:22FromDiscord<Robyn [She/Her]> ~~Converters 👀~~
00:06:47FromDiscord<Robyn [She/Her]> (edit) "~~Converters 👀~~ ... " added "(jk, converters are bad ideas)"
00:07:01FromDiscord<Robyn [She/Her]> (edit) "~~Converters 👀~~ (jk, converters are ... badidea)" added "a" | "ideas)" => "idea)"
00:07:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=nXEFKvjLbYbP
00:07:36FromDiscord<Elegantbeef> Using a converter for `some` is the most cancerous converter ever, I love it!
00:07:56FromDiscord<Elegantbeef> `10.get()` completely valid and not unhinged whatsoever
00:11:01FromDiscord<Robyn [She/Her]> Totally sane
00:18:30*KhazAkar quit (Ping timeout: 252 seconds)
00:18:55*KhazAkar joined #nim
00:54:10FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=QVXhNemoIVcX
00:54:55FromDiscord<Elegantbeef> lame aint the word for it
00:55:55*def- quit (Quit: -)
00:57:39FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=JSZACBSzfCdu
00:57:46FromDiscord<Robyn [She/Her]> Time to break out concepts lmao
00:58:07*def- joined #nim
00:59:31FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=srIaXtqFTdEw
01:00:00FromDiscord<Elegantbeef> The issue is that any type that has `.get` will fire that
01:00:33FromDiscord<polylokh_39446> yep, I still don't know of a non-lame way to restrict this to `Option[T]`
01:01:03*def- quit (Client Quit)
01:01:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=YoriZylleRxb
01:01:37FromDiscord<Elegantbeef> Or `typ[0].eqIdent "Option"`
01:02:50FromDiscord<polylokh_39446> awesome, ty.
01:03:16FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=bmQKUbSWFHMO
01:05:33FromDiscord<polylokh_39446> but to the original question, you probably want something like the builder pattern, and boring use of optionals
01:07:54FromDiscord<Elegantbeef> Or just use overloads if more applicable
01:13:33FromDiscord<amarevite> sent a code paste, see https://play.nim-lang.org/#pasty=DxIAnaDWjPkR
01:16:33FromDiscord<polylokh_39446> jumping to macros is the easiest way to do that.
01:17:58FromDiscord<amarevite> in that case can you give me a minimal example of iterating a proc's input variables from inside the proc
01:18:04FromDiscord<polylokh_39446> with the builder pattern - i.e., instead of having all these parameters, have them as fields of an object, and work with the object - you could use fieldPairs to iterate over them
01:18:05FromDiscord<amarevite> (edit) "in that case can you give me a minimal example of iterating ... a" added "over"
01:18:07FromDiscord<Elegantbeef> You don't need macros
01:18:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=NHneNvULPgDu
01:37:23*def- joined #nim
01:45:25FromDiscord<amarevite> if the proc has a return type, `locals().fields` includes that as the last item↵which means i get a segfault (i assume because im trying echo a variable that doesnt exist yet)↵i tried appending `[0..^2]` but thats not working
01:45:41FromDiscord<amarevite> (edit) "if the proc has a return type, `locals().fields` includes that as the last item↵which means i get a segfault (i assume because im trying ... echo" added "to"
01:46:05FromDiscord<Elegantbeef> `for name, field in locals().fieldPairs: when name != "result": ....`
01:47:56FromDiscord<Elegantbeef> Tuples cannot be sliced which is why `[0..^2]` did not work
01:49:15FromDiscord<new_librarian> where should i put the mingw64
01:49:15FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=AFmPCiyNatUb
01:51:07FromDiscord<Elegantbeef> Why not `when field is Option`?
01:53:08FromDiscord<polylokh_39446> no reason except that I didn't know that worked
01:54:38*def- quit (Quit: -)
01:55:10*def- joined #nim
02:00:57*KhazAkar quit (Read error: Connection reset by peer)
02:02:24FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=ArUKjToaTuIV
02:02:58*def- quit (Quit: -)
02:04:01*def- joined #nim
02:11:46FromDiscord<amarevite> sent a code paste, see https://play.nim-lang.org/#pasty=IedyEiXBrUGH
02:13:09FromDiscord<amarevite> im trying implement the BoolorNothing idea from (this forum comment)[<https://forum.nim-lang.org/t/3124#:~:text=And%20a%20more%20Nim%2Dspecific%20way%2C%20with%20generics%20and%20static%20branching%2C%20no%20run%2Dtime%20overhead%20exc.%20file%20size%3A>]
02:13:26FromDiscord<amarevite> oh i swapped the parenthese and brackets my bad
02:13:33FromDiscord<amarevite> (edit) "(this" => "[this" | "comment)[<https://forum.nim-lang.org/t/3124#:~:text=And%20a%20more%20Nim%2Dspecific%20way%2C%20with%20generics%20and%20static%20branching%2C%20no%20run%2Dtime%20overhead%20exc.%20file%20size%3A>]" => "comment](<https://forum.nim-lang.org/t/3124#:~:text=And%20a%20more%20Nim%2Dspecific%20way%2C%20with%20generics%20and%20static%20branching%2C%20no%20run%2Dtime%20overhead%20exc.%20file%20size%3A>)"
02:16:29FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=UIOPZUMkRyMq
02:17:12FromDiscord<polylokh_39446> (edit) "https://play.nim-lang.org/#pasty=FsbccIJFAAYT" => "https://play.nim-lang.org/#pasty=ObPULyDqcaOq"
02:18:30FromDiscord<polylokh_39446> you need that workaround, if you want it to be possible for the 'or' to resolve differently for different arguments
02:19:20FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=qjLrZInhCVcP
02:20:18FromDiscord<amarevite> i dont recognize the syntax youre using with that proc↵what are the backets before the parentheses doing?↵what is that even called so i can look at the docs and learn about it?
02:20:52FromDiscord<polylokh_39446> 'or' makes the proc implicitly generic. The brackets make it explciitly generic and name what it's generic over. With that syntax, it's generic over A and B, which are both BoolOrNothing
02:21:43FromDiscord<polylokh_39446> it's introduced early in <https://nim-lang.org/docs/manual.html#generics>
02:22:42FromDiscord<polylokh_39446> the implicit 'or' generics have the limitation that BoolOrNothing can't resolve to bool for one param and EmptyType for another
02:23:46FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=NqHnkjyFgqfe
02:30:35FromDiscord<polylokh_39446> it's still a compiler bug that that fails the way it does
02:40:03*def- quit (Quit: -)
02:40:59*def- joined #nim
02:44:07FromDiscord<amarevite> sent a code paste, see https://play.nim-lang.org/#pasty=rNplOcEIlBqK
02:44:40*def- quit (Client Quit)
02:45:36FromDiscord<amarevite> i would like to be able to turn that `paramsBuilder` `locals().fieldPairs` thing into a proc I can call so I can reuse it more easily, but i struggled with getting that to work
02:47:11*def- joined #nim
02:50:11*def- quit (Client Quit)
02:50:54*def- joined #nim
02:57:21FromDiscord<Elegantbeef> Or you just do `distinct BoolOrNothing`
02:59:47FromDiscord<Elegantbeef> \Which is why distinct TypeClass\` exists
03:00:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=CQXgmRNfdSbv
03:02:09FromDiscord<Elegantbeef> `paramBuilder.buildShiz(locales())`
03:02:20FromDiscord<Elegantbeef> where `proc buildShiz(buffer: string, data: tuple)`
03:03:07FromDiscord<Elegantbeef> `var string`\
03:07:16FromDiscord<Elegantbeef> Can also just turn it into a template
03:45:50*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
03:46:16*SchweinDeBurg joined #nim
03:50:15*def- quit (Quit: -)
03:50:34*def- joined #nim
03:55:18FromDiscord<amarevite> sent a code paste, see https://play.nim-lang.org/#pasty=VhBwRsRSCNOQ
03:56:13FromDiscord<Elegantbeef> `result.add name & "=" & $field`
03:56:23FromDiscord<Elegantbeef> Using format for simple formatting is silliness
03:57:40FromDiscord<Elegantbeef> PS there is `?` inside `std/uri` that takes in `(string, string)` and appends it to your code
03:58:06FromDiscord<Elegantbeef> so it'd be like `parseUri(serverAddress & "/Users).query(locals().paramsBuilder())`
03:58:17FromDiscord<Elegantbeef> Whoops
03:58:29FromDiscord<Elegantbeef> `parseUri(serverAddress & "/Users) ? locals().paramsBuilder()`
03:58:34FromDiscord<Elegantbeef> My brain filled the gap
03:59:57FromDiscord<amarevite> using `fmt()` was more of a consistency/readability thing but that works, thank you↵and i didnt know about `?` ill give that a try
04:03:12FromDiscord<amarevite> it's not working and i dont care enough to figure out what syntax im getting wrong but i might end up using that in the future, thank you
04:03:30FromDiscord<Elegantbeef> you need to emit `seq[(string, string)]` and import `uri`
04:09:01FromDiscord<amarevite> alright if `paramsBuilder()` returns a `(string, string)` tuple, `let endpoint:string = $(serverAddress.parseUri / "Users" ? locals().paramsBuilder)` works
04:11:36FromDiscord<amarevite> i dont have a stray `?` at the end of the url when there are no optional parameters set, but i find it much harder to read
04:35:24*def- quit (Quit: -)
04:36:32*def- joined #nim
04:40:42*def- quit (Client Quit)
04:42:34*def- joined #nim
05:49:32*coldfeet joined #nim
05:51:16*ntat joined #nim
05:57:56*def- quit (Quit: -)
05:58:33*def- joined #nim
07:00:39*lucerne quit (Ping timeout: 260 seconds)
07:04:55FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=ibUZlDeWkYcS
07:06:35FromDiscord<xkonti> In other words I want all implementations of the abstractions (separate libraries) to execute those tests on themselves. Implementations could be OsFs, InMemoryFs, SftpFs, S3Fs, etc.
07:08:02FromDiscord<Elegantbeef> You want an external library to depend on your test architecture?
07:08:45FromDiscord<Elegantbeef> In the case of Nimble that means you want to have a `testAparatus` file then just have a template or proc that you call from an external library
07:11:22FromDiscord<xkonti> Yes. Think of it in a way of a set of tests that ensure that the implementation of the abstraction is correct. Library author doesn't need to write it themselves, they just use what's provided in the library they already depend on.
07:11:40FromDiscord<Elegantbeef> Make a proc or template that takes a `FileSystem`
07:11:55FromDiscord<Elegantbeef> Put it inside your `src` file
07:11:55FromDiscord<Elegantbeef> folder\
07:12:29FromDiscord<Elegantbeef> then someone can do `tests/tosfs.nim` in their project and do `import filesystems/testaparatus; test(newOsFs())`
07:16:41FromDiscord<xkonti> That's awesome! For some reason I thought that test suites won't be valid if I won't "include" but simply "import". Thank you again @ElegantBeef , you seem to never sleep!
07:17:00FromDiscord<Elegantbeef> No I just don't have a life
07:17:44*om3ga joined #nim
07:24:19*def- quit (Quit: -)
07:24:53*def- joined #nim
07:33:40FromDiscord<Phil> sent a long message, see https://pasty.ee/kBUJyESVzDpQ
07:34:14FromDiscord<Phil> (edit) "https://pasty.ee/iwxBwfWoiSNB" => "https://pasty.ee/IPNvNEKuHhxQ"
07:35:25FromDiscord<Phil> The problem is that Cold Observable shouldn't really contain a value. It should contain a callback function that gets executed for a given observer when it subscribes.
07:35:53FromDiscord<Phil> (edit) "subscribes." => "subscribes and emits values captured in the callback function to that observer."
07:37:08*lucerne joined #nim
07:41:34FromDiscord<Phil> sent a long message, see https://pasty.ee/saNFaiQriCUX
07:41:43FromDiscord<Phil> (edit) "https://pasty.ee/QkpLQkktvaRm" => "https://pasty.ee/wWmermoBVFqr"
07:42:22FromDiscord<Phil> (edit) "https://pasty.ee/ufSwsuDNuHfM" => "https://pasty.ee/hSexzEQKFYAE"
07:45:17*redj_ quit (Ping timeout: 240 seconds)
07:46:02*redj joined #nim
08:08:15FromDiscord<Elegantbeef> @Phil have you written out a small demo with what was working to showcase the issue?
08:08:35FromDiscord<Elegantbeef> I read your words but given my lack of knowledge with RX I just scratch my head and go balder
08:14:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=tkShdpIbFXtx
08:15:26FromDiscord<Elegantbeef> The expected output is what?
08:16:08*def- quit (Quit: -)
08:16:58*def- joined #nim
08:17:45FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=VYGGAcWfDUVK
08:19:03FromDiscord<Elegantbeef> Huh
08:19:32FromDiscord<Phil> And there are ways around that I think, but they seem ugly as hell
08:19:54FromDiscord<Phil> Like implementing 2 "forward" procs or some shit and storing weird amounts of observers left and right
08:20:20FromDiscord<Elegantbeef> I'm so lost at how this works 😄
08:21:07FromDiscord<Phil> Its "push" mechanisms as opposed to "pull".↵That's why reactive programming is a fairly different paradigm and breaks your brain a bit when you wrap your head around it.
08:21:16FromDiscord<Phil> (edit) "Its "push" mechanisms as opposed to "pull".↵That's why reactive programming is a fairly different paradigm and breaks your brain a bit when you ... wrap" added "first"
08:21:21*def- quit (Client Quit)
08:21:59FromDiscord<Elegantbeef> Well afaict it's just a stack of procedures
08:22:04FromDiscord<Phil> Its not "I need X, so I fetch from data", it is "data changes, so it informs everybody that it is and calls their callbacks that they registered with the individual piece of data, keeping them automatically in sync"
08:22:34FromDiscord<Elegantbeef> You add a procedure in the stack then all children get an event when a value changes
08:22:36FromDiscord<Phil> Yes but also more than that.↵Because you sometimes want to call the entire stack of procedures and sometimes you don't.
08:23:03*def- joined #nim
08:23:33FromDiscord<Phil> And there's 2 stacks: The stack of Observers and their callbacks (e.g. Observer1 and the observer that MapObservable will have registered with cold Observable), and the stack of procs that manipulate the piece of data (in this case that's just the map proc from MapObservable)
08:23:44FromDiscord<Phil> (edit) "and" => "with"
08:24:38*redj quit (Quit: No Ping reply in 180 seconds.)
08:25:11FromDiscord<Elegantbeef> So in the above example you push a value into cold or map?
08:25:25FromDiscord<Phil> In reply to @Elegantbeef "You add a procedure": Yes, that is true but only for Subjects where the value can actually change (Hot observable).↵In a cold observable the data that can be sent kind of already is known ahead of time.
08:25:46FromDiscord<Elegantbeef> Like in above the subscription causes a call to be made down the chain
08:26:02FromDiscord<Phil> In reply to @Elegantbeef "So in the above": The data exists in cold observable and it is the only source of data.↵Even when somebody subscribes to map observable, it itself does not hold data. It fetches data from the cold observable, transforms it and forwards that to the subscriber/observer
08:26:09FromDiscord<Elegantbeef> So it turns into `echo "Observable": map(map(map(5)))`
08:26:10*redj joined #nim
08:27:13FromDiscord<Phil> More: "Observer1: 5"↵"Observer2: anonymousMapProc(5)"↵"Observer3: anonymousMapProc(5)"
08:27:40FromDiscord<Phil> The "problem" with cold observables is just that they emit all their values on subscribes, which hot observables don't do because they don't contain data that way
08:27:59FromDiscord<Phil> But the subscribe should trigger only value emission to the one thing that subscribed and to nobody else
08:28:32FromDiscord<Phil> So if Observer3 subscribes, the process should be that only it receives transformed values from cold observable, nobody else does because they already subscribed and got their values
08:28:46*def- quit (Quit: -)
08:29:22*def- joined #nim
08:30:31FromDiscord<Elegantbeef> So in the case the of `next` it pushes `1` to what?
08:30:46FromDiscord<Elegantbeef> You omitted all of the plumbing
08:41:12FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=KFsujoxMusoc
08:41:48FromDiscord<Phil> The problem is that this behaviour for hot observables is undesired for cold observables.↵Where I want the same behaviour but only for one single observer
08:43:58FromDiscord<Phil> sent a long message, see https://pasty.ee/WbmsCxpXkXvu
08:44:32FromDiscord<Phil> (edit) "sent" => "Meanwhile the above (which is the Observer for the mapObservable onto the cold observable) will trigger everything always for all observers:↵- `onSourceCompletion` triggers the complete callback on all observers of the map observable↵- `onSourceError` already makes it visible that it forwards errors from source to all observers on the map-observable↵- `mapSubscription` uses the `forward` proc which forwards the value
08:46:45FromDiscord<Phil> I guess the solution would be that on subscribe of an observer to mapObservable, mapObservable creates on-the-fly a new "mapObserver" that is only there to forward values to the first observer
08:47:00FromDiscord<Elegantbeef> I was more saying that you left out the how the first example related to the second 😛
08:47:05FromDiscord<Phil> The entire hot vs cold observable dichotomy is murdering me
08:52:37FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=wSJIpCLNmEEE
08:53:01FromDiscord<Phil> Or rather you need to tell your parent observable "give me the values"; which in turn needs to tell its parent "Give me the values" etc. until you hit the cold root observable
08:53:26FromDiscord<Phil> And then only emit the values back to that one specific child that asked for values
08:53:34FromDiscord<Elegantbeef> Lol you still missed my point
08:53:48FromDiscord<Elegantbeef> Write the desired code using example A and B
08:53:58FromDiscord<Phil> Not really, it's just really fucking hard to explain
08:54:03FromDiscord<Elegantbeef> Plumb A into B
08:54:08FromDiscord<Elegantbeef> I don't want you to explain
08:54:13FromDiscord<Elegantbeef> I want to see the desired code
08:55:13FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=lqgkewaXwDmT
08:55:34FromDiscord<Elegantbeef> Thank you 😄
08:57:39FromDiscord<Elegantbeef> Much clearer how it's working
08:58:01FromDiscord<Elegantbeef> Or rather how it's supposed to work
09:09:04*def- quit (Quit: -)
09:09:59*def- joined #nim
09:14:20FromDiscord<nocturn9x> In reply to @juancarlospaco "looks like a realloc": well yeah but
09:14:23FromDiscord<nocturn9x> it's internal nim stuff
09:14:28FromDiscord<nocturn9x> how am I supposed to fix that lol
09:15:34*def- quit (Quit: -)
09:15:55*def- joined #nim
09:17:42FromDiscord<nocturn9x> I've tried several options
09:17:54FromDiscord<nocturn9x> `--mm:atomicArc` as well as `-d:useMalloc`ù
09:17:56FromDiscord<nocturn9x> (edit) "`-d:useMalloc`ù" => "`-d:useMalloc`"
09:18:00FromDiscord<nocturn9x> nothing seems to fix it
09:18:10FromDiscord<nocturn9x> it seems like a bug related to passing refs to another thread
09:20:09FromDiscord<nocturn9x> I'm trying to see if `--mm:boehm` works better
09:27:48FromDiscord<nocturn9x> that seems to have fixed it
09:30:41FromDiscord<ieltan> In reply to @nocturn9x "it seems like a": I think you can't pass refs to another threads unless you use something like `isolate` iirc
09:32:35FromDiscord<ieltan> But I've heard it's a pretty limited mechanism. Gotta go C++ style and use raw pointers or `SmartPtr[T]`
09:33:49FromDiscord<Phil> Hmmmm constructing single-use observers on the fly for that one occurrence at the end of the observable might be the way to go
09:34:01FromDiscord<Phil> At least I can vaguely imagine that approach
09:35:31NimEventerNew thread by take1234: Unicode operators / Arrays, which size is know at run time, see https://forum.nim-lang.org/t/11526
09:36:30FromDiscord<nocturn9x> In reply to @ieltan "I think you can't": huh
09:41:08FromDiscord<ieltan> the issue with threading in Nim is that it has been finally "nailed down" just very recently and there isnt many uptodate ressources on what you can do and cannot do with them right now
09:41:19FromDiscord<nocturn9x> yeah anyway it crashed again
09:41:25FromDiscord<nocturn9x> this is _so_ annoying
09:41:43FromDiscord<nocturn9x> it makes me kinda regret I learned nim :P
09:42:37FromDiscord<ieltan> fwiw, those are the "official" libraries to use for threads ↵https://github.com/nim-lang/threading↵https://github.com/Araq/malebolgia
09:42:51FromDiscord<nocturn9x> malebolgia is borked lol
09:43:10FromDiscord<ieltan> rip lol
09:43:25FromDiscord<nocturn9x> and the documentation for threading is just the API reference
09:43:38FromDiscord<ieltan> In reply to @nocturn9x "it makes me kinda": well this certaintly doesn't bode well for me as i'll need to use thread soon in my library
09:44:09FromDiscord<nocturn9x> can someone provide a simple example of sending off a function to a worker thread with shared references
09:44:22FromDiscord<nocturn9x> an example that works and isn't outdated and doesn't randomly crash for no reason
09:44:50FromDiscord<nocturn9x> the whole damn point of threads is to have shared state, otherwise I'd be spawning a process. The very idea of a thread-local heap is so stupid
09:45:57FromDiscord<nocturn9x> also afaik malebolgia implements SC, but I don't _need_ SC
09:46:09FromDiscord<nocturn9x> I need a separate worker thread that does something, prints to stdout and then exits
09:46:30FromDiscord<nocturn9x> I don't even care about the result or if it crashes. If it crashes, it crashed, too bad
09:57:54FromDiscord<odexine> what have you tried so far
09:58:08FromDiscord<odexine> iirc you will have to use sharedptr (threading/smartptrs)
09:58:36FromDiscord<nocturn9x> how do I make one?
09:58:49FromDiscord<nocturn9x> I have tried several things
09:59:21FromDiscord<nocturn9x> sent a long message, see https://pasty.ee/XMgITnSHAhMT
10:02:14FromDiscord<odexine> when you create the shared data, you first `isolate` it (std/isolation), then directly pass that isolated data into `newSharedPtr` (std/threading/smartptrs), i think
10:02:59FromDiscord<odexine> this data would be the non-ref version of what you want to share, so the direct data and not a ref
10:03:24FromDiscord<odexine> i dont have threading experience so im not too sure
10:18:28*xet7 quit (Ping timeout: 246 seconds)
10:18:34FromDiscord<nocturn9x> I need both the main thread and the worker thread to access the reference though
10:19:00FromDiscord<nocturn9x> there is a boolean variable and an `Atomic[bool]` object that needs to be shared
10:24:10FromDiscord<odexine> In reply to @nocturn9x "I need both the": they would share this access via the same sharedptr
10:26:45FromDiscord<nocturn9x> so
10:27:25FromDiscord<odexine> i dont know the behaviour of this mechanism with atomics
10:28:06FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=cqCEsSFLfoRB
10:28:14FromDiscord<nocturn9x> or should I initialize it as a shared ptr to begin with
10:29:40FromDiscord<odexine> i would say to begin with
10:30:20*deadmarshal_ quit (Ping timeout: 268 seconds)
10:34:19FromDiscord<nocturn9x> okay
10:34:33FromDiscord<nocturn9x> so I won't need to wrap the `SearchManager` in an `Atomic[T]`?
10:35:15FromDiscord<odexine> im sorry i really dont know the behaviour of this with atomics
10:35:53FromDiscord<nocturn9x> where do I import `SharedPtr` from?
10:35:59FromDiscord<nocturn9x> `std/threading` doesn't seem to exist
10:36:03FromDiscord<nocturn9x> In reply to @odexine "im sorry i really": no problem
10:36:54FromDiscord<nocturn9x> https://github.com/henryas/nptr?
10:41:22FromDiscord<odexine> In reply to @nocturn9x "`std/threading` doesn't seem to": hm i think this is something to be installed first
10:41:30FromDiscord<odexine> so not std/threading but just threading/
10:41:42FromDiscord<odexine> my bad i forgot
10:41:58FromDiscord<odexine> basically install this as a package in nimble https://github.com/nim-lang/threading
10:42:59FromDiscord<nocturn9x> so I should turn my entire `UCISession` into a shared ptr
10:43:09FromDiscord<nocturn9x> should `UCISession` be a value type instead of a ref then?
10:43:50FromDiscord<nocturn9x> I don't undertand how `Isolated` fits into this
10:43:52FromDiscord<odexine> if youre making it a shared ptr, i guess it should? maybe smth like UCISessionObj = object... then UCISession = SharedPtr[UCISessionObj[
10:43:54FromDiscord<odexine> (edit) "SharedPtr[UCISessionObj[" => "SharedPtr[UCISessionObj]"
10:43:56FromDiscord<nocturn9x> how do I get the value out?
10:44:23FromDiscord<odexine> deref the ptr `[]`
10:44:40FromDiscord<odexine> you can get a mut/immut version
10:44:51FromDiscord<odexine> mutable VIEW
10:45:09FromDiscord<nocturn9x> so `session: SharedPtr[Isolated[UCISession]]`?
10:45:13FromDiscord<odexine> no
10:45:16FromDiscord<odexine> remove the isolated
10:45:22FromDiscord<nocturn9x> oke
10:45:23FromDiscord<odexine> the isolated part is only needed to construct the sharedptr
10:45:29FromDiscord<odexine> its not part of the type
10:45:49*FromDiscord quit (Remote host closed the connection)
10:46:03*FromDiscord joined #nim
10:46:17FromDiscord<nocturn9x> gotcha
10:48:13FromDiscord<nocturn9x> how do I initialize it tho
10:48:34FromDiscord<nocturn9x> do I just construct the value type, then isolate it and pass it to newSharedPtr?
10:48:56*def- quit (Quit: -)
10:49:21FromDiscord<odexine> yes
10:49:28FromDiscord<odexine> i believe so yes
10:49:31*def- joined #nim
10:50:00FromDiscord<nocturn9x> but `isolate` wants a `sink T`
10:50:02FromDiscord<nocturn9x> whatever that means
10:50:30FromDiscord<odexine> means you should not use that value type again after isolating
10:51:27FromDiscord<nocturn9x> okay, how do I make something into a `sink T` then
10:51:50FromDiscord<ieltan> it's supposed to be automatic
10:51:52FromDiscord<odexine> simply dont use it again after
10:51:53FromDiscord<odexine> yes
10:52:05FromDiscord<nocturn9x> `expression cannot be isolated`
10:52:29FromDiscord<odexine> does your data type have references
10:52:34FromDiscord<nocturn9x> yes, many
10:52:40FromDiscord<nocturn9x> that's kind of the point
10:53:14FromDiscord<ieltan> Remember what I said about isolated being limited lol
10:53:24FromDiscord<odexine> you cannot have references when youre isolating data
10:53:29FromDiscord<odexine> at all
10:53:33FromDiscord<odexine> anywhere
10:53:40FromDiscord<nocturn9x> it would be nice if the language implemented something that works instead of something that is only theoretical
10:53:54FromDiscord<odexine> "works" depends on the person
10:54:02FromDiscord<nocturn9x> no, "works" is a universal definition
10:54:11FromDiscord<odexine> i dont think so
10:54:16FromDiscord<nocturn9x> you do what all the other sane languages do and it works
10:54:24FromDiscord<nocturn9x> if it doesn't, your solution _does not work_
10:54:31FromDiscord<odexine> sane is again dependent on the person
10:55:00FromDiscord<nocturn9x> we can talk about type safety and data race prevention all day
10:55:04FromDiscord<nocturn9x> but people don't write code in a lab
10:55:07FromDiscord<nocturn9x> they do so in the real world
10:55:11FromDiscord<nocturn9x> and the real world is sometimes dirty
10:55:17FromDiscord<nocturn9x> so not supporting that means being broken
10:55:19FromDiscord<nocturn9x> by definition
10:55:30FromDiscord<nocturn9x> languages are tools that are supposed to adapt to the users, not the other way around.
10:55:34FromDiscord<odexine> please provide such definition's source
10:55:47FromDiscord<nocturn9x> check out this thing called common sense
10:55:50FromDiscord<nocturn9x> it might amaze you
10:55:50FromDiscord<nocturn9x> lol
10:55:52FromDiscord<solitudesf> In reply to @nocturn9x "languages are tools that": adapt it then
10:55:57FromDiscord<odexine> In reply to @nocturn9x "check out this thing": common sense is clearly not found where you are
10:56:04FromDiscord<nocturn9x> In reply to @solitudesf "adapt it then": why do you think I'm working on my own language rofl
10:56:23FromDiscord<odexine> please tell us when you solve your threading problem in such language
10:56:57FromDiscord<nocturn9x> will do lol
10:56:59FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#pasty=YTqQpdKwCMre
10:57:11FromDiscord<nocturn9x> that isn't the problem
10:57:20FromDiscord<nocturn9x> the problem is that `YourDataType` has refs
10:57:23FromDiscord<nocturn9x> inside
10:57:28FromDiscord<nocturn9x> so it cannot be isolated, apparently
10:58:05FromDiscord<ieltan> welp rip pepperoni
10:58:06FromDiscord<nocturn9x> I tried that and it still fails to compile
10:58:12FromDiscord<nocturn9x> so 🤷
10:58:33FromDiscord<odexine> nim supports message passing better versus the shared memory model
10:58:50FromDiscord<odexine> different languages have differing approaches to ideas
10:58:52FromDiscord<nocturn9x> I need shared ownership
10:59:21FromDiscord<nocturn9x> I don't make the rules, the UCI spec does, and to implement the `stop` command I need some way of telling my search to stop, which means it has to go in another thread
10:59:41FromDiscord<nocturn9x> the fact nim doesn't support the literal most basic use case of that is astonishing
10:59:57FromDiscord<odexine> ...i would say this can be easily implemented with message passing
11:01:32FromDiscord<nocturn9x> yes of course let me refactor my code because nim is opinionated about how threads should work (except they don't)
11:01:54FromDiscord<nocturn9x> building abstraction is one thing, but let me do "unsafe" things if I want to without breaking things
11:02:03FromDiscord<nocturn9x> but nope, apparently nim is too good for that, lol
11:02:05FromDiscord<odexine> if you want
11:02:13FromDiscord<odexine> i believe you can create a more raw shared pointer
11:02:25FromDiscord<nocturn9x> I've tried several things
11:02:27FromDiscord<odexine> https://nim-lang.org/docs/system.html#createShared%2Ctypedesc
11:02:34FromDiscord<nocturn9x> let's see if this works
11:03:05FromDiscord<odexine> chuck the type in, set the val with `varname[] = value`, deref is `[]` as is before
11:03:53FromDiscord<odexine> basically `var myptr = createShared(MyType); myptr[] = myvaluetype #[type == MyType]#`
11:04:03FromDiscord<odexine> this needs to be freed like in C
11:04:20FromDiscord<odexine> no isolated shit whatnot
11:05:24FromDiscord<nocturn9x> that looks like what I need
11:05:51FromDiscord<nocturn9x> can `MyType` hold `ref`s?
11:05:55FromDiscord<odexine> congrats, hope this is good enough, sorry about the common sense comment
11:05:58FromDiscord<odexine> In reply to @nocturn9x "can `MyType` hold `ref`s?": literally anything
11:06:02FromDiscord<nocturn9x> good
11:06:02FromDiscord<odexine> no restrictions at all
11:06:14FromDiscord<nocturn9x> In reply to @odexine "congrats, hope this is": it's okay, I'm a bit frustrated
11:06:34FromDiscord<nocturn9x> it's annoying enough to fight with a problem, but when the tooling you're using gets in the way it becomes extra annoying
11:06:43FromDiscord<odexine> any segfaults and null derefs at this point would prolly be your error since the compiler doesnt analyse anything
11:06:58FromDiscord<ieltan> I guess though accessing the refs from other thread will still subject you to some issues
11:07:10FromDiscord<odexine> In reply to @ieltan "I guess though accessing": i think this might be a problem too yes
11:07:20FromDiscord<odexine> the refs inside the type would still be local
11:07:31FromDiscord<nocturn9x> _pain_
11:07:33FromDiscord<odexine> so i think all refs need to be ptrised
11:07:36FromDiscord<ieltan> Yeh
11:07:58FromDiscord<odexine> in which case why not just use the isolated thing? SharedPtrs are isolated compatible
11:07:59FromDiscord<ieltan> I was gonna say you'll drop the ref altogether for ptr
11:08:10FromDiscord<ieltan> So you'll be refactoring anyways
11:08:17FromDiscord<odexine> i dont think this is too big of a refactor
11:08:22FromDiscord<odexine> compared to message passing anyways
11:08:30FromDiscord<ieltan> True
11:08:37FromDiscord<nocturn9x> I suppose if it's gonna be a refactoring either way
11:08:42FromDiscord<nocturn9x> might as well use the higher level abstraction
11:09:04FromDiscord<nocturn9x> so I should just use `SharedPtr` everywhere instead of `ref`?
11:09:22FromDiscord<odexine> i think so, yes
11:09:46FromDiscord<nocturn9x> I can probably do away with another thing actually
11:09:55FromDiscord<nocturn9x> if I keep all the refs local to one thread
11:10:00FromDiscord<nocturn9x> that could work
11:10:03FromDiscord<nocturn9x> the main thread doesn't need them anyway
11:10:35*def- quit (Quit: -)
11:12:09*def- joined #nim
11:28:08*beholders_eye joined #nim
11:29:39*def- quit (Quit: -)
11:29:58*def- joined #nim
11:37:21*deadmarshal_ joined #nim
11:49:01FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=KhfAsScPefaX
11:51:36FromDiscord<ezquerra> In reply to @mratsim "are you using the": @mratsim, I am looking at speeding up the convolve proc in arraymancer and I remember this old reply of yours. Can you share an example of how to enable `omp simd` when using `omp_parallel_blocks`? I couldn't find any examples on the arraymancer codebase. Probably I did not search for the right thing...
11:54:11*nyeaa49284230101 quit (Quit: The Lounge - https://thelounge.chat)
11:56:17*nyeaa49284230101 joined #nim
12:01:07FromDiscord<nocturn9x> In reply to @nocturn9x "the main thread doesn't": jk it does
12:01:14FromDiscord<nocturn9x> ugh this is so freaking annoying
12:51:15*def- quit (Quit: -)
13:10:11*def- joined #nim
13:43:58*beholders_eye quit (Ping timeout: 268 seconds)
14:03:02FromDiscord<Phil> @ElegantBeef I just did it. It screwed me up a little bit, but my entire test-suite still runs and the new tests do as well
14:03:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=pAmOdZzkpcKj
14:09:52*gst joined #nim
14:12:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=WPglZjsoQroC
14:15:24gstis there a way to unordered enum?
14:34:43FromDiscord<Phil> I am not familiar with the term I'll admit. You can do hole-y enums, you can define the number values explicitly
14:34:54FromDiscord<Phil> (edit) "I am not familiar with the term I'll admit. You can do hole-y enums, you can define the number values ... explicitly" added "for a given enum-value"
14:35:12*lucasta joined #nim
14:39:31FromDiscord<odexine> enums are always ordinal
14:39:49FromDiscord<odexine> not sure what you mean by unordered, i dont understand the benefits to having one be unordered
14:40:04gsthole enums are supported yes and I am using them, my problem is that currently nim requires that the values are ordered incrementally
14:40:22gstunordered I mean for example, x = 1, then y = 0
14:41:37gstmy usecase is protocol implementation, it is much nicer to keep the names in the order of the documentation regardless of the values
14:42:28FromDiscord<odexine> i dont think so
14:42:40FromDiscord<odexine> i think nim should allow it for when all values are specified but it doesnt so
14:43:40gsthttps://play.nim-lang.org/#pasty=NsXVDYjOvkjz
14:45:38gstodexine, I agree, I think it should be possible as, when all values are specified, the order requirement is useless and changes nothing to the result. but currently it fails.
14:46:08FromDiscord<odexine> should check if there is an issue filed, see any discussion
14:46:09gstI was wondering if there is a pragma or some trick around this.
14:47:03gstthis is the closest I found, https://github.com/nim-lang/Nim/issues/1043, it was not fixed.
14:50:37FromDiscord<odexine> same, when i searched
14:50:45FromDiscord<odexine> seems like no one has raised another issue
15:05:19*def- quit (Quit: -)
15:05:41*def- joined #nim
15:19:25FromDiscord<z3ntl3> abc
15:19:57FromDiscord<z3ntl3> 🫡
16:51:04*def- quit (Quit: -)
16:52:21*coldfeet quit (Remote host closed the connection)
16:53:40*def- joined #nim
16:56:42*def- quit (Client Quit)
16:58:43*def- joined #nim
17:16:36*krux02 joined #nim
17:20:58*progranner joined #nim
17:28:06*xet7 joined #nim
18:04:56*KhazAkar joined #nim
18:26:50*def- quit (Quit: -)
18:27:35*def- joined #nim
18:31:18*def- quit (Client Quit)
18:33:29FromDiscord<nocturn9x> are `Atomic`s references?
18:33:50FromDiscord<nocturn9x> still trying to debug the issue with ARC and threads
18:33:52FromDiscord<nocturn9x> to no avail
18:34:27*def- joined #nim
18:37:58FromDiscord<nocturn9x> the question I have is why is it segfaulting in danger/release mode and not in debug mode?
18:39:06FromDiscord<Phil> In reply to @nocturn9x "are `Atomic`s references?": I don't think they are, at least from my time staring at the threading package and making it free of data-races I don't recall that being a requirement