<< 04-05-2024 >>

00:06:45FromDiscord<user2m> Is there an easy way to schedule a proc to execute at a later date and time?
00:10:38FromDiscord<polylokh_39446> if you're using async, there's addTimer that you could call with a calculated timeout
00:11:41FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=UrNwtzpEZQdQ
00:13:49*def- quit (Quit: -)
00:25:05FromDiscord<leorize> it's all atomic and you can't turn that off↵(@bosinski2023)
00:28:30*gst quit (Ping timeout: 250 seconds)
00:33:36*def- joined #nim
00:50:33FromDiscord<threefour> In reply to @user2m "Is there an easy": Make it a server and have cron make a request to it? Or a standalone binary that is executed by cron. Unless you specifically want it contained within a single Nim program.
00:54:17*def- quit (Quit: -)
00:54:44*def- joined #nim
00:59:32*def- quit (Client Quit)
01:00:22*def- joined #nim
01:07:40*def- quit (Quit: -)
01:25:16*def- joined #nim
01:44:16*def- quit (Quit: -)
01:44:59*def- joined #nim
02:02:18NimEventerNew Nimble package! nimsrvstat - A nim wrapper around mcsrvstat, see https://github.com/Minejerik/nimsrvstat
02:06:36FromDiscord<sharpcdf> what nim extension should i use for vscode? the nim-lang.org one doesnt show autocomplete for anything that isnt builtin even though i have the language server installed
02:45:57FromDiscord<_nenc> I think this one https://marketplace.visualstudio.com/items?itemName=NimLang.nimlang
02:46:01FromDiscord<_nenc> by nimsaem
02:47:29FromDiscord<_nenc> @sharpcdf
02:50:23FromDiscord<Elegantbeef> It's suggested to use the official one now
03:08:24FromDiscord<zumi.dxy> the tons of false "cannot evaluate at compile time" errors in my IDE make me sad
03:16:17*def- quit (Quit: -)
03:16:48*def- joined #nim
03:28:26*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
03:28:48*SchweinDeBurg joined #nim
03:30:09*cnx quit (*.net *.split)
03:30:10*deadmarshal_ quit (*.net *.split)
03:30:10*Jjp137 quit (*.net *.split)
03:35:32*deadmarshal_ joined #nim
04:37:01FromDiscord<nikolay_a_k> sent a long message, see https://pasty.ee/jkVWHbgZaJwM
04:39:43FromDiscord<polylokh_39446> neat. I've got llama.cpp built, but didn't know there was such a simple API for it.
04:51:42*cnx joined #nim
04:51:48*Jjp137 joined #nim
04:55:00*def- quit (Quit: -)
05:12:59*def- joined #nim
05:14:23FromDiscord<Phil> Aaaaaand I'll have to implement async in rex simply because otherwise I can't implement the take operator
05:15:41FromDiscord<Phil> In reply to @nikolay_a_k "I managed to create": Cool to see! I'm still rather prone to declarative approaches, but this works nicely as well
05:17:24*def- quit (Client Quit)
05:18:08*def- joined #nim
05:49:09*def- quit (Quit: -)
05:49:27*def- joined #nim
05:57:32FromDiscord<odexine> In reply to @isofruit "Aaaaaand I'll have to": Well that was a requirement in the first place
05:57:36FromDiscord<odexine> Also I saw your ping yes
06:05:16FromDiscord<nocturn9x> okay so
06:05:28FromDiscord<nocturn9x> since my threading issues are related to sharing references across threads
06:06:02FromDiscord<nocturn9x> is there any way I could set an `Atomic[bool]` in one thread from the main thread without sharing references
06:06:20FromDiscord<nocturn9x> or, more generally, is there a safe way I can tell the other thread to stop
06:06:24FromDiscord<nocturn9x> channels, maybe?
06:06:49FromDiscord<nocturn9x> that still needs me sharing a reference though, doesn't it? Where else would I store the channel object
06:08:05FromDiscord<nocturn9x> ah, nim by example shows they're usually global variables
06:08:53FromDiscord<Elegantbeef> Pass in a `ptr bool` and just do `while myBool` 😄
06:09:17FromDiscord<Elegantbeef> You can pass a `SharedPtr[Atomic[bool]]` if you want to go crazy
06:09:25FromDiscord<nocturn9x> that doesn't solve the problem
06:09:32FromDiscord<nocturn9x> because I still have a shared reference
06:09:37FromDiscord<Elegantbeef> No
06:09:41FromDiscord<nocturn9x> `SearchManager`
06:09:48FromDiscord<nocturn9x> unless I don't assign it in my thread function
06:09:57FromDiscord<nocturn9x> and just pass it the stop flag
06:10:08FromDiscord<Elegantbeef> Cause `ptr` is not managed
06:13:08FromDiscord<odexine> Reference is a very specific thing in Nim
06:13:18FromDiscord<odexine> Pointers don’t count as a reference
06:13:21FromDiscord<nocturn9x> I also have another shared ref but that can also be turned into a shared ptr
06:13:34FromDiscord<odexine> You shouldn’t turn references into pointers
06:13:41FromDiscord<nocturn9x> no, well
06:13:45FromDiscord<nocturn9x> I'll make it an object
06:13:54FromDiscord<nocturn9x> then allocate it on the heap as a shared ptr
06:13:56FromDiscord<nocturn9x> that was my point
06:16:53FromDiscord<morgan> can a template that takes in varargs of untyped pass all them to a proc that it also took in?
06:17:34FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=gllGXsFxMbWx
06:18:01FromDiscord<morgan> hm wait actually the thing im thinking of wouldn't replace all instances of the pattern, so i might not bother
06:21:42FromDiscord<nocturn9x> In reply to @polylokh_39446 "what's the problem with": nothing, actually
06:22:19FromDiscord<polylokh_39446> seems like it has data races unfortunately, <https://github.com/nim-lang/Nim/issues/23174>
06:22:26FromDiscord<nocturn9x> lol rip
06:22:40FromDiscord<nocturn9x> do send/recv contain races
06:22:52FromDiscord<nocturn9x> ah nvm I can't use them cuz they block
06:22:54FromDiscord<nocturn9x> welp too bad
06:23:01FromDiscord<Elegantbeef> They have a `trySend` variation
06:23:14FromDiscord<Elegantbeef> The data race iirc was due to a "optimisation" attempting to early exit
06:23:17FromDiscord<polylokh_39446> if you're only waiting for a stop signal you can peek for it and then recv
06:23:44FromDiscord<nocturn9x> I'll try with using `SharedPtr` first
06:23:59FromDiscord<nocturn9x> since channels have to be global or passed via `ptr` anyway
06:24:09FromDiscord<polylokh_39446> In reply to @polylokh_39446 "if you're only waiting": provided the channels are unique to the peeking threads
06:26:34FromDiscord<nocturn9x> question
06:26:43FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=WpgcuieGGjvd
06:26:52FromDiscord<nocturn9x> is that the correct way of initializing a shared ptr to the atomic
06:26:58FromDiscord<nocturn9x> will it outlive the constructor?
06:27:02FromDiscord<Elegantbeef> You don't need the `isolate`
06:27:10FromDiscord<nocturn9x> oke
06:27:16FromDiscord<Elegantbeef> isolate is purely for Nim's `ref`
06:27:32FromDiscord<Elegantbeef> `SharedPtr` uses destructors to do the same thing but with an atomic ref counter
06:27:39FromDiscord<nocturn9x> the question I have is
06:27:46FromDiscord<nocturn9x> since `searchFlag` is a local variable
06:27:52FromDiscord<nocturn9x> will the shared ptr keep it alive or nah
06:28:09FromDiscord<Elegantbeef> `newSharedPtr` manages it's own resources
06:28:28FromDiscord<Elegantbeef> It does not take an address to the data
06:28:42FromDiscord<nocturn9x> oh so it allocates a new thing
06:29:00FromDiscord<nocturn9x> oh it needs a type lol whatever then
06:29:09FromDiscord<nocturn9x> just `result.searching = newSharedPtr(Atomic[bool])`
06:30:53FromDiscord<Elegantbeef> `SearchManager(board: board, bestMoveRoot: nullMove(), ....)` is the nicer way of doing what you have there if you care
06:32:21FromDiscord<nocturn9x> hm okay
06:40:53FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=edvqPcQAqCAF
06:40:54FromDiscord<nocturn9x> hmm
06:41:07FromDiscord<nocturn9x> the offending line is `session.transpositionTable[] = newTranspositionTable(session.hashTableSize 1024 1024)`
06:41:20FromDiscord<nocturn9x> it's just a warning, but still concerning
06:43:45FromDiscord<Phil> Okay async is kinda difficult given I can't assume an event-loop
06:43:58*def- quit (Quit: -)
06:44:08FromDiscord<Phil> (edit) "event-loop" => "async-loop"
06:45:05FromDiscord<nocturn9x> the way most Python async libraries do it
06:45:10FromDiscord<nocturn9x> is with a thread-local variable
06:45:17FromDiscord<nocturn9x> I believe it's also what asyncdispatch does
06:45:24*def- joined #nim
06:45:27FromDiscord<Phil> Oh I'm not implementing async
06:45:38FromDiscord<Phil> As in, fundamental async. I'm swapping procs to be async
06:45:46FromDiscord<nocturn9x> oh oke
06:45:48FromDiscord<Phil> For a reactive lib
06:45:55FromDiscord<nocturn9x> keep in mind async can byte ya
06:45:58FromDiscord<nocturn9x> (edit) "byte" => "bite"
06:46:16FromDiscord<nocturn9x> whenever you `await`, be ready for state to be potentially rearranged under your feet
06:46:25FromDiscord<Phil> You're telling that to somebody that wrote an async event-loop to be used by an actor thread, I am aware
06:46:42FromDiscord<nocturn9x> I wrote several event loops and it took me a while to get the SC design right
06:46:55FromDiscord<Phil> It is painful beyond belief, in this case though it's mostly a case of juggling who is async and who returns a subscription and how
06:46:57FromDiscord<nocturn9x> despite having trio as a reference
06:47:50FromDiscord<Phil> Like, rxjs gets away with not returning a promise/future and the like on the basis of an event loop always doing async work in the background
06:48:07FromDiscord<Phil> So you don't have to emit promises/futures that the user can await
06:48:14FromDiscord<Phil> I don't have that luxury
06:48:34FromDiscord<nocturn9x> In reply to @isofruit "Like, rxjs gets away": hmm
06:48:49FromDiscord<nocturn9x> How do you manage async units of work without some sort of awaitable or promise
06:50:47FromDiscord<odexine> observables are an extension of promises
06:54:53*GreaseMonkey quit (Remote host closed the connection)
06:55:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=WdFAeNcXZzng
06:55:55FromDiscord<Phil> While waiting chronos will work through whatever async work it has in the dispatcher, which includes calling callbacks after promises complete etc.
06:55:57FromDiscord<nnsee> In reply to @nocturn9x "whenever you `await`, be": hey man, don't make promises you can't keep
06:56:26FromDiscord<nocturn9x> In reply to @nnsee "hey man, don't make": mfw `promise.cancel()`
06:56:27FromDiscord<odexine> lol
06:56:46FromDiscord<odexine> asyncdispatch actually doesnt have cancellable futures
06:56:49*greaser|q joined #nim
06:56:54FromDiscord<nocturn9x> laaame
06:57:00FromDiscord<odexine> chronos does tho
06:57:04FromDiscord<nocturn9x> async without cancelation is useless
06:57:04FromDiscord<odexine> therefore
06:57:43FromDiscord<Phil> But I can't really conceptualize what parts in this thing to put in promises
06:57:49FromDiscord<Phil> That's my biggest issue atm
06:57:58FromDiscord<odexine> ?>\
06:58:00FromDiscord<odexine> wdym
06:59:21*ntat joined #nim
06:59:30FromDiscord<Phil> What part of the observable is a Future, which procs return futures, how do I set things up if I e.g. want to emit both a future and a non-future value (like subscribe - You might want an "unsubscribe" proc as well as a future to `waitFor`
06:59:50FromDiscord<Phil> (edit) "What part of the observable is a Future, which procs return futures, how do I set things up if I e.g. want to emit both a future and a non-future value (like subscribe - You might want an "unsubscribe" proc as well as a future to `waitFor` ... " added "to execute operations that should be happening when you subscribe"
07:00:45FromDiscord<nocturn9x> more segfaults
07:00:51FromDiscord<nocturn9x> _fucking hell_
07:01:01*def- quit (Quit: -)
07:01:08FromDiscord<odexine> In reply to @isofruit "What part of the": maybe its because i just woke up but im not following
07:01:30*def- joined #nim
07:02:20FromDiscord<odexine> the observable itself is "like a future"
07:02:28FromDiscord<odexine> "which procs return futures"?
07:02:41FromDiscord<odexine> "how do I set things up if I e.g. want to emit both a future and a non-future value (like subscribe - You might want an "unsubscribe" proc as well as a future to waitFor to execute operations that should be happening when you subscribe" ?????
07:02:54FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=AtEYStxwJsdY
07:03:30FromDiscord<Phil> If you want to make this async, well not `subscribeProc` needs to be async because your subscribeProc might include some timeout stuff, like sending a value after 3seconds
07:03:52FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=ppYEpGZTtbEO
07:03:57FromDiscord<odexine> stop there
07:04:12FromDiscord<Phil> (edit) "not" => "now"
07:05:05FromDiscord<odexine> this is kinda why its complicated, since you're mixing asyncdispatch and your reactive library; i can't exactly quote any other libraries but if you had control over the evloop it would probably be simpler to implement
07:05:28FromDiscord<odexine> i'm saying observables are akin to futures, not that you can shoehorn in futures inside an observable
07:05:29FromDiscord<Phil> Not just probably, it would definitely be easier to implement because the user wouldn't need to get Futures
07:05:31FromDiscord<odexine> i dont know how that would work
07:05:46FromDiscord<Phil> They could just do their shit and the event-loop would run eventually
07:05:53FromDiscord<Phil> And I wouldn't need to take care of anything
07:06:36FromDiscord<Phil> But somebody, somewhere needs to waitFor futures
07:06:50FromDiscord<odexine> what
07:08:16FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=aDArgLNKOFTf
07:08:28FromDiscord<Phil> And so far I didn't plan on that somebody being me
07:09:03FromDiscord<odexine> stop using the proc names as a standin for what you're intending
07:09:14FromDiscord<odexine> you mean that somewhere, the evloop has to be running
07:09:56FromDiscord<odexine> yes, that is true; rxjs obviously doesnt have this problem as it is inherent to js that an evloop is running
07:10:54FromDiscord<Phil> Only to a degree. It is not required to have a full blown event-loop, you can manually wait for async-work to be done if the package exposes the Futures to you that arise from your actions, like next returning e.g. a Future[void] that you can waitFor in order to trigger the changes.
07:11:16FromDiscord<Phil> That's why I'm talking about waitFor because that is the only technical necessity, not that you have a while-loop somewhere
07:11:30FromDiscord<Phil> (edit) "That's why I'm talking about waitFor because that is the only technical necessity, not that you have a while-loop somewhere ... " added "that regularly polls for async work"
07:11:33FromDiscord<odexine> now think of hot observable
07:11:35FromDiscord<odexine> (edit) "observable" => "observables"
07:12:01FromDiscord<Phil> I have, next would return also Future[void] as stated
07:12:06FromDiscord<Phil> Or would have to
07:13:01FromDiscord<odexine> what?
07:13:02FromDiscord<odexine> why?
07:13:24FromDiscord<Phil> Because your observers aren't required either to be sync
07:13:34FromDiscord<Phil> (edit) "Because your observers ... aren't" added "`next` callbacks"
07:15:36FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=MxHRpKSiUvhq
07:16:46FromDiscord<Phil> Thus it must return a future that, when you `waitFor` it, triggers completing all the work in your callbacks
07:18:27FromDiscord<odexine> i see
07:23:00*def- quit (Quit: -)
07:23:22*def- joined #nim
07:24:28NimEventerNew thread by pablocael: Passing seq or array to cpp function that takes iterators., see https://forum.nim-lang.org/t/11543
07:36:07*KhazAkar quit (Remote host closed the connection)
07:36:57*KhazAkar joined #nim
07:46:27FromDiscord<nocturn9x> you know what pisses me off
07:46:32FromDiscord<nocturn9x> when I try to debug an issue
07:46:35FromDiscord<nocturn9x> and the issue disappears
07:46:56FromDiscord<nocturn9x> why is the code not segfaulting now that I enabled `--stackTrace --lineTrace`?
07:46:59FromDiscord<nocturn9x> WHO KNOWS
07:46:59FromDiscord<Elegantbeef> Hisenbugs for all!
07:49:03FromDiscord<nnsee> probably missed a load bearing comment somewhere
07:50:16*def- quit (Quit: -)
07:50:20FromDiscord<morgan> ok so im running into an issue with the big template i have for library entrypoint and related code, where it doesn;t seem to like one of the inputs `cannot use symbol of kind 'let' as a 'field'`
07:50:39FromDiscord<morgan> and i tried the dirty pragma
07:50:48FromDiscord<morgan> but it didn't change anything
07:50:49FromDiscord<Elegantbeef> You're using a template parameter for a let statement
07:51:19*def- joined #nim
07:51:36*KhazAkar quit (Ping timeout: 268 seconds)
07:52:53FromDiscord<morgan> i get `cannot use symbol of kind 'var' as a 'field'` when i switch the `let` in and the `let` out of it to `var`
07:53:10FromDiscord<nnsee> post cood
07:53:14FromDiscord<nnsee> code
07:54:20FromDiscord<morgan> <https://www.github.com/morganholly/nim-clap> nimplugin.nim, last section of code
07:54:39FromDiscord<morgan> also i switched all the lets i could find and still nothing
07:55:38*KhazAkar joined #nim
07:56:37FromDiscord<morgan> the error i get from the compiler is `nimplugin.nim(1127, 23) Error: undeclared field: 'mapping='`, which is extra confusing. the line is `plugin.id_map = id_map`, and mapping is the variable in the other file that is passed to the id_map input in the template, but im just very confused
07:57:17FromDiscord<Elegantbeef> The issue isn't the `let`s
07:57:22FromDiscord<Elegantbeef> The issue is using a field for a `let` name
07:58:21FromDiscord<morgan> yet i had the same issue with all var
07:58:26FromDiscord<morgan> tho i think there was a const
07:58:59FromDiscord<morgan> i'm considering seeing if i can convert it into AST and then paste it in with a macro
07:59:14FromDiscord<Elegantbeef> Oh jesus you're using a template for module instantitions
07:59:27FromDiscord<Elegantbeef> Why?
07:59:44FromDiscord<Elegantbeef> Just use generics
07:59:51FromDiscord<morgan> because i don't want the user to have to write that code
08:00:05FromDiscord<Elegantbeef> If you use generics they do not
08:00:13*def- quit (Quit: -)
08:01:00FromDiscord<morgan> i am confused
08:02:09FromDiscord<Elegantbeef> ` proc convert_plugin_descriptor(desc: PluginDesc): ClapPluginDescriptor =` is an issue cause `desc` is bound to whatever you pass in as `desc` to the template
08:02:23FromDiscord<Elegantbeef> Same with `.params`
08:02:39FromDiscord<Elegantbeef> same with all your `desc.`s
08:02:53FromDiscord<Elegantbeef> Just use generics for this instead, your life will be better
08:03:03FromDiscord<Elegantbeef> I helped ayy do the same with their project
08:03:05FromDiscord<morgan> how do i do this with generics
08:03:40FromDiscord<morgan> how do i get user callbacks and other data into this library code
08:04:32FromDiscord<Elegantbeef> `Typedesc.myProcCb` is one way
08:05:03FromDiscord<nocturn9x> this fucking language keeps segfaulting on me
08:05:06FromDiscord<nocturn9x> fuck ARC
08:05:13FromDiscord<nocturn9x> literally
08:06:03FromDiscord<Elegantbeef> @morgan https://github.com/Alkamist/clap/blob/main/clap/plugin.nim
08:06:29FromDiscord<Elegantbeef> Look at all the `pluginInit[T]` and friends
08:07:25FromDiscord<Elegantbeef> You use your own generic procedures which call the underlying type that you instantiated the plugin with
08:07:47FromDiscord<Elegantbeef> This gives you a cleaner approach and does not deal with having to futz around with pointer procs and making sure you pass the arguments in the right order
08:08:37FromDiscord<Elegantbeef> https://github.com/Alkamist/clap/blob/main/clap/types.nim#L76 the entry type is here
08:08:51FromDiscord<Elegantbeef> You then just do `AudioPlugin[MyPluginobject]` iirc
08:09:43FromDiscord<Elegantbeef> But i'm going to go so I hope that explains enough
08:16:30*greaser|q quit (Changing host)
08:16:30*greaser|q joined #nim
08:16:33*greaser|q is now known as GreaseMonkey
08:17:01*KhazAkar quit (Ping timeout: 256 seconds)
08:17:10FromDiscord<Phil> errr question, how do I check if a given proc is an async proc at compiletime?
08:20:03FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=ZxVjidzMpefr
08:20:26FromDiscord<Phil> So I want to allow users to define sync procs and just convert them to async procs on-the-fly to store them in an object that definitely only holds async procs
08:21:54FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=KRkdbNrqHNSi
08:22:15FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=UXswcplJosqu" => "https://play.nim-lang.org/#pasty=WDGUvxdpiZhw"
08:23:29FromDiscord<morgan> In reply to @Elegantbeef "But i'm going to": i’m also headed off, but what’s relevant is their code in public.nim. they’re using a proc that contains the entry point, which i’m guessing gets returned from it. i’ll have to read more in the morning if i remember
08:32:03FromDiscord<nocturn9x> I think `--stackTrace` is just making the code slow enough so that race conditions don't happen
08:32:25FromDiscord<nocturn9x> since now I'm not sharing references across threads, I suppose I'll just use `refc`
08:35:56NimEventerNew thread by Isofruit: Can I check if a proc is async at compileTime without a macro?, see https://forum.nim-lang.org/t/11544
08:40:22*KhazAkar joined #nim
08:40:56*def- joined #nim
08:46:47FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=vBruiLpHNRbL
08:47:01FromDiscord<nocturn9x> can ANY of nim's memory management strategies not fucking segfault the instant they're used with threads?
08:47:21FromDiscord<nocturn9x> (edit) "instant" => "_instant_"
08:48:07FromDiscord<nnsee> i had random segfaults when i did https://pasty.ee, due to segfaults
08:48:17FromDiscord<nnsee> turns out pretty much all of them were my fault
08:48:26FromDiscord<nnsee> derp, due to threads
08:48:35FromDiscord<nocturn9x> yeah well how do I debug this crap
08:50:27FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=KQWmXoZlWpdC
08:50:38FromDiscord<nocturn9x> `startUCISession` is definitely _not_ inside `threadimpl.nim`
08:50:56FromDiscord<nocturn9x> nor does it contain line 71
08:51:18*def- quit (Quit: -)
09:01:23FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=pHgzEAwGtylB
09:01:30FromDiscord<nocturn9x> it's just segfaulting at random places in the allocato
09:01:31FromDiscord<nocturn9x> (edit) "allocato" => "allocator"
09:01:38FromDiscord<nocturn9x> and I'm using mimalloc, mind you
09:08:24*KhazAkar quit (Remote host closed the connection)
09:08:50*def- joined #nim
09:09:10*KhazAkar joined #nim
09:12:17*KhazAkar quit (Remote host closed the connection)
09:12:48*KhazAkar joined #nim
09:16:51FromDiscord<nocturn9x> how is `atomicArc` faster than `arc`? lol
09:17:19*deadmarshal_ quit (Remote host closed the connection)
09:26:20*KhazAkar quit (Remote host closed the connection)
09:27:16*KhazAkar joined #nim
09:31:30*KhazAkar quit (Ping timeout: 255 seconds)
09:32:26*KhazAkar joined #nim
09:34:08*KhazAkar quit (Remote host closed the connection)
09:34:47*KhazAkar joined #nim
09:41:49FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=MrkyunZccEit
09:45:27*KhazAkar quit (Ping timeout: 255 seconds)
09:46:40*KhazAkar joined #nim
09:46:41*KhazAkar quit (Remote host closed the connection)
09:47:10*KhazAkar joined #nim
09:49:00*def- quit (Quit: -)
09:49:11*def- joined #nim
10:07:01*KhazAkar quit (Remote host closed the connection)
10:07:30*KhazAkar joined #nim
10:13:16*KhazAkar quit (Ping timeout: 246 seconds)
10:13:25FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=IesnvzAqmpbp
10:14:34*KhazAkar joined #nim
10:16:47FromDiscord<Phil> More like I'm not investing an hour into troubleshooting something that difficult
10:21:28FromDiscord<nocturn9x> fair enough ig
10:23:15*KhazAkar quit (Ping timeout: 256 seconds)
10:24:43*KhazAkar joined #nim
10:28:20*deadmarshal_ joined #nim
10:33:20*KhazAkar quit (Remote host closed the connection)
10:34:02FromDiscord<fosster> hi nim community, I'm back coding in nim! I was looking for a good tui library in nim, any suggestion?
10:34:10*KhazAkar joined #nim
10:34:14FromDiscord<fosster> hi nim community, I'm back coding in nim! I was looking for a good tui library for nim, any suggestion?
10:37:15FromDiscord<Phil> I know nothing, but this could be a useful resource:↵https://github.com/ringabout/awesome-nim?tab=readme-ov-file#terminal
10:37:28*KhazAkar quit (Remote host closed the connection)
10:38:20*KhazAkar joined #nim
10:43:32FromDiscord<Robyn [She/Her]> In reply to @isofruit "errr question, how do": Have you tried `compiles(waitFor next(default(T)))`?
10:44:43FromDiscord<Robyn [She/Her]> I use a similar method of checking if a proc is async in my code here: https://github.com/Nimberite-Development/Trigger-Nim/blob/main/src/trigger.nim#L79
10:54:14FromDiscord<fosster> [Phil (he/him)](https://matrix.to/#/%40isofruit%3Amatrix.org) thank you
10:57:02FromDiscord<Phil> In reply to @chronos.vitaqua "Have you tried `compiles(waitFor": All I want at this point is not to have to define 8 versions of newObserver, I got 2-3 Approaches for how to figure out async now, but I can't figure out for the life of me how to make a proc generic in the sense that it accepts 2 types of procs and converts one to the other
10:57:35FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=RQexwSitEGMo
10:58:00FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=NBNEnIQDjFUw
10:59:36FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=fjnvDTbxoRrb
10:59:37FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=SfNXmQHvEHus" => "https://play.nim-lang.org/#pasty=AjMFAAzTqpuo"
11:07:28*KhazAkar quit (Remote host closed the connection)
11:07:59*KhazAkar joined #nim
11:08:57*gst joined #nim
11:14:21*KhazAkar quit (Ping timeout: 252 seconds)
11:15:02*KhazAkar joined #nim
11:22:23*KhazAkar quit (Ping timeout: 272 seconds)
11:22:49*KhazAkar joined #nim
11:39:47*KhazAkar quit (Remote host closed the connection)
11:40:34*KhazAkar joined #nim
11:57:46*beholders_eye joined #nim
12:09:50*KhazAkar quit (Remote host closed the connection)
12:10:18*KhazAkar joined #nim
12:14:53*beholders_eye quit (Ping timeout: 240 seconds)
12:17:21*beholders_eye joined #nim
12:30:40FromDiscord<basilajith> sent a code paste, see https://play.nim-lang.org/#pasty=bfVkRdkFlHva
12:31:42FromDiscord<Phil> In reply to @basilajith "Can I: 1.": Yes you can, however you typically do not define e.g. constructor procs as part of the type definition
12:31:54*beholders_eye quit (Ping timeout: 252 seconds)
12:31:54FromDiscord<Phil> Also Table is a generic type whose types you need to specify
12:31:59FromDiscord<Phil> Let me whip up a code example
12:33:42FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=MJeazEyuBIPI
12:35:10FromDiscord<Phil> This will however mean that `record`can only hold strings.↵If you want to store multiple different types in there, you'll need to either look into object variants (which can hold entirely different types based on a field counting as a flag at runtime) or inheritance (which you should only look into if you don't want to use generic methods as those are deprecated)
12:39:24FromDiscord<basilajith> 👍🏼↵↵Thanks @Phil!
12:52:04FromDiscord<basilajith> I'm just wondering whether some of the members of the `object` type can have some default values.
12:53:29FromDiscord<basilajith> Aah, slip of thinking. Taking this 👆🏼 back.
12:53:58FromDiscord<Phil> In reply to @basilajith "I'm just wondering whether": You can in fact assign default values in the type itself
12:54:10FromDiscord<Phil> `count: int = 5` for example in the Something type
12:54:28FromDiscord<basilajith> Oh, okay.
12:54:40FromDiscord<Phil> Note that those values must be static compile-time values, so you can't read in a config file or the like to set a default value
12:57:09FromDiscord<basilajith> But, they are not immutable, right? 😬
12:58:04FromDiscord<nnsee> no
12:58:10FromDiscord<Phil> If you just mean changing them after initialization - then yeah, they are not immutable
12:58:16FromDiscord<nnsee> but your object must be initialized via `var`, not `let`
12:58:22FromDiscord<nnsee> as per standard mutability rules
12:58:49FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=GwGaaPRYniKm
12:59:29FromDiscord<Phil> Note that the `var` here means that x is mutable. Had I used let then the assignment to counter would've been blocked at compiletime
13:04:51FromDiscord<Phil> Hmmmmmmm
13:06:20FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=pOLsnhaHjOnv
13:06:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=BwuOWzfdyEep
13:07:16FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=fZbQAKIsekjy" => "https://play.nim-lang.org/#pasty=veDjaCjfIZzd"
13:08:40FromDiscord<.lisuwu_> In reply to @isofruit "Anyone understand how this": i feel like doing it as simply just `Future` is wrong as Future is generic, my only guess, idk how to explain the error though
13:09:10FromDiscord<.lisuwu_> that could be just me not knowing what typeOf is
13:09:11FromDiscord<Phil> In reply to @.lisuwu_ "i feel like doing": Nah, that is not the issue. That'll work without a problem really
13:09:36FromDiscord<Phil> Gets you the type of something, in this case we're "pseudo"-executing `nextProc` and looking at its return-type
13:09:48FromDiscord<Phil> Which might be what's blowing up since that is "void" in one case
13:10:02FromDiscord<Phil> Uggggghhhh seriously, this type system is my bane sometimes
13:13:42FromDiscord<.lisuwu_> In reply to @isofruit "Anyone understand how this": one idea: cant you just overload isAsync, so you can always return true for AsyncNextProc, false for SyncNextProc?
13:14:31FromDiscord<.lisuwu_> (edit) "idea:" => "suggestion:"
13:15:44FromDiscord<Phil> If the type system weren't busy daggering me sure
13:15:47FromDiscord<Phil> However, even that won't work
13:16:08FromDiscord<.lisuwu_> poor phil
13:16:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=BItDKNgPhHTX
13:16:19*def- quit (Quit: -)
13:16:47FromDiscord<Phil> This is the kind of shit that makes me aggro sometimes, this should not be this hard to express. It works perfectly fine for normal types, but once you pick out procs its a house of cards
13:17:03*def- joined #nim
13:18:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=UjAMvDXxEbbU
13:19:03FromDiscord<Phil> It drives me up the wall
13:20:34FromDiscord<Phil> Like, I enjoy dealing with implementing reactivex in nim because its an interesting problem.↵Working my way past compiler bugs or what have you is not interesting, its boring as hell
13:20:39FromDiscord<.lisuwu_> cursed
13:31:35*beholders_eye joined #nim
13:33:04FromDiscord<demotomohiro> It seems `async` is a macro transform , not calling convention.↵Does `asnyc` works like calling convention in the Nim's type system?
13:33:49FromDiscord<demotomohiro> async is a macro transform a proc to a closure iterator.
13:35:51FromDiscord<Phil> I mean, even if I remove the async macro and replace it with just having a return-type `Future[void]` instead that isn't going to change the problem
13:36:19FromDiscord<Phil> Nim just can't cope with a type-union of 2 geneneric proc-types
14:16:50NimEventerNew thread by ninovanhooff: Can I use std/json to serialize objects in a Table?, see https://forum.nim-lang.org/t/11548
14:19:22*def- quit (Quit: -)
14:20:43*def- joined #nim
15:45:55FromDiscord<.lisuwu_> How can I have nim call my procedure for every unhandled exception?
15:46:03FromDiscord<.lisuwu_> (edit) "my" => "a specific"
15:46:25FromDiscord<.lisuwu_> Setting `unhandledExceptionHook` doesn't work
15:46:30FromDiscord<.lisuwu_> (edit) "exception?" => "exception on `--os:any`?"
15:55:26Amun-Ra.lisuwu_: works for me: https://play.nim-lang.org/#pasty=hjRSqeGOdfpE
15:56:57*def- quit (Quit: -)
15:57:10FromDiscord<.lisuwu_> In reply to @Amun-Ra ".lisuwu_: works for me:": yeah but it doesn't in `--os:Any`
15:57:11FromDiscord<.lisuwu_> (edit) "`--os:Any`" => "`--os:any`"
15:57:19*def- joined #nim
15:58:25Amun-Rathese edits are not as clear on irc as they're on discord
15:58:37Amun-Ra.lisuwu_: https://github.com/nim-lang/Nim/issues/15627
15:58:43Amun-Rastill open
15:59:19FromDiscord<.lisuwu_> In reply to @Amun-Ra "these edits are not": oh, my bad
15:59:29FromDiscord<.lisuwu_> In reply to @Amun-Ra "still open": oh :(
15:59:42FromDiscord<.lisuwu_> alright thanks either way
15:59:53Amun-Rano, I should've replied after reading all the lines :>
16:00:59FromDiscord<.lisuwu_> In reply to @Amun-Ra "no, I should've replied": hey, it's fine, i do have same thing
16:01:04FromDiscord<.lisuwu_> we all do mistakes
16:03:21Amun-Rayeah, that's a non-issue really :>
16:03:45Amun-Rauntil this day I wasn't aware this hook even existed
16:04:00FromDiscord<.lisuwu_> me neither, i only found about it when i was trying to code OS kernel
16:04:10FromDiscord<.lisuwu_> and i needed proper exception handling mechanism after switching to `--os:any`
16:04:41Amun-Racan you use "global" try/except?
16:16:48FromDiscord<.lisuwu_> In reply to @Amun-Ra "can you use "global"": yeah, but really it would be better if i didnt have to do that
16:17:07FromDiscord<.lisuwu_> but i guess i have to roll with this system
16:17:56FromDiscord<.lisuwu_> thanks for suggestion either way
16:18:02FromDiscord<.lisuwu_> better than nothing
16:18:34Amun-Raright
17:26:54FromDiscord<Phil> Maybe I found the one scenario where converters are legitimate
17:27:04FromDiscord<Phil> Let's see if that works
17:28:54FromDiscord<Phil> Nope, converters also die
17:31:14FromDiscord<morgan> ok so im trying to use a proc instead of template (i also tried macro with genast) for my entry and setup code
17:31:34FromDiscord<morgan> i'm getting illegal capture because of calling convention cdecl
17:32:11FromDiscord<morgan> i changed that variable to be declared outside, and even made it passed in as a pointer (i only need the address inside the section of code)
17:33:48FromDiscord<morgan> it has to define procs which are then stored in objects, maybe a few layers of that, and then ends with the struct that is the entry point
17:34:19*om3ga joined #nim
17:39:06FromDiscord<morgan> i just need to get some user data into these initial functions which do not have a way to provide it via the inputs
17:39:44FromDiscord<morgan> since it needs to conform to the plugin api
17:43:30FromDiscord<Phil> I did it, I finally tricked the system
17:44:23FromDiscord<morgan> i want to have some macro/template/whatever which just drops the code into the user's file with a few variables filled in with either an object, a proc, or nil. i don't know why it's so hard to do that
17:45:51FromDiscord<Phil> I don't fully understand what you're trying to do I'll be honest.↵So you're generating code-text that you want to write into a user's file based on their input?
17:46:57FromDiscord<nnsee> In reply to @isofruit "*I did it, I": https://tenor.com/view/thematrixreloaded-matrix-reloaded-neo-keanureeves-gif-3449253871426083114
17:47:07FromDiscord<nnsee> wow, gifs are not appreciated om this channel
17:47:12FromDiscord<nnsee> (edit) "om" => "in"
17:47:20FromDiscord<Phil> Basically, 2 converters and I'm just eating it that I have to do an overload for the generic bits
17:47:40FromDiscord<Phil> Which is fine, 2 I can live with, even if I have to do that twice, 8 twice over is too much
17:47:56FromDiscord<Phil> (edit) "bits" => "bits, which means 2 procs"
17:48:12FromDiscord<morgan> In reply to @isofruit "I don't fully understand": the entry point code should be handled by the library, but the defs of some procs need to take in user data and afaict cannot be rewritten to do so via inputs
17:48:57FromDiscord<morgan> so undoing to when i had it as a macro with genast, the errors start with some nil proc inputs and after a nil pointer. i wonder if that is causing the error https://media.discordapp.net/attachments/371759389889003532/1236374019046117446/image.png?ex=6637c688&is=66367508&hm=1e2df81e907cdc410a2ed3ab96bc63fdc44edecf28270c14e409da2cd8c9552d&
17:48:58FromDiscord<Phil> You are still speaking in tongues, do you want users to write code as text and you run that code or sth?
17:49:29FromDiscord<morgan> the users provide one or more procs, a table, a seq of objects, and an object
17:49:33FromDiscord<Phil> And what input are we talking about, a CLI/GUI input field?
17:49:40FromDiscord<morgan> no at compile time
17:49:47FromDiscord<Phil> Okay, so "user" here is develoepr
17:49:50FromDiscord<morgan> yes
17:49:53FromDiscord<morgan> user of the library
17:50:03FromDiscord<morgan> sorry that was probably a bit confusing
17:50:47FromDiscord<Phil> So you want some state in procs that they can't receive via inputs?
17:50:56FromDiscord<Phil> (edit) "inputs?" => "the proc-params?"
17:50:56FromDiscord<morgan> yes
17:50:59FromDiscord<Phil> Closures?
17:51:13FromDiscord<Phil> I know I sound like a broken record by now when it comes to those
17:51:27FromDiscord<Phil> You should be able to capture any variable in a closure as long as it isn't `var`
17:51:36FromDiscord<Phil> If it must be mutable, make it a ref-type
17:52:31FromDiscord<morgan> can i do that with cdecl calling convention?
17:52:52FromDiscord<Phil> I would assume so, but haven't tried
17:53:04FromDiscord<jaar23> In reply to @fosster "hi nim community, I'm": @nocturn9x I'm working on a tui lib based on illwill. You are welcome to check it out. https://github.com/jaar23/tui_widget
17:53:30FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=SRTAMIxtcGWe
17:53:53FromDiscord<nocturn9x> In reply to @jaar23 "<@523555920265871380> I'm working on": think you tagged the wrong person :)
17:54:11FromDiscord<polylokh_39446> you'd need to smuggle the user data into the function through a global variable, which are capturable despite calling convention because their location is static
17:54:53FromDiscord<jaar23> (edit) "@nocturn9x" => "@fosster"
17:54:59FromDiscord<morgan> yeah and then i need to declare a global in the user file which is read in the library file
17:55:05FromDiscord<morgan> which afaik isnt possible
17:55:28FromDiscord<jaar23> In reply to @nocturn9x "think you tagged the": Lol, I think so, he didn't allow me tagging him, end up I mistakenly tag you...
17:55:38FromDiscord<morgan> forward declarations would be really nice to have
17:55:53FromDiscord<Phil> ?↵Forward declarations, at least for procs, exist
17:56:05FromDiscord<morgan> oh huh
17:56:15FromDiscord<morgan> ill have to look into that then
17:56:20FromDiscord<Phil> Like, I've used them before and toyed around using them as pseudo interfaces
17:56:39FromDiscord<morgan> i guess it was just types where i ran into that not existing
17:56:44FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=WClaJdgZVLQb
17:57:08FromDiscord<Phil> As an example where Owlkettle makes use of those
17:57:47FromDiscord<Phil> Yeah for types and constants etc. there are no forward declarations
17:58:09FromDiscord<Phil> however you can work around the "no forward declaration for constants" by having them decine a callback that returns the value you want
17:58:15FromDiscord<Phil> For types though you're sol
17:58:22FromDiscord<morgan> yeah i was gonna say that
17:58:48FromDiscord<morgan> a proc which returns the inputs in a tuple or something
17:58:51FromDiscord<Phil> What do you need the type for? Why do you care specifically? What information do you need?
17:59:28FromDiscord<Phil> In reply to @morganalyssa "a proc which returns": `proc[A, B](x: A, y: B): [(A, B)] = (x, y)`↵?
17:59:35FromDiscord<Phil> (edit) "`proc[A," => "`proc toTuple[A,"
17:59:50FromDiscord<Phil> (edit) "[(A, B)]" => "(A, B)"
18:01:57FromDiscord<morgan> sent a long message, see https://pasty.ee/kQRIDmHpcuFc
18:02:05FromDiscord<morgan> that's a small part of it
18:02:38FromDiscord<polylokh_39446> `user_data` is where inputs typically go
18:02:44FromDiscord<morgan> and elsewhere in the setup, i have some callbacks inserted
18:03:05FromDiscord<Phil> In reply to @morganalyssa "first 4 are required,": Make a file called "interface.nim" or sth with forward declarations, tell users to include those
18:03:22FromDiscord<Phil> for the 4 required procs
18:03:26FromDiscord<morgan> rather than forward declarations in the main file?
18:03:35FromDiscord<morgan> main library file
18:03:40FromDiscord<Phil> Also a possibility, I like to do this kind of pattern separately
18:03:50FromDiscord<Phil> But that doesn't have to be your style, whatever you find convenient
18:14:23FromDiscord<morgan> is there a way to gracefully handle them not being defined? are they nil before then?
18:14:46FromDiscord<morgan> im setting it up as procs which take nothing and return something
18:19:51FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=SXapDDIwOeQC
18:56:54FromDiscord<Phil> Lul, I have now managed through the combination of async with observable to have a try-catch statement that catches `CatchableError` but is unable to catch a ValueError
18:57:36FromDiscord<Phil> In fact, it won't even catch Exception
18:58:05FromDiscord<Phil> Is there something stronger than try-except that I can use to force catching an exception under all circumstances?
19:02:06FromDiscord<Elegantbeef> Try except does capture all exceeptions
19:04:02FromDiscord<Phil> Given that awaiting a future of a proc that throws exceptions whose exceptions should be caught by the calling proc whose future is being awaited - I struggle believing that
19:04:36FromDiscord<Elegantbeef> Futures throw exceptions in the dispatch loop if you're not awaiting them
19:04:41FromDiscord<Elegantbeef> Otherwise they raise at the place
19:08:20*beholders_eye quit (Ping timeout: 260 seconds)
19:11:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=ukSeWJfAuazg
19:12:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QqkymhHmmxkB
19:13:26FromDiscord<Phil> So.... I must make subscribeProc async and await here? Is that the only way?
19:13:53FromDiscord<Elegantbeef> Wrapping what consumes the `fut` with a try except should work
19:14:23FromDiscord<Phil> In this case that should be `doWork`
19:14:31FromDiscord<Phil> Since that waitfor's the future
19:15:08FromDiscord<Phil> Yep, that catches it... but I don't want to catch it there dangit
19:15:15FromDiscord<Elegantbeef> Tangentially related this is what it takes to make async work with owlkettle and to gracefully handle exceptions https://github.com/beef331/dodger/blob/master/dodger/dodger.nim#L22-L31
19:15:39FromDiscord<Elegantbeef> You have to except around whatever gets the exception off dispatcher
19:16:48FromDiscord<Elegantbeef> Unless the exception is ran before the first `await` in a async proc invoking an async proc will not raise at the callsite
19:17:09FromDiscord<Elegantbeef> Which sadly is not knowledge you can use here
19:18:31*def- quit (Quit: -)
19:19:27FromDiscord<Phil> So not even await saves me here
19:19:35FromDiscord<Elegantbeef> No it does
19:19:39FromDiscord<Phil> FML
19:20:01FromDiscord<Elegantbeef> if you can await the subscription where it's invoked you get the exception there
19:21:02*def- joined #nim
19:21:30FromDiscord<Phil> That's not what I quite want is the problem.↵I want a subscription to be async work. So upon subscribing I want to give the user the option to determine when that work is being done because I can't make assumptions about event loops
19:21:35FromDiscord<Phil> That means handing them the future
19:21:47FromDiscord<Phil> But apparently that also means that I can't do the error handling for them then
19:22:06FromDiscord<Elegantbeef> Should you even be doing the error handling for them?
19:22:16FromDiscord<Phil> Yes, in a sense
19:22:27FromDiscord<Phil> You give me 3 callbacks:↵next, error and complete
19:22:46FromDiscord<Phil> If anyone, anywhere throws an exception during an execution of subscribe or the like, I call next
19:22:59FromDiscord<Phil> (edit) "next" => "error"
19:23:04FromDiscord<Phil> If there is no error, nothing happens
19:23:11FromDiscord<Phil> (edit) "error," => "error-callback,"
19:23:26FromDiscord<Elegantbeef> does subscription capture the observer?
19:23:28FromDiscord<Phil> You get to decide wheether you care about any exceptions/errors by providing an error-callback
19:24:17FromDiscord<Phil> It does not atm, just contains a closure which captures observer. It could have access to it though... oh I'm not going to like this
19:24:33FromDiscord<Phil> That's such a "this is technically necessary, not logically" piece of code
19:24:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=zMfEGJeBBHyV
19:25:27FromDiscord<Phil> I'm going to fetch explicitly the errorcallback since nothing else should be necessary
19:25:50FromDiscord<Phil> capturing observer would just introduce a generic parameter into subscription that I'm really not feeling
19:26:30FromDiscord<Elegantbeef> Just define a `ObservableBase` that has errorhandler 😛
19:27:18FromDiscord<Phil> Subscriptions don't inherit from Observable, they're independent from that
19:27:26FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=JFhiLViksmLG
19:27:48FromDiscord<Elegantbeef> Right but you could capture an `Observer` without having a generic parameter if you use a little inheritance
19:27:51FromDiscord<odexine> Having fun yet?
19:28:00*def- quit (Quit: -)
19:28:15FromDiscord<Phil> 50% fun, 50% aggravation of nim's type system
19:28:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=MDUzlERYBBWz
19:28:33FromDiscord<Elegantbeef> Hey it's mostly just static typing keeping you down
19:28:46*def- joined #nim
19:28:53FromDiscord<Elegantbeef> Make everything weakly dynamically typed!
19:29:05FromDiscord<odexine> Weak typing is another thing
19:33:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=NADYWiZrvMMJ
19:33:28FromDiscord<Elegantbeef> Ew `return` for an expression
19:33:45FromDiscord<Elegantbeef> I'm booking a flight to Germany and bringing a hockey stick
19:33:56FromDiscord<.lisuwu_> why the hate on explicit returns 😭
19:34:01FromDiscord<Phil> Says the person that just wanted me to introduce a second level of inheritance to add a proc in a field that only one type actually needs
19:34:02FromDiscord<Elegantbeef> They're pointless
19:34:17FromDiscord<Elegantbeef> I was just saying that you did not need the generic parameter
19:34:36FromDiscord<Elegantbeef> I can only suggest things Phil I do not know what madness you have
19:36:07FromDiscord<Phil> It leads to odd inheritance chains either way 😛↵↵Observable does not inherit from Observer btw, those are separate in general.↵It would be more that only Observer inherits from Observerbase and subscription could store "Observerbase"
19:36:17FromDiscord<Phil> At which point I could just as well just store the error-callback directly 😄
19:36:44FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=olLKkZQGIoMO
19:37:37FromDiscord<Phil> almost 60% of just my observable tests are running again though, so that's nice
19:37:52FromDiscord<polylokh_39446> although, it still doesn't warn about that function without them.
19:38:19FromDiscord<Phil> Errrrrrrr
19:39:21FromDiscord<odexine> In reply to @polylokh_39446 "although, it still doesn't": ?
19:42:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=uONHMuJvwnDR
19:42:12FromDiscord<polylokh_39446> In reply to @odexine "?": if you're asking what the problem is, it's that `result` is returned in the last case.↵if you're asking why it doesn't warn even without the explicit returns, it's that the `assert(false)` makes it think the second case isn't an expression to begin with (so an implicit return would result in an error)
19:42:15FromDiscord<Elegantbeef> Right but I do not know what you code needs↵(@Phil)
19:42:20NimEventerNew thread by planetis: Malebolgia threads deadlock when trying to synchronize them., see https://forum.nim-lang.org/t/11549
19:42:56FromDiscord<Phil> I know I can just go "msg.contains("Some error") but that seems rather unspecific now
19:42:59FromDiscord<Elegantbeef> @polylokh_39446 not to mention that expressions have to return values
19:43:08FromDiscord<Phil> It's not a big deal per se but would be preferred
19:44:32FromDiscord<Elegantbeef> Odd in my experience `e.msg` only had a the exception message
19:45:37FromDiscord<Phil> I'm booking that msg change under "async is weird"
19:46:01FromDiscord<Phil> I've moved to ` check receivedErrors2[0].msg.contains("Some error")` but I liked the prior syntax more and the exception message change is odd
19:46:12FromDiscord<Phil> Anyway, 100% of my tests work!
19:46:29FromDiscord<Phil> As in, my observable tests, the other 80% of my test-suite I'll still need to fix up
19:49:46FromDiscord<odexine> In reply to @polylokh_39446 "if you're asking what": I more of don’t see how the problem is a problem, what is it supposed to be for you?
19:50:47FromDiscord<Phil> Sidednote, beef:↵if I were in an eventloop, then I wouldn't have to call `doWork` right?↵The event-loop would magically - whenever the loop reaches its "do async work"-phase, - trigger all the code for me... maybe?
19:51:21FromDiscord<polylokh_39446> The problem is that if you, by error, fail to provide a return value, then the function will compile without complaint and return something anyway. This is a reduced example of a real case where there are a bunch of explicit returns and then very confusing behavior for the control path that's missing its explicit return.
19:52:21FromDiscord<Phil> Because all `doWork` does is await a bunch of `Future[void]` , which just stands for more procs that should be called after an await
19:52:51FromDiscord<odexine> from what i remember, the analysis from the compiler is not aware of anything within other when branches
19:53:21FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=jpzLkLdoNZtE
19:54:59FromDiscord<polylokh_39446> Yes, there's an explanation for the behavior. Explaining a thing doesn't change it. My perspective is still an unpleasant surprise after troubleshooting why I'm getting bounds errors because I somehow have an empty seq in my code.
19:56:07FromDiscord<odexine> idk, then it's best saved for an issue in such case no?
19:56:28FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=TEDJDMXMJMcy
19:56:51FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=xTMRrGspbebp
19:56:53FromDiscord<odexine> neither `result` nor `return` iirc will save you from this
19:57:02FromDiscord<polylokh_39446> (edit) "https://play.nim-lang.org/#pasty=GtmIREaPcusm" => "https://play.nim-lang.org/#pasty=OAOCiBVTnjAq"
19:57:14FromDiscord<polylokh_39446> what would is using implicit returns
19:57:24FromDiscord<odexine> the only possible way, yes
19:57:42FromDiscord<odexine> maybe there should be a warning yes
19:57:56FromDiscord<odexine> perhaps there already is, i'd have assumed so as well
19:58:05FromDiscord<polylokh_39446> and although assign `result` doesn't save you from not assigning it, you're at least much less likely to make that mistake because you're focused on that value
20:25:20FromDiscord<Elegantbeef> @Phil "event loop"?
20:25:58FromDiscord<Phil> Basically if you can assume that your code runs inside a while-loop that polls if there is work to be done
20:26:19FromDiscord<Elegantbeef> `poll` raises the exception then
20:26:42FromDiscord<Phil> Like a runforever type situation
20:27:40FromDiscord<Phil> That was not the point. The point was that a sanity check on the assumption that you can get away without doing `waitFor` on the Futures that get created if there is some surrounding context that calls poll for you when appropriate and without blowing up
20:27:44FromDiscord<Elegantbeef> Right
20:27:48FromDiscord<Phil> (edit) "that" => "asking for"
20:28:04FromDiscord<Elegantbeef> Futures add themselves to the eventpool and are completed by giving up the cpu
20:28:24FromDiscord<Elegantbeef> So a `poll`, `drain` or `runForever` completes them
20:36:56*ntat quit (Quit: Leaving)
20:56:23*def- quit (Quit: -)
20:57:33*def- joined #nim
21:35:24FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#pasty=bDZEOoziiGIh
22:03:29*def- quit (Quit: -)
22:21:53*def- joined #nim
22:33:29FromDiscord<amarevite> sent a code paste, see https://play.nim-lang.org/#pasty=UjCFQXIMMJDT
22:35:40FromDiscord<zidsal> whats the server code look like?
22:39:19FromDiscord<amarevite> sent a long message, see https://pasty.ee/gHFWovYFdjTU
22:44:06FromDiscord<zidsal> and from your phone did you also just the data "test" or did you send a osc framing protocol
22:45:48FromDiscord<amarevite> from my phone, the app is sending actual osc data in the proper format↵"test" is just dummy text for the minimal code example to show that i would send data after connecting↵i built an osc data constructor so that i can send correct osc data, but i cant test it because i cant even connect
22:47:00FromDiscord<amarevite> (edit) removed "from my phone," | "the ... app" added "phone"
22:47:05FromDiscord<zidsal> what os are you on, I'm wondering if its worth sending some socket data via telnet or whatever from the same pc you're running nim so we can rule out everything else, because looking at the docs that code looks fine
22:48:15FromDiscord<amarevite> Windows 10 Pro 22H2 (kernel version 10.0.19045.4291)
22:48:19FromDiscord<amarevite> (edit) "10.0.19045.4291)" => "`10.0.19045.4291`)"
22:49:26FromDiscord<zidsal> what happens if you run telnet localhost 3033
22:49:40FromDiscord<amarevite> if i swap out the address and port for `google.com` and `80` i dont get an error
22:49:59FromDiscord<amarevite> localhost causes the same error
22:50:23FromDiscord<zidsal> can you run tcp dump while you run the nim program and send me the file
22:50:30FromDiscord<amarevite> how would i do that
22:50:40FromDiscord<zidsal> please hold
22:54:17FromDiscord<zidsal> ok 1. run command prompt as an admin↵2. windows comes built in with a program called pktmon which can do the same stuff as tcpdump↵3. run the command pktmon filter add -p 3033↵4. start capturing packets by pktmon start --etw -p 0
22:54:48FromDiscord<zidsal> run your program then run pktmon stop to finish. You should then have a file called pktmon.etl
22:55:38FromDiscord<amarevite> `Failed to add filter: The system cannot find the file specified.`
22:55:55FromDiscord<amarevite> im looking at the microsoft docs and this looks correct to me so i dont know why thats happening
22:56:28FromDiscord<zidsal> is the command prompt you're running an admin 1 or a regular 1
22:56:51FromDiscord<amarevite> regular
22:56:56FromDiscord<amarevite> i just ran as sudo and that fixed it
22:57:15FromDiscord<amarevite> not actual sudo it's a powershell script i think↵very useful to run single commands as admin
22:59:37FromDiscord<amarevite> i started a new terminal as admin to rule out any problems and set 4 gets me the following error:↵`Error: '0' is not a valid event provider Id.`
22:59:42FromDiscord<amarevite> (edit) "set" => "step"
23:00:26FromDiscord<zidsal> try pktmon start --etw --pkt-size 0
23:03:17FromDiscord<amarevite> i have the etl file↵before i send it, what kind of data does it contain
23:03:43FromDiscord<zidsal> it will be all reaw packets sent over port 3033
23:03:47FromDiscord<zidsal> (edit) "reaw" => "raw"
23:03:57FromDiscord<zidsal> (edit) "packets" => "tcp data"
23:05:42FromDiscord<amarevite> i figured that↵i took a look at the file and saw a memory section↵does it have any data outside of raw tcp data on port 3033 and basic diagnostic info↵i dont want to accidentally send identifying information or a memory dump or anything like that
23:06:14FromDiscord<zidsal> only if you've added in additionals filters via `pktmon filter add -p`
23:07:04FromDiscord<zidsal> as to if there is any personal identifying information, that entirley depends on whats been sent on port 3033!
23:07:34FromDiscord<amarevite> alright then heres the file https://media.discordapp.net/attachments/371759389889003532/1236454198720331818/PktMon.etl?ex=66381135&is=6636bfb5&hm=079ddf8826b6af2ad3fdaa78934655780280f9073d7ae1e51959f56ba079fe3b&
23:08:30FromDiscord<zidsal> ~~muhahaha all you're bases now belong to us~~ I've got the file give me a few mins
23:15:47FromDiscord<zidsal> ok thats given nothing useful
23:21:19FromDiscord<zidsal> given that you making a connection to port 80 was working and the code looks fine I'm starting to think thisn't isn't an issue with the socket. If I had to guess the data you're sending isn't in the right format as it needs a SLIP_END at the start/end of the frame
23:22:38FromDiscord<zidsal> to prove that, my advise would be to try and connect via a different way either telnet or by writing a quick socket in another language like python and see if the same thing happens
23:25:38*def- quit (Quit: -)
23:26:40*def- joined #nim
23:28:49FromDiscord<amarevite> [this client example](<https://pypi.org/project/python-osc/>) works from python just fine
23:28:53FromDiscord<amarevite> (edit) "example](<https://pypi.org/project/python-osc/>)" => "example](https://pypi.org/project/python-osc/)"
23:29:00FromDiscord<amarevite> (edit) "example](https://pypi.org/project/python-osc/)" => "example code](https://pypi.org/project/python-osc/)"
23:49:41FromDiscord<amarevite> well
23:49:44FromDiscord<amarevite> instead of using tcp
23:49:48FromDiscord<amarevite> udp works
23:51:34FromDiscord<amarevite> sent a code paste, see https://play.nim-lang.org/#pasty=zfaDRHlDyPIZ
23:51:37FromDiscord<amarevite> thank you for the help
23:52:42*def- quit (Quit: -)