00:29:21 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> Likely a bug with arc/orc |
00:48:40 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/issues/23524 issue created |
01:08:26 | * | lucasta quit (Quit: Leaving) |
01:21:43 | FromDiscord | <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:58 | FromDiscord | <albassort> where is Exception message: Connection was closed before full request has been made raised from |
02:05:13 | FromDiscord | <albassort> or rather |
02:05:43 | FromDiscord | <albassort> sent a code paste, see https://paste.rs/0ibgE |
02:05:55 | FromDiscord | <albassort> but how can i figure out which response it is and then retry that one |
02:13:06 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=AyzKfNQvLHBN |
02:13:21 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=eIzhLOGAujQB" => "https://play.nim-lang.org/#pasty=bNvQmrEuYwFR" |
02:13:22 | FromDiscord | <albassort> this is silly |
02:53:38 | FromDiscord | <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:38 | FromDiscord | <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:24 | FromDiscord | <albassort> Yes me too |
03:58:05 | FromDiscord | <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:06 | FromDiscord | <Phil> Is there any kind of syntax to "unpack" a tuple? |
06:10:35 | FromDiscord | <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:41 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=DFLtiowHWPku |
06:13:37 | FromDiscord | <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:20 | FromDiscord | <Elegantbeef> recursively or just once?↵(@Phil) |
06:28:12 | FromDiscord | <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:25 | FromDiscord | <Phil> So I can't hard-code anything |
06:28:38 | FromDiscord | <Elegantbeef> You will need a macro for this cause you need to generate a new type.... hmmmm |
06:28:59 | FromDiscord | <Phil> If that's the case I might as well go an easier route |
06:29:10 | FromDiscord | <Phil> Basically this was about combining observables |
06:29:39 | FromDiscord | <Phil> Where I could either overload the `&` operator and flatten whatever tuples that creates |
06:30:06 | FromDiscord | <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:52 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=BznwNAaaWyHe |
06:31:18 | FromDiscord | <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:05 | FromDiscord | <odexine> @Phil i hate you now im looking at rex and thinking reactive again |
06:46:39 | FromDiscord | <Phil> Hah! Its good stuff |
06:54:10 | FromDiscord | <Elegantbeef> Braintrapped me @Phil https://play.nim-lang.org/#pasty=PqfxwNEuoCSz |
06:54:32 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#pasty=tbVGNnDYmsMU |
06:54:35 | FromDiscord | <Elegantbeef> Just a little bit of stringification shenangians |
06:55:20 | FromDiscord | <odexine> rxjs is very much modelled with the assumption that async/an event loop is available at all times |
06:56:14 | FromDiscord | <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:22 | FromDiscord | <Phil> That stringificatin shenanigans looks neat, but also unholy |
07:39:31 | FromDiscord | <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:48 | FromDiscord | <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:17 | FromDiscord | <Phil> Like `map` has to somehow forward every change from the source observable to all its subscribers (after applying the map function) |
09:34:35 | FromDiscord | <Phil> Actuall no I see it, uuuugh just not nice |
09:53:47 | FromDiscord | <odexine> In reply to @isofruit "I honestly have no": im really not as well versed as you are with reactive |
09:54:02 | FromDiscord | <odexine> mainly because i didnt really think of it as intuitive |
09:55:15 | FromDiscord | <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:08 | FromDiscord | <odexine> i mean, the idea is intuitive, the implementation has not for me |
10:11:35 | FromDiscord | <Phil> The idea is an absolute mindfuck |
10:11:53 | FromDiscord | <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:06 | FromDiscord | <Phil> Where operators all kind-of do the same but also not |
10:12:30 | FromDiscord | <Phil> And where Subjects and Observables are insanely close in terms of behavior but then again ultimately aren't |
10:12:59 | FromDiscord | <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:28 | FromDiscord | <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:36 | FromDiscord | <docRekd> I mean Observable is just a read only view on some Subjects |
10:14:47 | FromDiscord | <docRekd> please elaborate↵(@Phil) |
10:15:50 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=SIXYxouPHNfx |
10:15:59 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#pasty=VtmGDBJwCfpC" => "https://play.nim-lang.org/#pasty=OyfAhbuSpFRT" |
10:16:36 | FromDiscord | <Phil> How to do that is beyond me because I can't seem to get the mental model for it |
10:17:11 | FromDiscord | <Phil> I can do eager observables all day, any day.↵But in that case filter is getting executed even without any subscripitions |
10:17:35 | FromDiscord | <docRekd> again I don't see the problem, unless you're talking of some implementation |
10:17:44 | FromDiscord | <Phil> I'm talking about the implementation |
10:17:50 | FromDiscord | <Phil> Let me set up an example with tap |
10:18:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=gNTKlpbLrryy |
10:19:05 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#pasty=TCBTvaxekdRo" => "https://play.nim-lang.org/#pasty=OKJwQtjgvFyr" |
10:19:13 | FromDiscord | <Phil> Or rather the procs in them get run on the observable value |
10:20:39 | FromDiscord | <docRekd> the map method returns a object where its subscribe method simply call the parent's with x-\@Phil) |
10:20:45 | FromDiscord | <Phil> sent a long message, see https://pasty.ee/DsPMJfzVEbYk |
10:20:51 | FromDiscord | <Phil> Which is super inefficient |
10:21:20 | FromDiscord | <Phil> (edit) "https://pasty.ee/mzFRwuftgBey" => "https://pasty.ee/xTJEtQSjNipY" |
10:21:58 | FromDiscord | <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:04 | FromDiscord | <Phil> (edit) "In reply to @docRekd "the map method returns": Which means I can't do a ... subscribe" added "general" |
10:22:10 | FromDiscord | <docRekd> depends on the specific language. something like c++ or nim can optimize it no problem |
10:22:42 | FromDiscord | <Phil> You think the compiler would manage to optimize out the observable pattern? |
10:22:53 | FromDiscord | <Phil> Because I know the underlying implementation in this case and it is not optimized |
10:23:01 | FromDiscord | <Phil> So the compiler is your only hope for optimization there |
10:23:31 | FromDiscord | <docRekd> you have a Map type with the given subscribe↵(@Phil) |
10:24:29 | FromDiscord | <docRekd> Again I am speaking generally, I don't know which implementation you're referring to↵(@Phil) |
10:24:45 | FromDiscord | <Phil> The one from rex that I'm playing around with because it gives a baseline |
10:25:02 | FromDiscord | <Phil> One sec |
10:25:16 | FromDiscord | <Phil> https://github.com/minamorl/rex/blob/main/src/rex.nim |
10:25:17 | FromDiscord | <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:04 | FromDiscord | <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:33 | FromDiscord | <Phil> But the way this works is essentially allocating a new observable every operation |
10:27:26 | FromDiscord | <docRekd> I suggest you to make Observable an interface while Subject could be a concrete type |
10:28:51 | FromDiscord | <docRekd> then create in each proc like map etc an object that implements Observable |
10:29:38 | FromDiscord | <docRekd> now the only problem would be to optimize away the closure |
10:29:59 | FromDiscord | <docRekd> rust does it by making every individual |
10:30:32 | FromDiscord | <docRekd> function and lambda a separate type inhabited by such lambda |
10:30:54 | FromDiscord | <docRekd> and Fn is merely a trait |
10:31:34 | FromDiscord | <docRekd> I'm not familiar with nim's specific semantics in this respect |
10:31:51 | * | def- quit (Quit: -) |
10:32:10 | FromDiscord | <docRekd> you could try and make them templates |
10:32:51 | * | def- joined #nim |
10:45:32 | FromDiscord | <pk.kyle> are there libraries that are similar to python's sympy in nim? |
10:48:22 | FromDiscord | <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:27 | FromDiscord | <odexine> at least thats how i understand it |
10:49:55 | FromDiscord | <odexine> its a bit messy to understand |
10:50:11 | FromDiscord | <odexine> and a distinction to make is that iirc this is specific to reactivex and not reactive programming in general |
11:33:59 | FromDiscord | <s0cketinc> hi |
11:34:00 | FromDiscord | <s0cketinc> hlo |
11:34:14 | FromDiscord | <s0cketinc> bye |
11:34:15 | FromDiscord | <s0cketinc> lol |
11:34:16 | FromDiscord | <s0cketinc> man |
11:34:21 | FromDiscord | <odexine> ??? |
11:42:48 | FromDiscord | <goerge_lsd> no reasonable lib for spatial geometry ? I just want to import point, linestring etc types from somewhere |
11:51:28 | FromDiscord | <goerge_lsd> https://github.com/huaxk/nimgeo just this ? |
11:52:33 | FromDiscord | <goerge_lsd> which doesn't even compile in nim 2.0 |
12:02:40 | FromDiscord | <docRekd> more a subtype of both, as it can replace both↵(@odexine) |
12:03:15 | FromDiscord | <odexine> why would it be a subtype in that case |
12:03:36 | FromDiscord | <odexine> as a legitimate question, not with the tone i think youre thinking of |
12:03:51 | FromDiscord | <docRekd> https://en.wikipedia.org/wiki/Liskov_substitution_principle↵(@odexine) |
12:03:59 | FromDiscord | <odexine> ah this |
12:09:25 | FromDiscord | <odexine> i think i can ideate better with this reframed in a typeclass-style way rather than oop |
12:09:50 | FromDiscord | <odexine> where observable and observer are just tcs and subject is just something with both tcs |
12:10:40 | FromDiscord | <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:06 | FromDiscord | <pk.kyle> how do i turn a number like `987999999.9999994` back to `988000000.0` |
12:49:10 | FromDiscord | <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:23 | FromDiscord | <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:20 | FromDiscord | <docRekd> remember that observer is merely an interface↵(@Phil) |
12:50:25 | FromDiscord | <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:33 | FromDiscord | <Phil> In reply to @docRekd "remember that observer is": Sure but the meaning is still different to me |
12:51:12 | FromDiscord | <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:22 | FromDiscord | <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:02 | FromDiscord | <odexine> In reply to @isofruit "Like, you can use": im under the impression that observers have a next. |
12:52:05 | FromDiscord | <Phil> in which case you can use `round` |
12:52:24 | FromDiscord | <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:44 | FromDiscord | <Phil> But that in the way you use it is very different from `next` on a subject |
12:52:50 | FromDiscord | <odexine> i dont think the next of a subject and the next of an observer are too different |
12:53:27 | FromDiscord | <odexine> including the behaviour in the definition of a thing has problems, i think |
12:54:22 | FromDiscord | <odexine> well, rekd showed it with the liskov subst. link, i think? |
12:54:41 | FromDiscord | <docRekd> if it walks like a duck and quack like a duck… |
12:55:23 | FromDiscord | <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:26 | FromDiscord | <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:33 | FromDiscord | <docRekd> you would have to duplicate the map, filter… implementations↵(@Phil) |
12:56:55 | FromDiscord | <Phil> Why? map etc. function on the reactive types, not an observers |
12:57:12 | FromDiscord | <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:19 | FromDiscord | <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:58 | FromDiscord | <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:46 | FromDiscord | <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:52 | FromDiscord | <Phil> At least if you were to replicate RXJS |
13:34:50 | FromDiscord | <docRekd> Observable is an interface, the subscribe is different for each implementatioon↵(@Phil) |
13:34:58 | FromDiscord | <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:37 | FromDiscord | <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:06 | FromDiscord | <docRekd> it's how I would plan on optimizing away the intermediate steps |
13:36:42 | FromDiscord | <Phil> Either way, likely means different subscribe procs for different types.↵Shared operator procs most likely |
13:43:15 | FromDiscord | <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:36 | FromDiscord | <docRekd> yes any type with a subscribe method would be an observable |
13:43:37 | FromDiscord | <docRekd> and map&co would return separate structures with their own subscribe implementation |
13:43:37 | FromDiscord | <Phil> At least until I can come up with a better name |
13:44:42 | FromDiscord | <Phil> Damn how did concepts check again that a specific proc was defined... |
13:45:09 | FromDiscord | <docRekd> Rusr too return explicit structs that implement Iterable↵(@Phil) |
13:45:23 | FromDiscord | <docRekd> I thenk we are violently agreeing |
13:45:45 | FromDiscord | <Phil> The only thing being violent is my head banging against the reactive wall |
13:46:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=afJeTsdWBWvL |
13:46:43 | FromDiscord | <Phil> The concept doesn't work fully because the check for "is a subscribe proc available" doesn't work |
13:47:00 | FromDiscord | <Phil> Without it you can run some basics with it at least |
13:51:36 | * | MacDef joined #nim |
13:51:43 | FromDiscord | <Phil> In reply to @docRekd "then create in each": Here you mean that each operator function creates a new Observable-instance correct? |
13:52:02 | FromDiscord | <Phil> So basically how the implementation of the operators already works in a sense |
13:52:29 | FromDiscord | <docRekd> yes a MapObservable,FilterObservable…↵(@Phil) |
13:52:56 | FromDiscord | <Phil> Hmmm not sure if there's a need to have separate returntypes |
13:53:01 | FromDiscord | <Phil> But I'll see during implementation |
13:54:24 | * | MacDefender quit (Ping timeout: 260 seconds) |
13:57:18 | FromDiscord | <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:01 | FromDiscord | <Phil> Or maybe they don't, all this Observable instantiation just makes me so damn hesitant |
14:06:59 | FromDiscord | <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:24 | FromDiscord | <Phil> Wait, no you can't you need to use closures there, hmm |
14:07:43 | FromDiscord | <docRekd> maybe templates?↵(@Phil) |
14:08:09 | FromDiscord | <Phil> Yeah, that's something to potentially use as a "clean-up" operation after the code is written in this case |
14:09:02 | FromDiscord | <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:57 | FromDiscord | <Phil> I have written in neither so tough I'm not familiar on an intuitive level with that in particular |
14:10:09 | FromDiscord | <Phil> Either way, static dispatch in this case works well enough |
14:26:55 | FromDiscord | <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:37 | FromDiscord | <docRekd> bidirectional dataflow is a hell unto itself |
14:28:41 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=PkgAcdXqMvbf |
14:29:08 | FromDiscord | <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:43 | FromDiscord | <Phil> Huh, nevermind, it suddenly works now? |
14:34:46 | FromDiscord | <Phil> OHHHHHHH no it worked fine before, I was being an idiot |
14:35:21 | FromDiscord | <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:23 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=PcilDHcOxRQC |
14:47:09 | FromDiscord | <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:18 | FromDiscord | <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:19 | FromDiscord | <Phil (he/him)> But I feel like that's unavoidable at this point |
15:13:08 | FromDiscord | <Phil (he/him)> Then again, I'm not entirely sure if async makes sense here |
15:13:31 | FromDiscord | <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:22 | FromDiscord | <Phil> Okay I don't get it |
15:48:05 | FromDiscord | <nnsee> In reply to @pk.kyle "where do i report": the nim lang github |
15:48:06 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=INCaJAUJiQoI |
15:52:17 | FromDiscord | <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:50 | FromDiscord | <Phil> Likely some issue with me wanting it to figure out whether parent is an observable/subject on its own |
16:18:54 | FromDiscord | <Phil> And the compiler being unable to |
16:19:06 | FromDiscord | <Phil> (edit) "it" => "the compiler" |
16:24:36 | FromDiscord | <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:40 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=EnMbJMXjXJuU |
17:26:47 | FromDiscord | <Robyn [She/Her]> In reply to @isofruit "Okay I'm in a": How about references? |
17:27:13 | FromDiscord | <Robyn [She/Her]> Pointers |
17:27:17 | FromDiscord | <Robyn [She/Her]> Not references |
17:27:23 | FromDiscord | <Robyn [She/Her]> You wanna store arbitrary types |
17:27:36 | FromDiscord | <Phil> The pointers would require me to cast correctly at the place where I call |
17:27:42 | FromDiscord | <Robyn [She/Her]> True |
17:27:46 | FromDiscord | <Phil> And I can not know whether a parent is a Subject or an Observable |
17:27:57 | FromDiscord | <Robyn [She/Her]> No clue then, sorry |
17:28:12 | FromDiscord | <Phil> Basically this wouldn't be an issue if nim just had solutions for this, but no it does not |
17:28:30 | FromDiscord | <Robyn [She/Her]> std/any? |
17:28:36 | FromDiscord | <Robyn [She/Her]> I think that's the module |
17:28:43 | FromDiscord | <Phil> No, just fix concepts and or generic methods |
17:28:48 | FromDiscord | <Robyn [She/Her]> Not ideal but it is a solution |
17:29:01 | FromDiscord | <Robyn [She/Her]> In reply to @isofruit "No, just fix concepts": Yeah but you want something to work rn |
17:29:48 | FromDiscord | <Phil> As for std/any, I know of nothing |
17:30:18 | FromDiscord | <Phil> There's the any type but that reeks of being JS specific |
17:31:58 | FromDiscord | <mf.trong> sent a code paste, see https://play.nim-lang.org/#pasty=heYqKPTLzEUC |
17:36:05 | FromDiscord | <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:29 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=TxRckOlPobgE |
17:36:56 | FromDiscord | <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:14 | FromDiscord | <Phil> In reply to @mf.trong "yall, I have a": currentTime is a unixtimestamp |
17:41:22 | FromDiscord | <Phil> whatever you're handing in initTime is that number of seconds |
17:41:35 | FromDiscord | <Phil> A propper unix timestamp will always be vastly larger than like... 20 seconds |
17:41:42 | FromDiscord | <Phil> Thus all the if-statements run |
17:42:19 | FromDiscord | <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:49 | FromDiscord | <mf.trong> so |
17:43:11 | FromDiscord | <mf.trong> what function should I use if I wanted to compare currentTime to a timestamp |
17:43:31 | FromDiscord | <mf.trong> example: 6pm == 6pm↵echo "ran me" |
17:44:45 | FromDiscord | <odexine> In reply to @aintea "Purely aesthetically, is there": Postfix operators don’t exist in Nim, aside from the export “operator” |
17:51:10 | FromDiscord | <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:18 | FromDiscord | <Phil> I'd honestly just consider using DateTime, it has an hours proc |
17:51:30 | FromDiscord | <mf.trong> alright |
17:51:32 | FromDiscord | <mf.trong> thank you |
17:52:03 | FromDiscord | <Phil> Just write yourself your own comparison proc where you check that hours, minutes, seconds, milliseconds etc. are the same |
17:52:20 | FromDiscord | <Phil> How fine-granular you want to be is up to you (are nano/micro/millisecond-differences relevant or not?) |
17:52:37 | FromDiscord | <Phil> (edit) "time?" => "value?" |
17:53:45 | FromDiscord | <mf.trong> not to me |
17:54:08 | FromDiscord | <mf.trong> I just wanted to compare hours really, I might make it a cli cmd where it can be dependent |
17:54:15 | FromDiscord | <mf.trong> but thats all up to the function |
17:54:22 | FromDiscord | <mf.trong> I appreciate the help |
17:55:36 | FromDiscord | <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:52 | FromDiscord | <Elegantbeef> Traitor↵(@Phil) |
19:00:55 | FromDiscord | <Phil> Does traitor do generic traits? |
19:01:25 | FromDiscord | <nnsee> i thought he was just calling you out, lol |
19:01:44 | FromDiscord | <Elegantbeef> Ping |
19:01:47 | FromDiscord | <Phil> Nah, it's his implementation for interfaces |
19:02:01 | FromDiscord | <ElegantBeef> Hmph my matrix client is glitched 😄 |
19:02:02 | FromDiscord | <ElegantBeef> https://github.com/beef331/traitor/blob/master/tests/tgeneric.nim |
19:02:09 | FromDiscord | <ElegantBeef> Depends what you need |
19:02:36 | FromDiscord | <ElegantBeef> as long as the `Atom` is the only generic part yes, otherwise no |
19:03:01 | FromDiscord | <ElegantBeef> The issue with fully generic traits is that they have no static type, so they're fully dynamically dispatched |
19:03:29 | FromDiscord | <ElegantBeef> It's the same issue as `method doThing(a: Bleh[T], val: T)` |
19:03:59 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=VWZhXjgiNkKc |
19:04:20 | FromDiscord | <ElegantBeef> Sure but does it store `Subject[int]` with `Subject[float]`? |
19:04:21 | * | def- quit (Quit: -) |
19:04:31 | FromDiscord | <ElegantBeef> Cause traitor would work fine here otherwise |
19:04:47 | FromDiscord | <Phil> Nah, it wouldn't |
19:05:04 | FromDiscord | <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:06 | FromDiscord | <Phil> (edit) "ATom" => "Atom" |
19:05:08 | FromDiscord | <ElegantBeef> So then traitor would work as `Atom` is the only generic parameter |
19:05:32 | FromDiscord | <ElegantBeef> You would not even need the generic parameter |
19:05:52 | FromDiscord | <ElegantBeef> Well I guess you would for the return type |
19:06:08 | FromDiscord | <Phil> If I want to have field access do I define getters or are there syntax-ways to deal with that? |
19:06:15 | FromDiscord | <ElegantBeef> getters |
19:06:39 | * | def- joined #nim |
19:06:41 | FromDiscord | <ElegantBeef> Everything is converted into a procedure call for sanities sake |
19:06:58 | FromDiscord | <ElegantBeef> You can of course write a procedure that calls the getters |
19:07:24 | FromDiscord | <ElegantBeef> `proc bleh[T](_: AnyTraitor[Observable[T]])` |
19:09:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=PekxEQhsfTKx |
19:09:59 | * | def- quit (Client Quit) |
19:10:31 | FromDiscord | <ElegantBeef> Yea |
19:10:40 | FromDiscord | <ElegantBeef> Or there abouts |
19:11:29 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#pasty=hIfkFVYGnBgl |
19:11:47 | * | def- joined #nim |
19:12:21 | FromDiscord | <ElegantBeef> Nim methods could work with this, though they warn about it |
19:12:28 | FromDiscord | <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:20 | FromDiscord | <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:49 | FromDiscord | <ElegantBeef> Also cause runtime Traitors are `ref object` you can drop your `ref object` |
19:14:31 | FromDiscord | <Elegantbeef> Lol the solution to my client's glitched state was changing channel |
19:14:34 | FromDiscord | <Phil> so Subject and Observable become just object? |
19:14:49 | FromDiscord | <Elegantbeef> If you want to remove a pointer indirection |
19:15:00 | FromDiscord | <Phil> I'll keep them as-is for now due to the mental model |
19:15:09 | FromDiscord | <Phil> But I'll keep that as a potential optimization in mind |
19:15:28 | FromDiscord | <Elegantbeef> As long as you pass `MyObject.toTrait(Reactable)` instead of `MyObject()` they'll point to the same thing |
19:20:10 | FromDiscord | <Phil> Okay so first question going into the generic side of things |
19:21:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=ergvkRtAttqw |
19:21:34 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#pasty=JykldAeHkotQ" => "https://play.nim-lang.org/#pasty=GxnSiUoJNnBm" |
19:21:49 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#pasty=WzbNscjGvOAj" => "https://play.nim-lang.org/#pasty=qXaHejZgHOdZ" |
19:22:42 | FromDiscord | <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:25 | FromDiscord | <Phil> Which of these lines is line 14 for you? |
19:23:43 | FromDiscord | <Elegantbeef> `func isOk[T, E](x: Result[T, E]): bool = x.kind == OkKind` |
19:23:45 | FromDiscord | <aintea> `func Ok[T, E]` |
19:23:59 | FromDiscord | <aintea> Because I have some comments at the top |
19:24:02 | FromDiscord | <Elegantbeef> Nim does not have result inference |
19:24:13 | FromDiscord | <Elegantbeef> `Ok(value)` does not specify `E` |
19:24:20 | FromDiscord | <Elegantbeef> `Ok[string](value)` |
19:24:28 | FromDiscord | <aintea> (edit) "https://play.nim-lang.org/#pasty=NibUvDdLwScG" => "https://play.nim-lang.org/#pasty=badAYANKgIyQ" |
19:24:40 | FromDiscord | <Phil> You may be better of specifying ErrorKind as "CatchableError" maybe (?) |
19:24:57 | FromDiscord | <Elegantbeef> Damn Phil breaking traitor within 30s of using it 😄 |
19:25:24 | FromDiscord | <aintea> In reply to @Elegantbeef "`Ok[string](value)`": So how would I do something similar ? |
19:25:31 | FromDiscord | <Elegantbeef> You don't |
19:25:46 | FromDiscord | <Phil> In reply to @Elegantbeef "Damn Phil breaking traitor": I've come back with a vengeance |
19:26:12 | FromDiscord | <aintea> In reply to @Elegantbeef "You don't": So I can't ? How does the standard library do it ? |
19:26:41 | FromDiscord | <Elegantbeef> The standard library does not have an `ok(value)` that returns `Result[T, E]` |
19:27:14 | FromDiscord | <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:29 | FromDiscord | <Phil> In reply to @aintea "So I can't ?": Also you could make E a hard-coded type that you inherit from |
19:27:29 | FromDiscord | <Elegantbeef> Well they do work phil 😄 |
19:27:53 | FromDiscord | <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:58 | FromDiscord | <Phil> Beyond just the deprecation warnings |
19:28:21 | FromDiscord | <Elegantbeef> Did you by chance accidently have parameters that were generic? |
19:28:58 | FromDiscord | <Phil> That's over a year in the past, but it's me, so I would bet so |
19:29:13 | FromDiscord | <Phil> I tend to have tried generics in all variations inside of all things |
19:29:25 | FromDiscord | <Phil> And repeatedly slammed into "does not work" scenarios |
19:29:43 | FromDiscord | <Phil> Like in this case with generic concepts |
19:30:21 | FromDiscord | <Elegantbeef> Ah found the issue with traitor, I did not remove the symbol from the result type |
19:41:20 | FromDiscord | <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:41 | FromDiscord | <Elegantbeef> Phil there is a new version of traitor |
19:44:08 | FromDiscord | <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:24 | FromDiscord | <Phil> Errrrrrr |
20:04:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=EsfpjkqIrQuu |
20:04:44 | FromDiscord | <Elegantbeef> Converters of generics are always fun |
20:05:30 | * | cnx joined #nim |
20:06:16 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> Damn there goes my first user of traitor, left in despair |
20:06:51 | FromDiscord | <Robyn [She/Her]> Lol |
20:06:54 | FromDiscord | <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:13 | FromDiscord | <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:13 | FromDiscord | <Elegantbeef> Wait it worked here... |
20:07:24 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> Wait you lied to me you did not show usage |
20:08:29 | FromDiscord | <Phil> I did not use it yet, I was first trying to see if it even compiles |
20:08:43 | FromDiscord | <Elegantbeef> It does compile until you attempt to use the converter |
20:09:07 | FromDiscord | <Phil> Don't I have to use converter? |
20:09:22 | FromDiscord | <Elegantbeef> Converters are implicit |
20:09:41 | FromDiscord | <Elegantbeef> `implTrait` emits the `toTrait` that you can use explicitly |
20:09:50 | FromDiscord | <Elegantbeef> `emitConverter` emits the converter that is called implicitly |
20:10:50 | FromDiscord | <Phil> Wait, where the heck... I had some example code at the bottom of the page but nothing was using "Reactable" |
20:11:15 | FromDiscord | <Elegantbeef> I can only say that without attempting to use the converter it compiled here, not that the converter works |
20:11:31 | FromDiscord | <Phil> This is all I have there https://media.discordapp.net/attachments/371759389889003532/1231698852038316135/message.txt?ex=6637e7f2&is=662572f2&hm=e6b8bed8100a8875388204181528d81216d00afde57d42b85f9683acf20607f4& |
20:11:39 | FromDiscord | <pmunch> Finally found five minutes to write that forum post |
20:13:15 | FromDiscord | <pmunch> Kinda want to port this to Nim.. https://github.com/wapmorgan/TimeParser |
20:13:35 | FromDiscord | <Elegantbeef> Phil I can only say the converter is being invoked somewhere |
20:13:43 | FromDiscord | <Elegantbeef> Personally I despise the `emitConverter` 😄 |
20:15:01 | FromDiscord | <Elegantbeef> Seems i do need to convert it into a macro |
20:17:53 | FromDiscord | <pmunch> Hmm, or maybe something slightly more robust.. |
20:26:40 | * | def- joined #nim |
20:30:47 | * | def- quit (Client Quit) |
20:31:35 | FromDiscord | <pmunch> Something like Chronic would be great.. |
20:31:46 | FromDiscord | <pmunch> But that's a much larger library unfortunately |
20:44:08 | FromDiscord | <Phil> I'm migrating to implicit interfaces... or just making myself an "interface" in the shape of forward declarations |
20:49:45 | FromDiscord | <Robyn [She/Her]> Okay I'm getting so fucking annoyed rn |
20:50:02 | FromDiscord | <Robyn [She/Her]> Every. Single. Edit I make. Makes the langserver restart |
20:53:51 | FromDiscord | <the_real_hypno> But you can also use the converter explicitly? ↵↵Or am i misunderstanding the topic? |
20:54:14 | FromDiscord | <Elegantbeef> You can use converters explicitly yes |
20:54:27 | FromDiscord | <the_real_hypno> Sorry that was no question 😛 |
20:54:40 | FromDiscord | <Elegantbeef> The converter is incorrectly generated(not really, just Nim is being silly) and it's being used somewhere |
20:54:51 | FromDiscord | <the_real_hypno> Or well, it was one but for the answer following that :p |
20:55:12 | FromDiscord | <the_real_hypno> Are you working with Nim or C there? |
20:55:16 | FromDiscord | <Elegantbeef> Just not using the traitor converters and explicitly converting is a better world |
20:55:29 | FromDiscord | <the_real_hypno> I had a Huge war with C and converters |
20:55:34 | FromDiscord | <Phil> Nim as both for him and myself |
20:56:11 | FromDiscord | <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:36 | FromDiscord | <the_real_hypno> Before that C project i would have disagreed |
20:56:45 | FromDiscord | <the_real_hypno> I learned it the hard way though |
20:56:54 | FromDiscord | <Phil> Implicitly called procs are scary |
20:56:56 | FromDiscord | <Phil> So damn scary |
20:57:05 | FromDiscord | <the_real_hypno> In the end i could rewrite the whole program |
20:57:36 | FromDiscord | <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:50 | FromDiscord | <the_real_hypno> Since i imported C functions, at some point the linker started to claimed bad linkage |
20:57:59 | FromDiscord | <the_real_hypno> And then the actual issues started |
21:00:38 | FromDiscord | <Elegantbeef> The thing is Phil with traitor is the Converter is quite literally a single line 😄 |
21:00:48 | FromDiscord | <فحل نـــياكـ> Hi |
21:01:24 | FromDiscord | <Elegantbeef> It's really just `converter convToTrait(val: sink T, target: typedesc): target = val.toTrait(target)` |
21:02:12 | FromDiscord | <فحل نـــياكـ> Hi |
21:02:18 | FromDiscord | <فحل نـــياكـ> hlow |
21:02:23 | FromDiscord | <Elegantbeef> Phil you're going to want to ban someone |
21:07:00 | FromDiscord | <Robyn [She/Her]> In reply to @فحل نـــياكـ "Hi": <@&371760044473319454> 🙃 |
21:08:16 | FromDiscord | <Phil> There, that should be all |
21:09:13 | * | def- joined #nim |
21:12:08 | FromDiscord | <the_real_hypno> Plotwist: project needs to get rewritten :kekw: |
21:17:31 | * | om3ga quit (Ping timeout: 260 seconds) |
21:18:22 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "Every. Single. Edit I": i know this pain... |
21:18:51 | FromDiscord | <griffith1deadly> also with nimforue nimsuggest even dont work for u.. except hover at `uClass` macro call/ |
21:19:04 | FromDiscord | <griffith1deadly> even no errors |
21:28:59 | FromDiscord | <Robyn [She/Her]> This is painful honestly |
21:33:30 | FromDiscord | <griffith1deadly> i totally hate nimsuggest |
21:37:07 | * | def- quit (Quit: -) |
21:37:27 | FromDiscord | <Robyn [She/Her]> If only I understood compiler internals better |
21:49:54 | * | xet7 joined #nim |
21:56:06 | * | def- joined #nim |
22:01:50 | FromDiscord | <bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=unzkvVaVmJcJ |
22:21:38 | FromDiscord | <nikolay_a_k> Hi. Does exist llama.cpp wrapper/bindings for nim? |
22:23:48 | FromDiscord | <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:25 | FromDiscord | <nikolay_a_k> sent a long message, see https://pasty.ee/jvfBsiKRccxK |
22:39:03 | * | def- joined #nim |
22:42:08 | FromDiscord | <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:44 | FromDiscord | <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 |