<< 15-04-2024 >>

00:03:57*Mister_Magister quit (Quit: bye)
00:05:50*Mister_Magister joined #nim
00:20:54FromDiscord<Elegantbeef> @demotomohiro It might be valid I don't know not like Nim has a spec https://nim-lang.org/docs/manual.html#scope-rules-tuple-or-object-scope
00:21:03FromDiscord<Elegantbeef> Nothing explicitly states it's valid to do `T.field`
00:23:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ISxDErIwFdUo
00:41:27FromDiscord<Robyn [She/Her]> Isn't `typeof(T.x)` a typedesc?
00:45:47FromDiscord<Elegantbeef> Yes
00:46:05FromDiscord<Elegantbeef> It's a typedesc in a type annotation which means `tyTypedesc`s are skipped
00:46:25FromDiscord<demotomohiro> If it is not stated in Nim manual, I don't use it.↵It seems a field has higher priority than a generic parameter.
00:47:06FromDiscord<Elegantbeef> Yea field \> generic parameter but it's undocumented behaviour so I say it's a bug until proven otherwise 😄
00:47:07FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "It's a typedesc in": Aah okay
00:48:59FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=mHMvRioOmrcr
00:49:49FromDiscord<Elegantbeef> Yea but there is no ambiguity demonstrated like the `Foo.x` example
01:54:13*def- quit (Quit: -)
02:12:24*def- joined #nim
02:31:04*krux02_ quit (Remote host closed the connection)
02:31:37FromDiscord<odexine> In reply to @chronos.vitaqua "I wonder how posits": “Better” how?
02:32:14FromDiscord<Robyn [She/Her]> In reply to @odexine "“Better” how?": More accurate
02:32:33FromDiscord<Robyn [She/Her]> I read about them briefly but this was a bit ago
02:32:38FromDiscord<odexine> In certain ranges of the number line yes it is more accurate
02:33:03FromDiscord<odexine> In reply to @chronos.vitaqua "<@259277943275126785> you're the Haskell": Essentially what you quoted already
02:33:22FromDiscord<odexine> Using pure on lists pretty much equates to flat map
02:35:55FromDiscord<Robyn [She/Her]> I don't understand how to directly port the code though ehe
02:36:20FromDiscord<Robyn [She/Her]> I tried but i can't get my head around what returns what
02:36:33FromDiscord<odexine> In reply to @chronos.vitaqua "More accurate": On the extremely large numbers posit is less accurate than float
02:36:50FromDiscord<Robyn [She/Her]> In reply to @odexine "On the extremely large": Ah fair
02:36:51FromDiscord<odexine> Posit has a larger-magnitude range of values
02:37:23FromDiscord<Robyn [She/Her]> Magnitude range meaning?
02:37:37FromDiscord<odexine> The numbers it can represent are bigger in magnitude
02:37:49FromDiscord<Robyn [She/Her]> Ah okay
02:38:11FromDiscord<Robyn [She/Her]> So `100000000000000` vs `100` or something?
02:38:22FromDiscord<odexine> I think it also has more numbers it can represent because it doesn’t waste a billion values on NaN like float does
02:38:25FromDiscord<odexine> In reply to @chronos.vitaqua "So `100000000000000` vs `100`": Yes
02:38:31FromDiscord<Robyn [She/Her]> Neat
02:38:50FromDiscord<Robyn [She/Her]> In reply to @odexine "I think it also": Why do floats do that, seems weird
02:39:06FromDiscord<odexine> In reply to @chronos.vitaqua "Why do floats do": I ain’t the consensus board go ask them lol
02:39:25FromDiscord<odexine> Don’t look up “signalling NaN”
02:39:49FromDiscord<Robyn [She/Her]> Fair enough lol
02:39:53FromDiscord<Robyn [She/Her]> In reply to @odexine "Don’t look up “signalling": Eh?
02:40:06FromDiscord<odexine> It’s a joke
02:40:38FromDiscord<Robyn [She/Her]> Ah
02:40:47FromDiscord<Robyn [She/Her]> I was confused when I searched lol
02:42:04FromDiscord<odexine> Ahh, NaN boxing too is quite fucked
02:43:38*lucasta quit (Quit: Leaving)
03:10:17*bcksl quit (Quit: \)
03:10:17*end quit (Quit: end)
03:23:21*bcksl joined #nim
03:28:32*end joined #nim
03:34:57FromDiscord<morgan> how would i go about overloading assignment? i'd like to have a type where a referenced proc runs on assignment
03:36:03FromDiscord<leorize> you can theoretically do it by overriding `=copy` and `=sink`
03:36:19FromDiscord<morgan> cool ill look into that
03:36:44FromDiscord<leorize> I'd not recommend doing so
03:37:19FromDiscord<leorize> type hooks have, uh, not very savory results if you try to do too much with them
03:37:40FromDiscord<morgan> fair
03:38:58FromDiscord<morgan> i just wanna have objA = objB then also do objA.foo = objA.fn(objA.bar) afterwards automatically
03:39:01FromDiscord<morgan> although
03:39:31FromDiscord<morgan> wait hm no
03:40:14FromDiscord<morgan> i do have converters from a value to these like wrapped values, i could have that call the proc iiiiiif i could get the type from the thing being assigned to
03:40:41FromDiscord<morgan> or i could just have assignment be done with a proc that also does the stuff, instead of making it work like a regular value
03:41:23FromDiscord<morgan> i'd have to do wrappedvalue.value = blah
03:51:02*def- quit (Quit: -)
03:53:46*def- joined #nim
04:07:20FromDiscord<morgan> so i think i implemented it correctly, well just sink right now, but i thought more about the main use case i was thinking of and i think it would be better to not do it this way
04:10:20*def- quit (Quit: -)
04:12:12*def- joined #nim
04:15:40*def- quit (Client Quit)
04:18:39*def- joined #nim
04:23:37*def- quit (Quit: -)
04:43:25*def- joined #nim
05:10:59*def- quit (Quit: -)
05:28:56*def- joined #nim
05:59:27*def- quit (Quit: -)
06:18:08*PMunch joined #nim
06:23:32*def- joined #nim
06:52:06*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
06:52:28*SchweinDeBurg joined #nim
07:22:22*def- quit (Quit: -)
07:22:39*def- joined #nim
07:26:43*ntat joined #nim
08:10:44*def- quit (Quit: -)
08:28:56*def- joined #nim
08:35:49*def- quit (Quit: -)
08:39:18*def- joined #nim
09:00:00*def- quit (Quit: -)
09:17:39*def- joined #nim
09:19:47*xet7 joined #nim
09:45:47*def- quit (Quit: -)
09:46:16*def- joined #nim
09:55:35*def- quit (Quit: -)
09:57:52*def- joined #nim
10:01:25*ntat quit (Quit: Leaving)
10:02:04*def- quit (Client Quit)
10:02:34*def- joined #nim
10:05:48*ntat joined #nim
10:17:53*def- quit (Quit: -)
10:19:15*def- joined #nim
10:49:09*PMunch_ joined #nim
10:52:11*PMunch quit (Ping timeout: 264 seconds)
12:33:43*def- quit (Quit: -)
12:49:19*krux02 joined #nim
12:54:08*def- joined #nim
13:13:47*lucasta joined #nim
13:37:51*systemdsucks quit (Remote host closed the connection)
13:38:08FromDiscord<thesherwood> Is there a simple way to get the buffer from a string?
13:54:56Amun-RatoOpenArray?
13:57:08FromDiscord<kots> What are you trying to do? s[0].addr is another useful one
14:07:19*ntat quit (Quit: Leaving)
14:11:23FromDiscord<thesherwood> I want to get the buffer to pass it to the javascript host from wasm. If I pass the string, I have to follow 2 pointers from the javascript side. I'd prefer to only have to follow one.
14:11:47*systemdsucks joined #nim
14:12:16*systemdsucks quit (Client Quit)
14:12:32FromDiscord<kots> Something like s[0].addr might be the right direction then. Though I have no idea how wasm works
14:12:59*systemdsucks joined #nim
14:13:05FromDiscord<thesherwood> Cool. I'll give that a try. Thanks
14:19:53*def- quit (Quit: -)
14:20:04*def- joined #nim
14:20:53FromDiscord<thesherwood> In reply to @k0ts "Something like s[0].addr might": Oh yeah. that worked. I don't know why i didn't think of that. Thanks!
14:53:16*def- quit (Quit: -)
14:55:40*def- joined #nim
14:58:34*def- quit (Client Quit)
15:14:51termerYou definitely wanna pass it as a byte array if possible to avoid having to convert the string to UTF-16
15:17:43*def- joined #nim
15:28:00*lucasta quit (Quit: Leaving)
15:30:31*deadmarshal_ quit (Ping timeout: 246 seconds)
15:43:00*xet7 quit (Remote host closed the connection)
15:53:47*MacDefender joined #nim
15:57:59*deadmarshal_ joined #nim
16:13:17FromDiscord<vindaar> @ringabout the arraymancer related CI failure _should_ be because I haven't tagged a new version yet. Will do so later and then will get back to you
16:23:46*deadmarshal_ quit (Quit: IRCNow and Forever!)
16:26:25*deadmarshal_ joined #nim
16:27:26FromDiscord<vindaar> @ringabout just pushed a new version. Should be fixed with a CI rerun
16:32:19*MacDefender quit (Quit: WeeChat 4.2.2)
16:48:03*xet7 joined #nim
17:23:42*ntat joined #nim
17:49:04FromDiscord<the_real_hypno> Hey hey, could you guys tell me what the preferable collection type for user created objects is? The goal is finding or filtering the collection for an object (and it should return this object) by the objects field value
17:51:13FromDiscord<Phil> I am confused by your question
17:51:59FromDiscord<the_real_hypno> Basically i want findIt for seq
17:52:28FromDiscord<Phil> If you have a list of things that you don't know the size of ahead of time, use a seq.↵If you know it ahead of time, use an array.↵If you want to make tons of comparisons to see if sth. is part of that group or not, use a HashSet.↵If you want to map 2 instances of anything together use a table, that's pretty much it.
17:53:25FromDiscord<Phil> There's also stacks and LL but their usecase is so insanely rare that I have not ever encountered one in the wild.
17:54:09FromDiscord<Phil> In reply to @the_real_hypno "Basically i want findIt": You can write your own wrapper around findIt with filter. Not the most performant version of it, but it'll get you there
17:54:23FromDiscord<Phil> (edit) "In reply to @the_real_hypno "Basically i want findIt": You can write your own wrapper ... around" added "for findIt" | removed "findIt with"
17:54:39FromDiscord<Phil> Or just use a functional programming lib
17:54:49FromDiscord<Phil> That provide more performant zero cost abstractions
17:55:10FromDiscord<bandithedoge> ^ https://github.com/zero-functional/zero-functional might be what you're looking for
17:55:25FromDiscord<Phil> That was in fact the one I had in mind
17:55:59FromDiscord<the_real_hypno> Thanks for the explanation, kind of what i gathered from searching in the std lib
17:56:00FromDiscord<Robyn [She/Her]> Is Nim considered a functional language or nah?
17:56:12FromDiscord<the_real_hypno> So i didnt oversee something
17:56:26FromDiscord<Phil> In reply to @chronos.vitaqua "Is Nim considered a": it isn't
17:56:30FromDiscord<bandithedoge> i wouldn't say so↵(@Robyn [She/Her])
17:56:31FromDiscord<Phil> You can do a lot of FP things
17:56:37FromDiscord<the_real_hypno> In reply to @bandithedoge "^ https://github.com/zero-functional/zero-functiona": Cheers, ill check it out
17:56:45FromDiscord<Phil> But around the edges of it you'll see that it lacks some of the "true" things for an FP lang
17:56:49FromDiscord<bandithedoge> it has some functional things in the standard library but that doesn't make the language functional
17:57:20FromDiscord<Phil> The keyword I see thrown around a lot is "Tail end recursion".↵I have no idea what that means but by the implication of it, it appars to be some kind of important performance thingy?
17:57:30FromDiscord<Phil> Nim lacks it IIRC
17:57:58FromDiscord<Robyn [She/Her]> In reply to @bandithedoge "it has some functional": Fair enough, thanks!
17:58:14FromDiscord<Phil> That doesn't really hurt too much since (for me) 99% of the FP style I want to use is available
17:58:41FromDiscord<Phil> And I really am not a fan of recursions unless you go bottom-up, which in the end is just turning the recursion into a forloop
17:58:44FromDiscord<bandithedoge> same with python, it implements some fp concepts but you wouldn't call python a functional language
17:59:00FromDiscord<the_real_hypno> In reply to @bandithedoge "^ https://github.com/zero-functional/zero-functiona": Exactly what i was looking for, thanks :Ahha:
18:00:33FromDiscord<bandithedoge> or c++ if you're willing to stretch it
18:00:44FromDiscord<.bobbbob> In reply to @isofruit "Nim lacks it IIRC": I thought it did have it since it compiles to c and c compilers generally do tail recursion optimization
18:01:33FromDiscord<Robyn [She/Her]> In reply to @bandithedoge "same with python, it": Fair enough aha
18:01:43FromDiscord<Phil> That's really just vaguely what I recall from what odd few times the topic came up, it never interested me tooooooo much
18:01:44FromDiscord<Robyn [She/Her]> I don't know about functional programming at all tbh
18:01:58FromDiscord<Phil> You'd be much better of asking that kind of question in #internals if you want a competent answer 😄
18:02:51FromDiscord<jviega> Functional programming revolves around the notion of pure mathematical functions w/o side effects, as opposed to procedural languages that are more stateful / follow-the-instructions
18:03:28FromDiscord<bandithedoge> i really recommend exploring at least a little bit of fp even if you're not gonna use it↵(@Robyn [She/Her])
18:04:27FromDiscord<bandithedoge> the first few chapters of https://learnyouahaskell.github.io/chapters.html should get you started on some of the most important concepts
18:04:45FromDiscord<jviega> Taken to an extreme, you can almost completely elimnate side effects in your language, and make things a function. Even things that are innately side-effecting like input/output can almost be handled if you really want. Haskell's whole reason for being is to be purely functional, so is a good one to study. For instance, for the IO problem, try to wrap your head around monads.
18:05:31*krux02_ joined #nim
18:05:59FromDiscord<jviega> There are trade-offs; functional languages tend to be less intuitive for most people, but some things lend themselves to good performance too.
18:06:54FromDiscord<bandithedoge> just learning how io works in haskell will teach you about separating pure functions from io
18:06:54FromDiscord<jviega> But just like lots of languages (including functional ones) end up picking up bits of the object-oriented paradigm, bits of the functional paradigm creep into other languages. It's not black and white in most cases.
18:08:01*krux02 quit (Ping timeout: 246 seconds)
18:09:20FromDiscord<jviega> Personally, I am not much of a fan of major projects in very functional styles, because they tend to be complicated enough that other people coming to a code base have a hard time understanding. I'm more egalatarian, I want smart people from other walks of life to be able to do pick things up if they'd like.
18:10:36FromDiscord<bandithedoge> easily the best thing about functional programming is that after solving any problem you feel like a glowing brain genius
18:11:17FromDiscord<bandithedoge> (don't take this as advice when starting a project)
18:14:44FromDiscord<Phil> I honestly like the functional thinking of mapping X to Y, it just makes my life so much easier if Y is also allowed to be a side-effect like sending an HTTP request
18:19:22FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=aAuOJnnsjFmp
18:19:37FromDiscord<the_real_hypno> Now i just need to get rid of the seq
18:20:27FromDiscord<Phil> In reply to @the_real_hypno "Now i just need": Write a short wrapper function that just filters and returns an optional. If post filter you got 0 hits, optional none, else the first hit on the list.↵Not the most performant, but if it's not the hot code path nobody will care
18:21:29FromDiscord<the_real_hypno> I guess there are limits on how often someone wants to iterate through all Processes, so i guess that would be ok
18:23:49FromDiscord<Phil> I mean, generally, how long is that going to take? How often is a user realistically going to trigger this?
18:24:19FromDiscord<Phil> Unless that thing actually costs you noticeably 100ms somewhere in processing or so, I'm not worrying about it.
18:24:46FromDiscord<the_real_hypno> Now, its insanely fast
18:24:52FromDiscord<the_real_hypno> If i would know how to test
18:24:56FromDiscord<the_real_hypno> i could prove it 😄
18:25:45FromDiscord<queebee> teh frog.
18:26:21FromDiscord<queebee> Stop coding world elimination tools
18:26:49FromDiscord<Phil> heaptrack allows you to check out the callgraph and what part of the program takes up how long etc.
18:29:30FromDiscord<the_real_hypno> In reply to @queebee "Stop coding world elimination": I would never, its all for 3rd world countries
18:30:21FromDiscord<the_real_hypno> In reply to @isofruit "Write a short wrapper": My wrapper is:↵↵adding[0] 😄
18:30:29FromDiscord<the_real_hypno> (edit) "is:↵↵adding[0]" => "is:↵↵adding [0]"
18:30:43FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=zSIQHgAswMKl
18:31:10FromDiscord<the_real_hypno> ignore the auto that was just for the weird returntypes i got
18:37:30*kotrcka joined #nim
19:35:47*Mister_Magister quit (Excess Flood)
19:39:21*Mister_Magister joined #nim
19:58:03*kotrcka left #nim (ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3))
20:03:31FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=yYJOfYRefUkC
20:04:30FromDiscord<the_real_hypno> Probably just because of the fact that 2 breaks out of the loop
20:06:50Amun-Rathat's because you return early in the 2nd example
20:27:39*ntat quit (Quit: Leaving)
21:21:10*def- quit (Quit: -)
21:21:57*def- joined #nim
21:40:02*def- quit (Quit: -)
21:40:13*def- joined #nim
22:09:52*def- quit (Quit: -)
22:10:03*def- joined #nim
22:37:21*PMunch joined #nim
22:40:47*PMunch_ quit (Ping timeout: 264 seconds)
22:48:47*def- quit (Quit: -)
22:49:18*def- joined #nim
23:00:46FromDiscord<ebahi> is there any library that has implemented PKCS1_OAEP?
23:00:57FromDiscord<ebahi> (edit) "PKCS1_OAEP?" => "the PKCS1_OAEP cipher?"