<< 21-04-2024 >>

00:29:21FromDiscord<ccloud_> Is this a bug with Nim tables? The tables are not empty if I uncomment lines 6 and 7↵https://play.nim-lang.org/#pasty=riPMPdPERIuP
00:30:24*lucasta joined #nim
00:44:38FromDiscord<Elegantbeef> Likely a bug with arc/orc
00:48:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=JLARrRMIbcMc
00:54:53*KhazAkar quit (Ping timeout: 268 seconds)
00:55:55*KhazAkar joined #nim
00:57:54*def- quit (Quit: -)
00:59:15*def- joined #nim
01:00:02*nazgulsenpai quit (Quit: ZNC 1.8.2 - https://znc.in)
01:02:58*nazgulsenpai joined #nim
01:06:28FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/issues/23524 issue created
01:08:26*lucasta quit (Quit: Leaving)
01:21:43FromDiscord<albassort> is there a way to get the requested link from a Response
01:33:15*_________ quit (Ping timeout: 245 seconds)
01:40:54*krux02_ quit (Remote host closed the connection)
01:56:41*KhazAkar quit (Read error: Connection reset by peer)
01:57:06*KhazAkar joined #nim
02:04:58FromDiscord<albassort> where is Exception message: Connection was closed before full request has been made raised from
02:05:13FromDiscord<albassort> or rather
02:05:43FromDiscord<albassort> sent a code paste, see https://paste.rs/0ibgE
02:05:55FromDiscord<albassort> but how can i figure out which response it is and then retry that one
02:13:06FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=AyzKfNQvLHBN
02:13:21FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=eIzhLOGAujQB" => "https://play.nim-lang.org/#pasty=bNvQmrEuYwFR"
02:13:22FromDiscord<albassort> this is silly
02:53:38FromDiscord<polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=XMCGhJqgRnxI
03:00:36*mahlon quit (Ping timeout: 260 seconds)
03:00:41*lain quit (Ping timeout: 268 seconds)
03:08:38FromDiscord<zumi.dxy> I just noticed the `BOT` flair replaced with `APP`
03:10:47*lain joined #nim
03:34:30*mahlon joined #nim
03:57:24FromDiscord<albassort> Yes me too
03:58:05FromDiscord<albassort> Beef beating the chatgpt allegations
04:21:37*def- quit (Quit: -)
04:41:26*def- joined #nim
05:25:31*_________ joined #nim
05:47:18*coldfeet joined #nim
05:48:52*SchweinDeBurg quit (Read error: Connection reset by peer)
05:52:09*def- quit (Quit: -)
05:52:21*def- joined #nim
05:54:30*SchweinDeBurg joined #nim
06:10:06FromDiscord<Phil> Is there any kind of syntax to "unpack" a tuple?
06:10:35FromDiscord<Phil> Like I want to basically combine two values in a tuple. If one of the values is also a tuple I want it to be flattened
06:11:41FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=DFLtiowHWPku
06:13:37FromDiscord<Phil> I can think of macro ways to do this by figuring out everything at compiletime but I really don't want to because it feels so error prone
06:27:20FromDiscord<Elegantbeef> recursively or just once?↵(@Phil)
06:28:12FromDiscord<Phil> recursively I guess? I can't know the structure of the values at coding time since the proc they're being used in is a generic
06:28:25FromDiscord<Phil> So I can't hard-code anything
06:28:38FromDiscord<Elegantbeef> You will need a macro for this cause you need to generate a new type.... hmmmm
06:28:59FromDiscord<Phil> If that's the case I might as well go an easier route
06:29:10FromDiscord<Phil> Basically this was about combining observables
06:29:39FromDiscord<Phil> Where I could either overload the `&` operator and flatten whatever tuples that creates
06:30:06FromDiscord<Phil> Or I just write a `combine` macro that accepts arbitrary numbers of observables in the first place and copy-paste a 3 line piece of code block in the proc body
06:30:52FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=BznwNAaaWyHe
06:31:18FromDiscord<Phil> And writing a macro for that seems a lot easier than figuring out flattening tuple types at compiletime
06:45:58*ntat joined #nim
06:46:05FromDiscord<odexine> @Phil i hate you now im looking at rex and thinking reactive again
06:46:39FromDiscord<Phil> Hah! Its good stuff
06:54:10FromDiscord<Elegantbeef> Braintrapped me @Phil https://play.nim-lang.org/#pasty=PqfxwNEuoCSz
06:54:32FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=tbVGNnDYmsMU
06:54:35FromDiscord<Elegantbeef> Just a little bit of stringification shenangians
06:55:20FromDiscord<odexine> rxjs is very much modelled with the assumption that async/an event loop is available at all times
06:56:14FromDiscord<odexine> iirc other rxes either are modelled similarly
06:59:43*def- quit (Quit: -)
07:27:54*perr_ joined #nim
07:35:35*def- joined #nim
07:39:22FromDiscord<Phil> That stringificatin shenanigans looks neat, but also unholy
07:39:31FromDiscord<Phil> Like, I can see how it works but that's a bit of a twister
08:07:04*MacDefender joined #nim
08:46:35*coldfeet quit (Ping timeout: 245 seconds)
08:48:48*coldfeet joined #nim
09:27:43*ntat quit (Quit: Leaving)
09:33:48FromDiscord<Phil> In reply to @odexine "i mean if we": I honestly have no clue how you're supposed to do operators without the new observables in truth being subjects
09:34:17FromDiscord<Phil> Like `map` has to somehow forward every change from the source observable to all its subscribers (after applying the map function)
09:34:35FromDiscord<Phil> Actuall no I see it, uuuugh just not nice
09:53:47FromDiscord<odexine> In reply to @isofruit "I honestly have no": im really not as well versed as you are with reactive
09:54:02FromDiscord<odexine> mainly because i didnt really think of it as intuitive
09:55:15FromDiscord<nnsee> whenever i've done React, it has been really intuitive for me once it "clicks"
10:01:05*def- quit (Quit: -)
10:01:17*def-- joined #nim
10:01:42*def-- is now known as def-
10:10:08FromDiscord<odexine> i mean, the idea is intuitive, the implementation has not for me
10:11:35FromDiscord<Phil> The idea is an absolute mindfuck
10:11:53FromDiscord<Phil> Where you need to distinguish between forwarding a value from one reactive-type to the next and the user pushing a value into a reactive type
10:12:06FromDiscord<Phil> Where operators all kind-of do the same but also not
10:12:30FromDiscord<Phil> And where Subjects and Observables are insanely close in terms of behavior but then again ultimately aren't
10:12:59FromDiscord<Phil> (Given how Subjects allow pushing in new values and observables don't, but then you can treat a Subject as an observable etc.)
10:13:28FromDiscord<Phil> How the fuck you're supposed to do that in a manner that allows both hot and cold observables is absolutely beyond me
10:14:36FromDiscord<docRekd> I mean Observable is just a read only view on some Subjects
10:14:47FromDiscord<docRekd> please elaborate↵(@Phil)
10:15:50FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=SIXYxouPHNfx
10:15:59FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=VtmGDBJwCfpC" => "https://play.nim-lang.org/#pasty=OyfAhbuSpFRT"
10:16:36FromDiscord<Phil> How to do that is beyond me because I can't seem to get the mental model for it
10:17:11FromDiscord<Phil> I can do eager observables all day, any day.↵But in that case filter is getting executed even without any subscripitions
10:17:35FromDiscord<docRekd> again I don't see the problem, unless you're talking of some implementation
10:17:44FromDiscord<Phil> I'm talking about the implementation
10:17:50FromDiscord<Phil> Let me set up an example with tap
10:18:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=gNTKlpbLrryy
10:19:05FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=TCBTvaxekdRo" => "https://play.nim-lang.org/#pasty=OKJwQtjgvFyr"
10:19:13FromDiscord<Phil> Or rather the procs in them get run on the observable value
10:20:39FromDiscord<docRekd> the map method returns a object where its subscribe method simply call the parent's with x-\@Phil)
10:20:45FromDiscord<Phil> sent a long message, see https://pasty.ee/DsPMJfzVEbYk
10:20:51FromDiscord<Phil> Which is super inefficient
10:21:20FromDiscord<Phil> (edit) "https://pasty.ee/mzFRwuftgBey" => "https://pasty.ee/xTJEtQSjNipY"
10:21:58FromDiscord<Phil> In reply to @docRekd "the map method returns": Which means I can't do a subscribe proc, I need to generate a subscribe proc on the fly and attach it to the observable
10:22:04FromDiscord<Phil> (edit) "In reply to @docRekd "the map method returns": Which means I can't do a ... subscribe" added "general"
10:22:10FromDiscord<docRekd> depends on the specific language. something like c++ or nim can optimize it no problem
10:22:42FromDiscord<Phil> You think the compiler would manage to optimize out the observable pattern?
10:22:53FromDiscord<Phil> Because I know the underlying implementation in this case and it is not optimized
10:23:01FromDiscord<Phil> So the compiler is your only hope for optimization there
10:23:31FromDiscord<docRekd> you have a Map type with the given subscribe↵(@Phil)
10:24:29FromDiscord<docRekd> Again I am speaking generally, I don't know which implementation you're referring to↵(@Phil)
10:24:45FromDiscord<Phil> The one from rex that I'm playing around with because it gives a baseline
10:25:02FromDiscord<Phil> One sec
10:25:16FromDiscord<Phil> https://github.com/minamorl/rex/blob/main/src/rex.nim
10:25:17FromDiscord<docRekd> at least the rust compiler can optimize away map and other operators from its Iterators↵(@Phil)
10:25:46*def- quit (Quit: -)
10:26:04FromDiscord<Phil> I'm experimenting with extending that file with Subject types, splitting out the Observables as actual read-only types and having Observers for "error" and "complete" callbacks
10:26:09*def- joined #nim
10:26:33FromDiscord<Phil> But the way this works is essentially allocating a new observable every operation
10:27:26FromDiscord<docRekd> I suggest you to make Observable an interface while Subject could be a concrete type
10:28:51FromDiscord<docRekd> then create in each proc like map etc an object that implements Observable
10:29:38FromDiscord<docRekd> now the only problem would be to optimize away the closure
10:29:59FromDiscord<docRekd> rust does it by making every individual
10:30:32FromDiscord<docRekd> function and lambda a separate type inhabited by such lambda
10:30:54FromDiscord<docRekd> and Fn is merely a trait
10:31:34FromDiscord<docRekd> I'm not familiar with nim's specific semantics in this respect
10:31:51*def- quit (Quit: -)
10:32:10FromDiscord<docRekd> you could try and make them templates
10:32:51*def- joined #nim
10:45:32FromDiscord<pk.kyle> are there libraries that are similar to python's sympy in nim?
10:48:22FromDiscord<odexine> In reply to @isofruit "And where Subjects and": to my knowledge a subject is the "root" of both observers and observables, in that it is both, and that an observer is a subject that doesnt emit, and an observable is a subject that doesnt react, i think?
10:48:27FromDiscord<odexine> at least thats how i understand it
10:49:55FromDiscord<odexine> its a bit messy to understand
10:50:11FromDiscord<odexine> and a distinction to make is that iirc this is specific to reactivex and not reactive programming in general
11:33:59FromDiscord<s0cketinc> hi
11:34:00FromDiscord<s0cketinc> hlo
11:34:14FromDiscord<s0cketinc> bye
11:34:15FromDiscord<s0cketinc> lol
11:34:16FromDiscord<s0cketinc> man
11:34:21FromDiscord<odexine> ???
11:42:48FromDiscord<goerge_lsd> no reasonable lib for spatial geometry ? I just want to import point, linestring etc types from somewhere
11:51:28FromDiscord<goerge_lsd> https://github.com/huaxk/nimgeo just this ?
11:52:33FromDiscord<goerge_lsd> which doesn't even compile in nim 2.0
12:02:40FromDiscord<docRekd> more a subtype of both, as it can replace both↵(@odexine)
12:03:15FromDiscord<odexine> why would it be a subtype in that case
12:03:36FromDiscord<odexine> as a legitimate question, not with the tone i think youre thinking of
12:03:51FromDiscord<docRekd> https://en.wikipedia.org/wiki/Liskov_substitution_principle↵(@odexine)
12:03:59FromDiscord<odexine> ah this
12:09:25FromDiscord<odexine> i think i can ideate better with this reframed in a typeclass-style way rather than oop
12:09:50FromDiscord<odexine> where observable and observer are just tcs and subject is just something with both tcs
12:10:40FromDiscord<docRekd> I was thinking in terms of Rust traits, that are typeclasses with subtyping↵(@odexine)
12:43:14*def- quit (Quit: -)
12:43:45*def- joined #nim
12:45:06FromDiscord<pk.kyle> how do i turn a number like `987999999.9999994` back to `988000000.0`
12:49:10FromDiscord<Phil> In reply to @odexine "to my knowledge a": I would distinguish there.↵An Observer has a subscription callback that the user provides where I trigger them.↵A Subject has a next function that pumps a new value into the pipeline.↵The meaning for both of those is different so I wouldn't want to make them share a field and thus a type
12:49:23FromDiscord<Phil> (edit) "In reply to @odexine "to my knowledge a": I would distinguish there.↵An Observer has a subscription callback ... that" added "(that one might call net)"
12:50:20FromDiscord<docRekd> remember that observer is merely an interface↵(@Phil)
12:50:25FromDiscord<Phil> In reply to @pk.kyle "how do i turn": Generally just rounding up or do you want rounding to the nearest int?
12:50:33FromDiscord<Phil> In reply to @docRekd "remember that observer is": Sure but the meaning is still different to me
12:51:12FromDiscord<Phil> Like, you can use the same datastructure but the meaning behind what a "next" is in the case of a subject is way too different (to me) to what a "next" is in the case of an observer
12:51:22FromDiscord<pk.kyle> In reply to @isofruit "Generally just rounding up": i think its an issue due to some floating point errors that produced the `.9999` thingy 🤷↵i guess rounding works
12:52:02FromDiscord<odexine> In reply to @isofruit "Like, you can use": im under the impression that observers have a next.
12:52:05FromDiscord<Phil> in which case you can use `round`
12:52:24FromDiscord<Phil> In reply to @odexine "im under the impression": They do if you interpret the callback function that should be called when a new values arrives as `next`
12:52:44FromDiscord<Phil> But that in the way you use it is very different from `next` on a subject
12:52:50FromDiscord<odexine> i dont think the next of a subject and the next of an observer are too different
12:53:27FromDiscord<odexine> including the behaviour in the definition of a thing has problems, i think
12:54:22FromDiscord<odexine> well, rekd showed it with the liskov subst. link, i think?
12:54:41FromDiscord<docRekd> if it walks like a duck and quack like a duck…
12:55:23FromDiscord<Phil> All he showed is that yes, technically you can implement it that way. But in one case you're using the duck to quack and in the other to listen to quaks and if things have different roles I like to keep them separate
12:56:26FromDiscord<Phil> And I'd rather just do an interface that both observables and various subjects need to conform to than include observers themselves in that list as well
12:56:33FromDiscord<docRekd> you would have to duplicate the map, filter… implementations↵(@Phil)
12:56:55FromDiscord<Phil> Why? map etc. function on the reactive types, not an observers
12:57:12FromDiscord<Phil> This is not about whether observable and subject should share an interface, this is whether Observer should share that interface with them as well
12:57:19FromDiscord<docRekd> the observers are still separate, only subjects are an intersection of both↵(@Phil)
13:00:18*def- quit (Quit: -)
13:00:55*def- joined #nim
13:03:54*def- quit (Client Quit)
13:05:04*def- joined #nim
13:08:58FromDiscord<pk.kyle> where do i report issues? ↵`.formatFloat(ffDecimal)]` turns to `.toFixed` in javascript and it seems that if not configured correctly it raises an error?↵idk if it is my code's issue or not
13:10:37*krux02 joined #nim
13:33:46FromDiscord<Phil> In reply to @docRekd "you would have to": Actually, wouldn't you want to implement different subscribes for Subject and Observable anyhow?
13:33:52FromDiscord<Phil> At least if you were to replicate RXJS
13:34:50FromDiscord<docRekd> Observable is an interface, the subscribe is different for each implementatioon↵(@Phil)
13:34:58FromDiscord<Phil> Because Observables that you generate via of() e.g. are cold and thus you need to trigger the callback in the observer in the subscription proc.↵As opposed to (some) subjects, where you don't do that and instead trigger on next calls
13:35:37FromDiscord<Phil> In reply to @docRekd "Observable is an interface,": Sure but you can also define generic procs using the interface.↵Or rather nim doesn't do interfaces, it allows you to define an arbitrarily complex "concept" with which you can define generics
13:36:06FromDiscord<docRekd> it's how I would plan on optimizing away the intermediate steps
13:36:42FromDiscord<Phil> Either way, likely means different subscribe procs for different types.↵Shared operator procs most likely
13:43:15FromDiscord<Phil> Also I can't really return an "Observable" instance if its an interface so I'd like to use the name for the explicit impl, thus the interface or rather concept gets renamed to "Reactive"
13:43:36FromDiscord<docRekd> yes any type with a subscribe method would be an observable
13:43:37FromDiscord<docRekd> and map&co would return separate structures with their own subscribe implementation
13:43:37FromDiscord<Phil> At least until I can come up with a better name
13:44:42FromDiscord<Phil> Damn how did concepts check again that a specific proc was defined...
13:45:09FromDiscord<docRekd> Rusr too return explicit structs that implement Iterable↵(@Phil)
13:45:23FromDiscord<docRekd> I thenk we are violently agreeing
13:45:45FromDiscord<Phil> The only thing being violent is my head banging against the reactive wall
13:46:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=afJeTsdWBWvL
13:46:43FromDiscord<Phil> The concept doesn't work fully because the check for "is a subscribe proc available" doesn't work
13:47:00FromDiscord<Phil> Without it you can run some basics with it at least
13:51:36*MacDef joined #nim
13:51:43FromDiscord<Phil> In reply to @docRekd "then create in each": Here you mean that each operator function creates a new Observable-instance correct?
13:52:02FromDiscord<Phil> So basically how the implementation of the operators already works in a sense
13:52:29FromDiscord<docRekd> yes a MapObservable,FilterObservable…↵(@Phil)
13:52:56FromDiscord<Phil> Hmmm not sure if there's a need to have separate returntypes
13:53:01FromDiscord<Phil> But I'll see during implementation
13:54:24*MacDefender quit (Ping timeout: 260 seconds)
13:57:18FromDiscord<Phil> I think RXJS might be avoiding this issue via their operators not really instantiating observables and more simply chaining all the operators together into one "thing" that is then used for the new observable
14:03:01FromDiscord<Phil> Or maybe they don't, all this Observable instantiation just makes me so damn hesitant
14:06:59FromDiscord<Phil> In reply to @docRekd "yes a MapObservable,FilterObservable… (<@18060188": Ohhhh now I get why you suggested "MapObservable" etc.↵You can optimize a little bit since those subscribe to source observables with observers whose `error` and `complete` procs are pretty static
14:07:24FromDiscord<Phil> Wait, no you can't you need to use closures there, hmm
14:07:43FromDiscord<docRekd> maybe templates?↵(@Phil)
14:08:09FromDiscord<Phil> Yeah, that's something to potentially use as a "clean-up" operation after the code is written in this case
14:09:02FromDiscord<docRekd> rust and c++ avoid this problem by having every individual lambda be of a individual type and parametizing the operator on the func type
14:09:57FromDiscord<Phil> I have written in neither so tough I'm not familiar on an intuitive level with that in particular
14:10:09FromDiscord<Phil> Either way, static dispatch in this case works well enough
14:26:55FromDiscord<Phil> Okay operators are somewhat of a mind-fuck given that now I kind of want the Observables they push out to behave both like cold observables and hot ones (aka subjects)
14:27:37FromDiscord<docRekd> bidirectional dataflow is a hell unto itself
14:28:41FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=PkgAcdXqMvbf
14:29:08FromDiscord<Phil> Or rather I'm doing a re-implementation of what I earlier had based on the new approach via concept etc. and that's where the map call doesn't work
14:33:43FromDiscord<Phil> Huh, nevermind, it suddenly works now?
14:34:46FromDiscord<Phil> OHHHHHHH no it worked fine before, I was being an idiot
14:35:21FromDiscord<Phil> If the observable was empty I didn't call the subscribers, and I forgot that upon calling the private `next` proc for `Observable` I need to update that field to "true"
14:46:23FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=PcilDHcOxRQC
14:47:09FromDiscord<Phil> Connects the observable created by an operator (newObservable) to the source observable.↵What happens in the subscription bit is different for each operator, but the things that need to happen when source throws an error or completes are always the same
15:08:18FromDiscord<Phil (he/him)> ... Things are going surprisingly well.↵I mean, I still can't avoid work being done immediately when you put an operator on top of a cold observable
15:08:19FromDiscord<Phil (he/him)> But I feel like that's unavoidable at this point
15:13:08FromDiscord<Phil (he/him)> Then again, I'm not entirely sure if async makes sense here
15:13:31FromDiscord<Phil (he/him)> Then again, I'm not entirely sure if async makes sense here. Whatever async stuff gets going should just be capable of calling "next" when needed
15:18:52*def- quit (Quit: -)
15:20:22*def- joined #nim
15:47:22FromDiscord<Phil> Okay I don't get it
15:48:05FromDiscord<nnsee> In reply to @pk.kyle "where do i report": the nim lang github
15:48:06FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=INCaJAUJiQoI
15:52:17FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=TFtVzfwdxuUx
15:53:58*ntat joined #nim
15:59:29*def- quit (Quit: -)
16:00:14*def- joined #nim
16:18:50FromDiscord<Phil> Likely some issue with me wanting it to figure out whether parent is an observable/subject on its own
16:18:54FromDiscord<Phil> And the compiler being unable to
16:19:06FromDiscord<Phil> (edit) "it" => "the compiler"
16:24:36FromDiscord<Phil> sent a long message, see https://pasty.ee/verxIlliMvkc
16:37:49*krux02_ joined #nim
16:39:12*disso-peach joined #nim
16:40:51*krux02 quit (Ping timeout: 268 seconds)
16:53:39*def- quit (Quit: -)
16:54:05*def- joined #nim
16:57:48*MacDef quit (Quit: WeeChat 4.2.2)
17:26:40FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=EnMbJMXjXJuU
17:26:47FromDiscord<Robyn [She/Her]> In reply to @isofruit "Okay I'm in a": How about references?
17:27:13FromDiscord<Robyn [She/Her]> Pointers
17:27:17FromDiscord<Robyn [She/Her]> Not references
17:27:23FromDiscord<Robyn [She/Her]> You wanna store arbitrary types
17:27:36FromDiscord<Phil> The pointers would require me to cast correctly at the place where I call
17:27:42FromDiscord<Robyn [She/Her]> True
17:27:46FromDiscord<Phil> And I can not know whether a parent is a Subject or an Observable
17:27:57FromDiscord<Robyn [She/Her]> No clue then, sorry
17:28:12FromDiscord<Phil> Basically this wouldn't be an issue if nim just had solutions for this, but no it does not
17:28:30FromDiscord<Robyn [She/Her]> std/any?
17:28:36FromDiscord<Robyn [She/Her]> I think that's the module
17:28:43FromDiscord<Phil> No, just fix concepts and or generic methods
17:28:48FromDiscord<Robyn [She/Her]> Not ideal but it is a solution
17:29:01FromDiscord<Robyn [She/Her]> In reply to @isofruit "No, just fix concepts": Yeah but you want something to work rn
17:29:48FromDiscord<Phil> As for std/any, I know of nothing
17:30:18FromDiscord<Phil> There's the any type but that reeks of being JS specific
17:31:58FromDiscord<mf.trong> sent a code paste, see https://play.nim-lang.org/#pasty=heYqKPTLzEUC
17:36:05FromDiscord<Phil> In reply to @chronos.vitaqua "Yeah but you want": That will fail with:↵`Error: type mismatch: got 'Subject[system.int]' for 'source' but expected 'Any = object'`
17:36:29FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=TxRckOlPobgE
17:36:56FromDiscord<Phil> I'll have to see, maybe I can come up with some kind of hacky solution and a ton of proc overloading.↵Basically completely fucks the interface approach but that's the lang for you
17:41:14FromDiscord<Phil> In reply to @mf.trong "yall, I have a": currentTime is a unixtimestamp
17:41:22FromDiscord<Phil> whatever you're handing in initTime is that number of seconds
17:41:35FromDiscord<Phil> A propper unix timestamp will always be vastly larger than like... 20 seconds
17:41:42FromDiscord<Phil> Thus all the if-statements run
17:42:19FromDiscord<Phil> In reply to @mf.trong "yall, I have a": And yeah elifs are pretty much how things just work in languages typically - the first condition that matches is the branch that gets executed 😛
17:42:49FromDiscord<mf.trong> so
17:43:11FromDiscord<mf.trong> what function should I use if I wanted to compare currentTime to a timestamp
17:43:31FromDiscord<mf.trong> example: 6pm == 6pm↵echo "ran me"
17:44:45FromDiscord<odexine> In reply to @aintea "Purely aesthetically, is there": Postfix operators don’t exist in Nim, aside from the export “operator”
17:51:10FromDiscord<Phil> In reply to @mf.trong "example: 6pm == 6pm": So you want two times irrespective of date but in the same location to have the same time?
17:51:18FromDiscord<Phil> I'd honestly just consider using DateTime, it has an hours proc
17:51:30FromDiscord<mf.trong> alright
17:51:32FromDiscord<mf.trong> thank you
17:52:03FromDiscord<Phil> Just write yourself your own comparison proc where you check that hours, minutes, seconds, milliseconds etc. are the same
17:52:20FromDiscord<Phil> How fine-granular you want to be is up to you (are nano/micro/millisecond-differences relevant or not?)
17:52:37FromDiscord<Phil> (edit) "time?" => "value?"
17:53:45FromDiscord<mf.trong> not to me
17:54:08FromDiscord<mf.trong> I just wanted to compare hours really, I might make it a cli cmd where it can be dependent
17:54:15FromDiscord<mf.trong> but thats all up to the function
17:54:22FromDiscord<mf.trong> I appreciate the help
17:55:36FromDiscord<Robyn [She/Her]> In reply to @isofruit "That will fail with:": Rip
18:07:29*ntat quit (Quit: Leaving)
18:15:44*coldfeet quit (Remote host closed the connection)
18:45:34*def- quit (Quit: -)
18:46:29*def- joined #nim
18:55:52FromDiscord<Elegantbeef> Traitor↵(@Phil)
19:00:55FromDiscord<Phil> Does traitor do generic traits?
19:01:25FromDiscord<nnsee> i thought he was just calling you out, lol
19:01:44FromDiscord<Elegantbeef> Ping
19:01:47FromDiscord<Phil> Nah, it's his implementation for interfaces
19:02:01FromDiscord<ElegantBeef> Hmph my matrix client is glitched 😄
19:02:02FromDiscord<ElegantBeef> https://github.com/beef331/traitor/blob/master/tests/tgeneric.nim
19:02:09FromDiscord<ElegantBeef> Depends what you need
19:02:36FromDiscord<ElegantBeef> as long as the `Atom` is the only generic part yes, otherwise no
19:03:01FromDiscord<ElegantBeef> The issue with fully generic traits is that they have no static type, so they're fully dynamically dispatched
19:03:29FromDiscord<ElegantBeef> It's the same issue as `method doThing(a: Bleh[T], val: T)`
19:03:59FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=VWZhXjgiNkKc
19:04:20FromDiscord<ElegantBeef> Sure but does it store `Subject[int]` with `Subject[float]`?
19:04:21*def- quit (Quit: -)
19:04:31FromDiscord<ElegantBeef> Cause traitor would work fine here otherwise
19:04:47FromDiscord<Phil> Nah, it wouldn't
19:05:04FromDiscord<Phil> Just not sure how the split would look like because from the usage examples it doesn't look like I can just replace T with ATom
19:05:06FromDiscord<Phil> (edit) "ATom" => "Atom"
19:05:08FromDiscord<ElegantBeef> So then traitor would work as `Atom` is the only generic parameter
19:05:32FromDiscord<ElegantBeef> You would not even need the generic parameter
19:05:52FromDiscord<ElegantBeef> Well I guess you would for the return type
19:06:08FromDiscord<Phil> If I want to have field access do I define getters or are there syntax-ways to deal with that?
19:06:15FromDiscord<ElegantBeef> getters
19:06:39*def- joined #nim
19:06:41FromDiscord<ElegantBeef> Everything is converted into a procedure call for sanities sake
19:06:58FromDiscord<ElegantBeef> You can of course write a procedure that calls the getters
19:07:24FromDiscord<ElegantBeef> `proc bleh[T](_: AnyTraitor[Observable[T]])`
19:09:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=PekxEQhsfTKx
19:09:59*def- quit (Client Quit)
19:10:31FromDiscord<ElegantBeef> Yea
19:10:40FromDiscord<ElegantBeef> Or there abouts
19:11:29FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#pasty=hIfkFVYGnBgl
19:11:47*def- joined #nim
19:12:21FromDiscord<ElegantBeef> Nim methods could work with this, though they warn about it
19:12:28FromDiscord<Phil> I tend not to fuck with operator overloading when starting out, I consider it one of nim's more esoteric features that I branch into once the "refinement" stage is reached
19:13:20FromDiscord<Phil> Same with how I don't start out with macros, just that in this case I agree that the `complete=` variant is objectively more readable, but it fucks me up often enough that I tend to postpone it to a stage where I know the code works
19:13:49FromDiscord<ElegantBeef> Also cause runtime Traitors are `ref object` you can drop your `ref object`
19:14:31FromDiscord<Elegantbeef> Lol the solution to my client's glitched state was changing channel
19:14:34FromDiscord<Phil> so Subject and Observable become just object?
19:14:49FromDiscord<Elegantbeef> If you want to remove a pointer indirection
19:15:00FromDiscord<Phil> I'll keep them as-is for now due to the mental model
19:15:09FromDiscord<Phil> But I'll keep that as a potential optimization in mind
19:15:28FromDiscord<Elegantbeef> As long as you pass `MyObject.toTrait(Reactable)` instead of `MyObject()` they'll point to the same thing
19:20:10FromDiscord<Phil> Okay so first question going into the generic side of things
19:21:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=ergvkRtAttqw
19:21:34FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=JykldAeHkotQ" => "https://play.nim-lang.org/#pasty=GxnSiUoJNnBm"
19:21:49FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=WzbNscjGvOAj" => "https://play.nim-lang.org/#pasty=qXaHejZgHOdZ"
19:22:42FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=SseZncJcAfLm
19:22:50*def- quit (Quit: -)
19:23:19*def- joined #nim
19:23:25FromDiscord<Phil> Which of these lines is line 14 for you?
19:23:43FromDiscord<Elegantbeef> `func isOk[T, E](x: Result[T, E]): bool = x.kind == OkKind`
19:23:45FromDiscord<aintea> `func Ok[T, E]`
19:23:59FromDiscord<aintea> Because I have some comments at the top
19:24:02FromDiscord<Elegantbeef> Nim does not have result inference
19:24:13FromDiscord<Elegantbeef> `Ok(value)` does not specify `E`
19:24:20FromDiscord<Elegantbeef> `Ok[string](value)`
19:24:28FromDiscord<aintea> (edit) "https://play.nim-lang.org/#pasty=NibUvDdLwScG" => "https://play.nim-lang.org/#pasty=badAYANKgIyQ"
19:24:40FromDiscord<Phil> You may be better of specifying ErrorKind as "CatchableError" maybe (?)
19:24:57FromDiscord<Elegantbeef> Damn Phil breaking traitor within 30s of using it 😄
19:25:24FromDiscord<aintea> In reply to @Elegantbeef "`Ok[string](value)`": So how would I do something similar ?
19:25:31FromDiscord<Elegantbeef> You don't
19:25:46FromDiscord<Phil> In reply to @Elegantbeef "Damn Phil breaking traitor": I've come back with a vengeance
19:26:12FromDiscord<aintea> In reply to @Elegantbeef "You don't": So I can't ? How does the standard library do it ?
19:26:41FromDiscord<Elegantbeef> The standard library does not have an `ok(value)` that returns `Result[T, E]`
19:27:14FromDiscord<Phil> Not 2 days after I've become slightly more active and I've already burnt concepts, slammed against "generic methods are a nono but would be really sick if they worked" and broken traitor
19:27:29FromDiscord<Phil> In reply to @aintea "So I can't ?": Also you could make E a hard-coded type that you inherit from
19:27:29FromDiscord<Elegantbeef> Well they do work phil 😄
19:27:53FromDiscord<Phil> In reply to @Elegantbeef "Well they do work": I'm like 80% certain they broke in some circumstances like a year ago when I tried them
19:27:58FromDiscord<Phil> Beyond just the deprecation warnings
19:28:21FromDiscord<Elegantbeef> Did you by chance accidently have parameters that were generic?
19:28:58FromDiscord<Phil> That's over a year in the past, but it's me, so I would bet so
19:29:13FromDiscord<Phil> I tend to have tried generics in all variations inside of all things
19:29:25FromDiscord<Phil> And repeatedly slammed into "does not work" scenarios
19:29:43FromDiscord<Phil> Like in this case with generic concepts
19:30:21FromDiscord<Elegantbeef> Ah found the issue with traitor, I did not remove the symbol from the result type
19:41:20FromDiscord<Robyn [She/Her]> What'd be more concise than `"Array": (true, @[{Identifier}, {Identifier, NumLiteral}])` stored in a table?↵Purpose is to store a type in my language, if it is a generic type, and then how many arguments of what `AstKind`s it can accept
19:43:41FromDiscord<Elegantbeef> Phil there is a new version of traitor
19:44:08FromDiscord<Robyn [She/Her]> This seems a tad messy, I could probably make a template hm
20:03:14*cnx quit (Remote host closed the connection)
20:03:24FromDiscord<Phil> Errrrrrr
20:04:10FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=EsfpjkqIrQuu
20:04:44FromDiscord<Elegantbeef> Converters of generics are always fun
20:05:30*cnx joined #nim
20:06:16FromDiscord<Phil> I think I'll just focus on the proc overload approach and hopefully that'll be enough, maybe that can even get me towards my original goal
20:06:38FromDiscord<Elegantbeef> Damn there goes my first user of traitor, left in despair
20:06:51FromDiscord<Robyn [She/Her]> Lol
20:06:54FromDiscord<Phil> Your problem there was that this was my third or fourth attempt at solving the problem
20:07:10*def- quit (Quit: -)
20:07:13FromDiscord<Robyn [She/Her]> Once I actually make my MC server and not just the tools surrounding it I'll look into using Traitor, Beef
20:07:13FromDiscord<Elegantbeef> Wait it worked here...
20:07:24FromDiscord<Phil> And I am not sure how the problems I'm having can even be tackled by a lib when they're fundamentally the compiler being not capable enough
20:07:51FromDiscord<Elegantbeef> Wait you lied to me you did not show usage
20:08:29FromDiscord<Phil> I did not use it yet, I was first trying to see if it even compiles
20:08:43FromDiscord<Elegantbeef> It does compile until you attempt to use the converter
20:09:07FromDiscord<Phil> Don't I have to use converter?
20:09:22FromDiscord<Elegantbeef> Converters are implicit
20:09:41FromDiscord<Elegantbeef> `implTrait` emits the `toTrait` that you can use explicitly
20:09:50FromDiscord<Elegantbeef> `emitConverter` emits the converter that is called implicitly
20:10:50FromDiscord<Phil> Wait, where the heck... I had some example code at the bottom of the page but nothing was using "Reactable"
20:11:15FromDiscord<Elegantbeef> I can only say that without attempting to use the converter it compiled here, not that the converter works
20:11:31FromDiscord<Phil> This is all I have there https://media.discordapp.net/attachments/371759389889003532/1231698852038316135/message.txt?ex=6637e7f2&is=662572f2&hm=e6b8bed8100a8875388204181528d81216d00afde57d42b85f9683acf20607f4&
20:11:39FromDiscord<pmunch> Finally found five minutes to write that forum post
20:13:15FromDiscord<pmunch> Kinda want to port this to Nim.. https://github.com/wapmorgan/TimeParser
20:13:35FromDiscord<Elegantbeef> Phil I can only say the converter is being invoked somewhere
20:13:43FromDiscord<Elegantbeef> Personally I despise the `emitConverter` 😄
20:15:01FromDiscord<Elegantbeef> Seems i do need to convert it into a macro
20:17:53FromDiscord<pmunch> Hmm, or maybe something slightly more robust..
20:26:40*def- joined #nim
20:30:47*def- quit (Client Quit)
20:31:35FromDiscord<pmunch> Something like Chronic would be great..
20:31:46FromDiscord<pmunch> But that's a much larger library unfortunately
20:44:08FromDiscord<Phil> I'm migrating to implicit interfaces... or just making myself an "interface" in the shape of forward declarations
20:49:45FromDiscord<Robyn [She/Her]> Okay I'm getting so fucking annoyed rn
20:50:02FromDiscord<Robyn [She/Her]> Every. Single. Edit I make. Makes the langserver restart
20:53:51FromDiscord<the_real_hypno> But you can also use the converter explicitly? ↵↵Or am i misunderstanding the topic?
20:54:14FromDiscord<Elegantbeef> You can use converters explicitly yes
20:54:27FromDiscord<the_real_hypno> Sorry that was no question 😛
20:54:40FromDiscord<Elegantbeef> The converter is incorrectly generated(not really, just Nim is being silly) and it's being used somewhere
20:54:51FromDiscord<the_real_hypno> Or well, it was one but for the answer following that :p
20:55:12FromDiscord<the_real_hypno> Are you working with Nim or C there?
20:55:16FromDiscord<Elegantbeef> Just not using the traitor converters and explicitly converting is a better world
20:55:29FromDiscord<the_real_hypno> I had a Huge war with C and converters
20:55:34FromDiscord<Phil> Nim as both for him and myself
20:56:11FromDiscord<Phil> I still regard converters as an anti-pattern like 95% of the time, though I'll admit there are rares usecases for it when you want to actually hide a type from your users as a lib-author
20:56:36FromDiscord<the_real_hypno> Before that C project i would have disagreed
20:56:45FromDiscord<the_real_hypno> I learned it the hard way though
20:56:54FromDiscord<Phil> Implicitly called procs are scary
20:56:56FromDiscord<Phil> So damn scary
20:57:05FromDiscord<the_real_hypno> In the end i could rewrite the whole program
20:57:36FromDiscord<Phil> They'll mess with you always when you least expect it. They demand a permanent context window in your brain that just isn't feasible to have open most of the time
20:57:50FromDiscord<the_real_hypno> Since i imported C functions, at some point the linker started to claimed bad linkage
20:57:59FromDiscord<the_real_hypno> And then the actual issues started
21:00:38FromDiscord<Elegantbeef> The thing is Phil with traitor is the Converter is quite literally a single line 😄
21:00:48FromDiscord<فحل نـــياكـ> Hi
21:01:24FromDiscord<Elegantbeef> It's really just `converter convToTrait(val: sink T, target: typedesc): target = val.toTrait(target)`
21:02:12FromDiscord<فحل نـــياكـ> Hi
21:02:18FromDiscord<فحل نـــياكـ> hlow
21:02:23FromDiscord<Elegantbeef> Phil you're going to want to ban someone
21:07:00FromDiscord<Robyn [She/Her]> In reply to @فحل نـــياكـ "Hi": <@&371760044473319454> 🙃
21:08:16FromDiscord<Phil> There, that should be all
21:09:13*def- joined #nim
21:12:08FromDiscord<the_real_hypno> Plotwist: project needs to get rewritten :kekw:
21:17:31*om3ga quit (Ping timeout: 260 seconds)
21:18:22FromDiscord<griffith1deadly> In reply to @chronos.vitaqua "Every. Single. Edit I": i know this pain...
21:18:51FromDiscord<griffith1deadly> also with nimforue nimsuggest even dont work for u.. except hover at `uClass` macro call/
21:19:04FromDiscord<griffith1deadly> even no errors
21:28:59FromDiscord<Robyn [She/Her]> This is painful honestly
21:33:30FromDiscord<griffith1deadly> i totally hate nimsuggest
21:37:07*def- quit (Quit: -)
21:37:27FromDiscord<Robyn [She/Her]> If only I understood compiler internals better
21:49:54*xet7 joined #nim
21:56:06*def- joined #nim
22:01:50FromDiscord<bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=unzkvVaVmJcJ
22:21:38FromDiscord<nikolay_a_k> Hi. Does exist llama.cpp wrapper/bindings for nim?
22:23:48FromDiscord<bosinski2023> not a wrapper, but a port AFAIK https://github.com/Vindaar/llama2nim
22:29:08*def- quit (Quit: -)
22:29:30*def- joined #nim
22:36:05*def- quit (Quit: -)
22:37:25FromDiscord<nikolay_a_k> sent a long message, see https://pasty.ee/jvfBsiKRccxK
22:39:03*def- joined #nim
22:42:08FromDiscord<nikolay_a_k> I tried to do it like this: nim c -d:useNimRtl llama2.nim But got an error: C:\nim\lib\pure\streams.nim(1306, 30) Error: type mismatch: got 'proc (s: Stream, buffer: var string, slice: Slice[system.int]): int{.noSideEffect, gcsafe.}' for 'ssReadDataStr' but expected 'proc (s: Stream, buffer: var string, slice: Slice[system.int]): int{.nimcall, gcsafe.}'↵.raise effects differ
22:49:18*def- quit (Quit: -)
22:49:31*def- joined #nim
22:49:44FromDiscord<bosinski2023> In reply to @nikolay_a_k "Thanks, i knew about": sry, can't help you on this one - maybe Beef knows ?
23:03:29*xet7 quit (Remote host closed the connection)
23:22:22*lucasta joined #nim