<< 19-12-2021 >>

00:03:36FromDiscord<TryAngle> hmmm so I missunderstood concepts in the first place maybe?
00:03:58FromDiscord<TryAngle> so they act as restrictions what types can be used but not replace the procs
00:04:00FromDiscord<theangryepicbanana> not really it's just that they can't be as "specific" as you think they can
00:04:04FromDiscord<theangryepicbanana> (edit) "really" => "really,"
00:04:28FromDiscord<theangryepicbanana> so when you call `operate` in `addTest`, it's still going to test both overloads of `operate`
00:05:42FromDiscord<TryAngle> I thought at first they were similar to traits from Rust, which override the type function with the trait function in that scope
00:05:50FromDiscord<TryAngle> but that seems to not be the case
00:05:52FromDiscord<theangryepicbanana> nope
00:06:00FromDiscord<theangryepicbanana> concepts are compile-time only
00:06:31FromDiscord<TryAngle> I thought the rust were compile time also 🤔 ↵but I'm unsure
00:06:38FromDiscord<theangryepicbanana> well like
00:07:07FromDiscord<TryAngle> bc they "zero cost generics" hype everwhere, idk haven't looked into compiler / runtime
00:07:17FromDiscord<theangryepicbanana> instead of `operate` being implemented for every valid type for `Add`, it's just a generic function that takes 2 arguments of type `Add`
00:07:18FromDiscord<Elegantbeef> You can get that kind of behaviour using generic logic
00:07:18FromDiscord<Elegantbeef> Here i'll show how in a second
00:07:25FromDiscord<theangryepicbanana> oh yeah was about to mention that
00:07:34FromDiscord<TryAngle> o_O
00:07:36FromDiscord<TryAngle> now i'm curious
00:07:51*Guest2 quit (Quit: Client closed)
00:16:00FromDiscord<Elegantbeef> Shit my example didnt work 😀
00:17:42FromDiscord<TryAngle> thanks for trying at least 🥲
00:17:51FromDiscord<Elegantbeef> Eh i'll get it working
00:24:58FromDiscord<TryAngle> that would be amazing but you really don't have to 🥺
00:26:10FromDiscord<Elegantbeef> Too bad!
00:28:08FromDiscord<Elegantbeef> Lol never mind even with mixin'd symbols the first instantiation is used
00:28:54FromDiscord<TryAngle> In reply to @Elegantbeef "Lol never mind even": what are mixin'd symbols 😃 ?
00:29:13FromDiscord<ynfle (ynfle)> When is one supposed to be used over the other?
00:29:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3INV
00:29:30FromDiscord<Elegantbeef> `mixin` forces the symbol `funStuff` to be chosen at instantiation
00:30:04FromDiscord<ynfle (ynfle)> In the above `operate` example how are the 2 function differentiated?
00:30:44FromDiscord<TryAngle> In reply to @ynfle (ynfle) "In the above `operate`": they are not sadly thats why I'm asking her 😔
00:31:07FromDiscord<Elegantbeef> Annoyingly you cannot have per module generics it seems
00:31:29FromDiscord<Elegantbeef> I wonder if there is a way to instantiate a new generic
00:31:51FromDiscord<ynfle (ynfle)> What would you want to happen?↵(@TryAngle)
00:32:33FromDiscord<Elegantbeef> What are you after anyway try, i read a bit but dont follow
00:32:40FromDiscord<TryAngle> hmmm in worst case I can just not be generic over operators 🤔
00:33:05FromDiscord<TryAngle> basically implement parts of abstract algebra as generic as possible
00:33:10FromDiscord<ynfle (ynfle)> What are you trying to do?
00:33:36FromDiscord<ynfle (ynfle)> But if you call `operate(1, 2)` how do you know which operation you want to use?
00:34:48FromDiscord<ynfle (ynfle)> Can you give an example?
00:35:07FromDiscord<TryAngle> In reply to @ynfle (ynfle) "But if you call": I've written somewhere up that I misunderstood nim's concepts↵I thought they were like Rust Traits that overwrite the function in the scope where the trait is used
00:35:42FromDiscord<Elegantbeef> I think they probably should
00:36:12FromDiscord<ynfle (ynfle)> Ok↵(@TryAngle)
00:36:23FromDiscord<ynfle (ynfle)> Did you resolve what you wanted to get done?
00:36:51FromDiscord<Elegantbeef> you can reason that if you have a concept defined and the mixin'd symbols do not match, a new instantiation probably should be made
00:36:52FromDiscord<ynfle (ynfle)> I don't know rust so well
00:37:08FromDiscord<ynfle (ynfle)> Do you still want help doing something in nim?
00:37:29FromDiscord<Elegantbeef> Damn it try i now have to toy with this idea and see what breaks
00:37:37FromDiscord<Elegantbeef> Cause i think what you're suggesting is the "right" thing
00:38:41FromDiscord<TryAngle> In reply to @ynfle (ynfle) "I don't know rust": I will try to compact the Rust code I had somewhere.. just give me a sec
00:39:41*noeontheend joined #nim
00:40:47FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3INZ
00:42:31FromDiscord<Elegantbeef> It's of course not since the `doThing(a, b) == 340` doesnt instantiate a new `doThing` for the scope of moduleB
00:44:26FromDiscord<Elegantbeef> Hmmm if we just make that `proc doThing` a `template doThing` this does work as intended
00:44:28FromDiscord<Elegantbeef> So i guess that's my suggestion, use templates for the procs that depend on scope
00:44:46FromDiscord<Elegantbeef> See try there was a benefit for me ramming my head in the wall for you 😛
00:45:44FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3IO0
00:46:12FromDiscord<TryAngle> (edit) "https://play.nim-lang.org/#ix=3IO0" => "https://play.nim-lang.org/#ix=3IO1"
00:46:17FromDiscord<Elegantbeef> So yea we'd use distincts here
00:48:22FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IO2
00:49:18FromDiscord<Elegantbeef> I dont think there is much reason to use concepts for this, since you're just wanting distinct behaviour for the same type
00:49:57FromDiscord<TryAngle> I only used the same type here to not make the example too complicated for somebody who doesn't write Rust 😅
00:50:06FromDiscord<ElegantBeef> Oh
00:51:00FromDiscord<Elegantbeef> Anyway you can use the concept + templates instead of procs to get this behaviour
00:54:06FromDiscord<TryAngle> In reply to @Elegantbeef "Anyway you can use": may you give a small example please?
00:54:16FromDiscord<Elegantbeef> Same as my example above
00:54:23FromDiscord<Elegantbeef> But here
00:54:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IO4
00:54:49FromDiscord<Elegantbeef> There we go
00:55:19FromDiscord<Elegantbeef> Scope is now taken into account on call of `doThing` and `+` is bound to whatever is in scope instead of the first isntantiation of `doThing` thanks to the fact it's a template instead of proc
00:55:30FromDiscord<Elegantbeef> So now `+` is overridable based of scope
00:56:32FromDiscord<Elegantbeef> That atleast allows the overidable behaviour, the disallowing operators is more tricky
00:58:08FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3IO6
00:58:53FromDiscord<Elegantbeef> Isnt this what you wanted scope taken into account?
00:58:57*noeontheend quit (Ping timeout: 240 seconds)
00:59:26NimEventerNew thread by Jocker: Pythons None in Nim, see https://forum.nim-lang.org/t/8725
01:03:14FromDiscord<TryAngle> In reply to @Elegantbeef "Isnt this what you": yeah but I need to combine Monoid<Additive> and Monoid<Multiplicative> so scoping is not really an option for that :/
01:03:27FromDiscord<TryAngle> (edit) "In reply to @Elegantbeef "Isnt this what you": yeah but I need to combine Monoid<Additive> and Monoid<Multiplicative> ... so" added "for other purposes"
01:03:42FromDiscord<TryAngle> (edit) "In reply to @Elegantbeef "Isnt this what you": yeah but I need to combine Monoid<Additive> and Monoid<Multiplicative> ... for" added "(not directly but in hirarchy)"
01:04:49FromDiscord<ynfle (ynfle)> In this rust code, is it missing a `>` in each of the test `fn`s?↵(@TryAngle)
01:05:13FromDiscord<TryAngle> In reply to @ynfle (ynfle) "In this rust code,": yes it does miss them
01:05:26FromDiscord<ynfle (ynfle)> Ok↵(@TryAngle)
01:05:29FromDiscord<TryAngle> I typed it in discord and forgot them in the hurry 😅
01:05:43FromDiscord<ynfle (ynfle)> What is the purpose of the Monoid part?
01:06:19FromDiscord<ynfle (ynfle)> Is this not sufficient? https://play.nim-lang.org/#ix=3IOc
01:07:00FromDiscord<TryAngle> In reply to @ynfle (ynfle) "What is the purpose": this is proabably what I resort to now
01:07:17*noeontheend joined #nim
01:08:04FromDiscord<TryAngle> in 99% of having the operator generic is not needed anyways↵it's just like knowing it's not generic in the codebase 😱
01:08:13FromDiscord<TryAngle> (edit) "in 99% of ... having" added "cases"
01:09:38FromDiscord<TryAngle> @ElegantBeef still big thanks for coming up with an interesting solution, didn't know something like mixin were a thing, will definitely use something like that for another thing I have in my head already 🤔 😀
01:12:27FromDiscord<Fish-Face> is there any documentation for `nimly` that isn't just the two examples in the readme 😦
01:12:42FromDiscord<ynfle (ynfle)> @TryAngle https://nim-lang.org/docs/manual_experimental.html#concepts Talks about monoids
01:13:50FromDiscord<TryAngle> In reply to @ynfle (ynfle) "@TryAngle https://nim-lang.org/docs/manual_experime": haha I know about that example but sadly this is just a little snippet :/
01:14:00FromDiscord<ynfle (ynfle)> Ya↵(@TryAngle)
01:14:08FromDiscord<ynfle (ynfle)> It doesn't show a monoid generic concept
01:18:32FromDiscord<exelotl> huh https://play.nim-lang.org/#ix=3IOe
01:18:56FromDiscord<exelotl> this prints `0` on Nim 1.6 but `6` on Nim 1.4.8
01:19:36FromDiscord<exelotl> which is correct?
01:21:52FromDiscord<ynfle (ynfle)> The weird part is it still prints hello on 1.6.0
01:22:39FromDiscord<TryAngle> I mean len 0 should be correct in the context of `c` no?
01:22:47FromDiscord<Elegantbeef> O is right
01:22:55FromDiscord<ynfle (ynfle)> Right. But why should it print?
01:23:13FromDiscord<Elegantbeef> 0 even
01:23:39FromDiscord<TryAngle> strings are usually null terminated in c↵e.g the "NULL" ascii char is the end of the string
01:23:45FromDiscord<Elegantbeef> Nah we're wrong
01:23:55FromDiscord<Elegantbeef> This is a global const Cstring, which is probably generated as an array
01:24:04FromDiscord<TryAngle> (edit) "string" => "string↵the "NULL" ascii char is `\0`"
01:24:21FromDiscord<Elegantbeef> make it `let` and do `echo s` or `echo s.len` and it'll properly behave
01:24:55FromDiscord<Elegantbeef> Since it's a constant cstring it's emitted as `['\0', 'h', 'e', 'l', 'l', 'o']`
01:25:05FromDiscord<Elegantbeef> So i'd argue 1.6 is right
01:26:38FromDiscord<Elegantbeef> To add to this a `cstring` is a ptr to a character and you cannot have a ptr to a constant since they're pasted into call site
01:27:04FromDiscord<Elegantbeef> So very much 1.6 is the "right" behaviour to me, would like to hear any counter points anyone has though 😀
01:28:04FromDiscord<TryAngle> this like this are litereally the reason why I was searching for other langs and found Rust & Nim XD
01:28:14FromDiscord<TryAngle> (edit) "this" => "things"
01:28:46FromDiscord<Elegantbeef> Does this mean you run screaming from Nim now? 😛
01:32:12FromDiscord<TryAngle> What do you mean 😳?
01:32:42FromDiscord<Elegantbeef> You said things like that is why you were searching for other languages, and Nim has stuff like that 😛
01:32:47FromDiscord<Elegantbeef> It's mostly a joke
01:36:44FromDiscord<TryAngle> sent a long message, see http://ix.io/3IOg
01:37:45FromDiscord<Elegantbeef> Lack of restrictions?
01:38:37*noeontheend quit (Ping timeout: 240 seconds)
01:40:13FromDiscord<TryAngle> In reply to @Elegantbeef "Lack of restrictions?": I think this is more of a opinion thing so idk ↵but that when using Concepts only the procs supplied by the concept are allowed.
01:41:19FromDiscord<TryAngle> If I want all why not just type the type directly 🤔
01:42:24FromDiscord<TryAngle> + they are experimental anyways
01:42:52FromDiscord<Elegantbeef> Eh they're "experimental"
01:43:37FromDiscord<Elegantbeef> Hmm with the new concept style, this safety could be enforced with a macro
01:43:59FromDiscord<Elegantbeef> God damn it quit enticing me with fun
01:46:47FromDiscord<TryAngle> Haha↵Just did nothing but writing in Rust last year but figured many things are ugly to implement so now I'm trying to write things in Nim but I'm still used to the "rust-way"
01:47:04FromDiscord<TryAngle> (edit) "Haha↵Just did nothing but writing in Rust last year but figured many things are ugly to implement so now I'm trying to write things in Nim but I'm still used to the "rust-way" ... " added "sadly"
02:03:03FromDiscord<Avionix> I've got a question about the `std/times` module and was wondering if anyone has any idea what's wrong.
02:03:04FromDiscord<Avionix> https://play.nim-lang.org/#ix=3IOq
02:03:19FromDiscord<Avionix> Here's an example.
02:03:24FromDiscord<Elegantbeef> @TryAngle\: here is what you've got me to make 😛 https://play.nim-lang.org/#ix=3IOr
02:05:39FromDiscord<Avionix> Basically, I'm converting a string containing a unix epoch into a `Time` object. For some reason, the resulting `Time` object doesn't equal the one I used to actually make the unix epoch string.
02:06:04FromDiscord<Elegantbeef> It seems to be missing nanoseconds
02:06:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IOs
02:07:13FromDiscord<Avionix> Oh. That's precisely it, thank you!
02:07:15FromDiscord<Rika> Unix epoch usually refers to the second precise epoch
02:07:29FromDiscord<Elegantbeef> From unix float almost works but still isnt right
02:08:00FromDiscord<Elegantbeef> If you want to do time \<-\> string you'll probably have to use `formatTime` and `parseTime` using your own output
02:08:21FromDiscord<Elegantbeef> This way you can get the generally uncared about values
02:08:51FromDiscord<Avionix> I think I might do that. Thanks for your help!
02:08:57FromDiscord<Elegantbeef> Alternatively you can always just do `proc sameTime(a, b: Time): bool = (a - b) < initDuration(seconds = 0)`
02:09:06FromDiscord<Elegantbeef> Sorry `seconds = 1`
02:39:17*neurocyte0132889 quit (Ping timeout: 240 seconds)
03:09:55*src quit (Quit: Leaving)
03:36:17*noeontheend joined #nim
03:40:37*arkurious quit (Quit: Leaving)
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:30*supakeen joined #nim
04:19:47FromDiscord<valerga> is there a difference between `echo x, y` vs `echo x & y`?
04:20:20FromDiscord<valerga> oh ok it's not casted to string for instance, in the second one
04:22:22FromDiscord<Elegantbeef> Indeed as you've noticed `echo(x, y)` is `echo($x, $y)` but the other expects two types that have `&` implemented
04:23:27FromDiscord<Rika> same-ish difference with python's print(x,y) and print(x+y)
04:36:12FromDiscord<valerga> expects two types? or one type, a string?
04:36:41FromDiscord<Elegantbeef> Well it's looking for `&(typeof(x), typeof(y)`
04:37:12FromDiscord<valerga> but isn't that &'s 'responsibility'?
04:37:22FromDiscord<Elegantbeef> That's where the error is from
04:37:29FromDiscord<valerga> ah ok
04:38:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IOL
05:01:44NimEventerNew Nimble package! opensimplexnoise - A pure nim port of the open simplex noise algorithm from Kurt Spencer, see https://github.com/betofloresbaca/nim-opensimplexnoise
05:04:12FromDiscord<Rika> nice
05:19:46NimEventerNew Nimble package! prettystr - Small library for working with strings, see https://github.com/prettybauble/prettystr
06:13:17*noeontheend quit (Ping timeout: 240 seconds)
06:55:29FromDiscord<baalajimaestro> Hi, is there any way i could run osproc with async. I am trying to do a telegram bot, and dont want the execution to block others from messaging it
06:55:51FromDiscord<baalajimaestro> I did find this, https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncproc.nim↵↵But not sure how to use
06:56:40FromDiscord<baalajimaestro> I nimble installed the necessary package, and imported asynctools.asyncproc, but asyncproc.execProcess doesnt seem to work out
06:59:47FromDiscord<Elegantbeef> In what way didnt it work out?
07:11:17FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3IPa
07:13:02FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IPb
07:13:03FromDiscord<that_dude> And I'm hesitant to use macrocache because I don't understand how it works. I'd like to make it myself
07:13:32FromDiscord<that_dude> Damn
07:13:39FromDiscord<that_dude> That did seem to fix it
07:13:52FromDiscord<Elegantbeef> Well yea you're putting the string there instead of ast now
07:15:29FromDiscord<baalajimaestro> it just said undeclared identifier asyncproc, when there is an import right a line above
07:15:41FromDiscord<Elegantbeef> full code?
07:16:35FromDiscord<Elegantbeef> You cant really implement macro cache thanks to the magic it implements but you can get close
07:17:27FromDiscord<that_dude> In reply to @Elegantbeef "Well yea you're putting": I'm confused. Isn't `proc_name` holding a string already?
07:17:58FromDiscord<that_dude> I thought quote do is a perfect copy and paste
07:18:05FromDiscord<that_dude> ish
07:20:25FromDiscord<Elegantbeef> Well it puts in a symbol to `proc_name` which is a Nim AST node
07:20:42FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3IPe look at the output here https://play.nim-lang.org/#ix=3IPe
07:20:43FromDiscord<Elegantbeef> Damn it
07:20:47FromDiscord<Elegantbeef> Double paste
07:21:02FromDiscord<baalajimaestro> https://paste.baalajimaestro.me/6IloRO
07:21:10FromDiscord<baalajimaestro> this is what i tried
07:21:33FromDiscord<Elegantbeef> Oh python imports
07:21:39FromDiscord<Elegantbeef> my favourite
07:22:13FromDiscord<baalajimaestro> well, i am new to nim, pretty much have been using python earlier
07:22:16FromDiscord<Elegantbeef> Does it behave the same without it?
07:22:39FromDiscord<baalajimaestro> without what exactly?
07:23:07FromDiscord<Elegantbeef> instead of `from x in y` do `import x`
07:23:17FromDiscord<baalajimaestro> hmmm ill try that
07:24:20FromDiscord<baalajimaestro> oh that worked
07:24:37FromDiscord<that_dude> Does sym only bind to procs or something? I thought it does to all variables/entities
07:24:55FromDiscord<baalajimaestro> idk how that changes anything, isnt it supposed to like slim down whats imported inside?
07:24:55FromDiscord<Elegantbeef> `from x import y` doesnt make a `y.x` work it imports only `asynproc`
07:25:09FromDiscord<Elegantbeef> `import asynctools` imports everything exported
07:25:19FromDiscord<baalajimaestro> thats something different from python indeed
07:26:12FromDiscord<Elegantbeef> you want `import asynctools as asyncproc` but life is easier just doing `import asynctools`
07:27:07FromDiscord<Elegantbeef> The issue is that doing the quote like that will bind the sym of the variable that was made inside the macro, not the value it holds↵(@that_dude)
07:27:59FromDiscord<Elegantbeef> In nim baalaji the convention is to just do `import x` and bring everything since it makes life easier
07:28:23FromDiscord<Elegantbeef> Selective imports dont make much sense imo, but your milage may vary
07:31:05FromDiscord<that_dude> So basically when done it's referencing a var that doesn't exist anymore? I kinda thought macros kinda just paste selves into the code like a template and then run the pasted code. Does it instead work closer to the way a proc works where it takes code in and then after manipulations spits out new code to replace the old one?
07:31:42FromDiscord<Elegantbeef> Macros are nothing like templates
07:31:56FromDiscord<baalajimaestro> ah okay got it
07:32:00FromDiscord<Elegantbeef> They take what you give them and run on the vm with the input and return the output
07:32:43FromDiscord<baalajimaestro> i was thinking in the python route, where you can import a specific function and make your code run faster just coz you werent importing 1000 other randoms you never need
07:32:49FromDiscord<Elegantbeef> Templates are code substitution and dont require the vm, they take the AST from the template replace the symbols and expand
07:32:59FromDiscord<Elegantbeef> Yea Nim is compiled so you dont slow down the code with all the imports
07:33:07FromDiscord<Elegantbeef> It statically knows what you use and doesnt include anything else
07:33:28FromDiscord<that_dude> I understand. I think. I took them to be templates that can use code to generate more custom ast's
07:33:32FromDiscord<Elegantbeef> Python has to check what a function is at runtime
07:33:32FromDiscord<baalajimaestro> similar to C's LTO if i am making a correct reference?
07:33:52FromDiscord<Elegantbeef> LTO is different, we're talking about dead code elimination really
07:34:03FromDiscord<Elegantbeef> Nim doesnt generate code for procedures you dont use
07:34:15FromDiscord<baalajimaestro> hmmm got it
07:34:58FromDiscord<Elegantbeef> I didnt even think about the fact that you reduce runtime costs when doing that in python, that's interesting
07:35:28FromDiscord<Elegantbeef> Yea i think you understand, you can always think of macros as a user defined compilation pass
07:35:33FromDiscord<Elegantbeef> Cause that's what they're really
07:36:48FromDiscord<Elegantbeef> The compiler finds a macro call takes the code it requests passes it to the VM which then runs your code returning your AST then semantically checks it, so very much just a user defined pass
07:37:48FromDiscord<Elegantbeef> The `quote` macro btw uses the backticks as a "insert the AST of X here" like a template
07:38:07FromDiscord<Elegantbeef> If you're on 1.6 you may also want to look at genast as it's a bit nicer
07:38:19FromDiscord<Elegantbeef> it's inside `std/genasts`
07:38:56FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3IPg
07:39:11FromDiscord<Elegantbeef> Ah nope that's just standard nim code
07:39:16FromDiscord<that_dude> I will look into genasts, the reason I used `quote do` is because all of the examples I saw used it
07:39:19FromDiscord<Elegantbeef> You can pass arguments with a block style `:`
07:39:30FromDiscord<that_dude> ah
07:39:41FromDiscord<Elegantbeef> Yea genast is new in 1.6 so all the tutorials use quote which is older
07:40:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IPh
07:40:30FromDiscord<Elegantbeef> All that does is take the expression after `:` and put it inside the `a.add` call
07:40:43FromDiscord<Elegantbeef> It works for all procedures/templates but is mainly for templates/macros
07:41:04FromDiscord<that_dude> So `quote do` returned an object which was the nimnode in this case and effectivly turned it into `result = newStmtList(x, node)`
07:41:13FromDiscord<Elegantbeef> Yep!
07:41:23FromDiscord<that_dude> Neat
07:42:04FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3IPi
07:42:08FromDiscord<that_dude> to make let work nicer
07:42:13FromDiscord<Elegantbeef> That's different though
07:42:28FromDiscord<Elegantbeef> that's like `var a = {1}` in other languages 😀
07:43:32FromDiscord<Elegantbeef> Nim's got a bunch of these elegant solutions to problems
07:43:52FromDiscord<that_dude> Aren't the two examples basically the same? The let one returned a value of 1 and added that as an arg which just so happened to be the only input to the assignment?
07:44:11FromDiscord<Elegantbeef> Nah `block` is a keyword which opens a new scope
07:44:29FromDiscord<that_dude> and `a.add` didnat?
07:44:33FromDiscord<Elegantbeef> I mean i guess it's both a block expressions
07:44:55FromDiscord<Elegantbeef> I was being dumbly pedantic
07:44:59FromDiscord<that_dude> ah
07:45:01FromDiscord<that_dude> mb
08:01:04FromDiscord<Elegantbeef> @that_dude\: if you wanted to see how one would do it with macrocache https://play.nim-lang.org/#ix=3IPo
08:01:16FromDiscord<Elegantbeef> It's not that interesting but might tickle your brain
08:32:29FromDiscord<that_dude> I'm going to keep that tab open, but I don't think I'm ready to deal with that level of manipulation
10:36:44FromDiscord<Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3IPM
10:37:26FromDiscord<Rika> You’re trying to overload tuple []
10:37:29FromDiscord<Rika> Use object
10:37:50FromDiscord<Hamid_Bluri> same with `object`
10:38:02FromDiscord<Rika> Are you sure
10:38:17FromDiscord<Hamid_Bluri> yes
10:38:33FromDiscord<Hamid_Bluri> no
10:38:56FromDiscord<Hamid_Bluri> fine with object
10:38:58FromDiscord<Hamid_Bluri> thanks
10:40:06FromDiscord<Rika> 👌
11:15:24FromDiscord<sOkam!> I know of the std/memfiles lib, https://nim-lang.org/docs/memfiles.html↵but, as the noob I am, I'm not fully grasping how I would use the info that an opened file contains, or how to filter the info to an specific application↵How would one go about accessing all in-ram information used by an app?
11:16:12FromDiscord<sOkam!> (edit) "file" => "memfile"
12:04:58FromDiscord<Michal58> In reply to @Michal58 "<@!259277943275126785> yeah, it doesn't": is this deprecated in 1.6.2?
12:06:02*supakeen quit (Quit: WeeChat 3.4)
12:06:54*supakeen joined #nim
13:03:50*xet7 quit (Remote host closed the connection)
13:04:48*xet7 joined #nim
13:06:37*xet7 quit (Remote host closed the connection)
13:07:37*xet7 joined #nim
13:13:30*TakinOver joined #nim
13:23:41FromDiscord<hmmm> jeez I just read from the forum that you can do something like: "proc foo(x: int or typeof(nil); y: int or typeof(nil)) ="
13:24:29FromDiscord<hmmm> someone should really do a Nim Pearls publication and free us from medieval ignorance 🤔
13:24:49FromDiscord<hmmm> or I should just RTFM, one of the two I guess 🤨
13:34:15FromDiscord<Rika> !eval echo typeof nil
13:34:17NimBottypeof(nil)
13:34:23FromDiscord<Rika> ?
13:34:33FromDiscord<Rika> what about that is weird idgi
13:34:57qwrseems that nim doesn't have separate name for nil type other than typeof(nil) ?
13:36:23*qwr is guessing that in essence it should be like ocaml's unit type or haskell's () (haskell uses () as typename for the type of () value)
13:37:28FromDiscord<Rika> no its more like a "sentinel that can match many things" like the empty of seq[empty] when typeof(@[])
13:37:59FromDiscord<Rika> nil can match pointer or ptr T or ref T
13:38:48qwrwhich means that "nillable" types are in fact sum types of the T and typeof(nil)
13:39:21qwr(not unique to nim)
13:41:55qwror maybe the compiler considers typeof(nil) itself generic - i couldn't find it from language manual so not sure
13:42:59qwrbut the nature of nullable/nillable types is equivalent to parametric sum type
13:44:19qwrjavas Option<T> or rusts std::option are nice demonstrations of this, as both are functionally equivalent to nillable type
13:46:13qwrhttps://doc.rust-lang.org/std/option/enum.Option.html
13:46:29FromDiscord<Rika> no nil is just literal NULL in c
13:46:35FromDiscord<Rika> nim also has a separate option type
13:47:09FromDiscord<demotomohiro> In reply to @hmmm "jeez I just read": It is just using a feature written in the Nim manual.
13:47:10FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#generics-type-classes
13:48:38qwrRika: yes of course, i'm just saying that from type theory perspective nillability is also a form of sum type
13:49:59FromDiscord<Rika> okay
13:54:32*src joined #nim
14:04:24*arkurious joined #nim
14:07:03*neurocyte0132889 joined #nim
14:07:03*neurocyte0132889 quit (Changing host)
14:07:03*neurocyte0132889 joined #nim
14:22:58*FromDiscord quit (Remote host closed the connection)
14:23:11*FromDiscord joined #nim
14:23:58NimEventerNew thread by Mantielero: What approach can I use to fix a number of parameters in some functions?, see https://forum.nim-lang.org/t/8726
15:35:30*elph joined #nim
15:36:06*krux02 joined #nim
15:59:34*averell joined #nim
16:18:16*geek_ joined #nim
16:25:38*xet7 quit (Quit: Leaving)
16:26:36*xet7 joined #nim
17:11:34FromDiscord<Rosen> sent a code paste, see https://play.nim-lang.org/#ix=3IRQ
17:12:36FromDiscord<Rika> `nimble list -i | grep neo` shows what?
17:13:08FromDiscord<Rosen> It's there
17:13:15FromDiscord<Rika> version i mean
17:13:18FromDiscord<Rosen> 0.3.1
17:14:00FromDiscord<Rika> i checked docs
17:14:02FromDiscord<Rika> its not there
17:14:11FromDiscord<Rika> only for float matrices does it exist
17:14:20FromDiscord<Rosen> oh!
17:14:23FromDiscord<Rosen> that makes sense
17:14:24FromDiscord<Rosen> durr
17:14:26FromDiscord<Rosen> thank you
17:15:48*geek_ quit (Remote host closed the connection)
17:39:10*src left #nim (Leaving)
17:52:42FromDiscord<Schelz> Can somebody give me an idea how could I separate mingw 64 compiler from mingw 32 ?
17:56:31FromDiscord<Schelz> they bugged out and its using only 32 bit
17:58:35FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3IS1
18:00:54FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3IS6
18:01:00FromDiscord<Rika> its a start of course
18:01:20FromDiscord<Rika> also whoops, should be \`typ\` and \`val`
18:01:32FromDiscord<Rika> or wait idk anymore tbh
18:02:24FromDiscord<TryAngle> looks good tbh↵if I want to make it more I could make the parameters a type and take varargs as parameter in the template?
18:02:36FromDiscord<TryAngle> (edit) "more" => "in "one call""
18:02:43FromDiscord<TryAngle> (edit) "tbh↵if" => "already thanks↵if"
18:04:14FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3IS7
18:04:26FromDiscord<Rika> In reply to @TryAngle "looks good already": no idea what you mean
18:05:23FromDiscord<TryAngle> In reply to @Rika "no idea what you": instead of calling tovalue multiple times, do multiple types in one call
18:05:48FromDiscord<Rika> i mean yeah but that doesnt elaborate on how to do it in the template
18:05:49FromDiscord<Rika> lol
18:06:24FromDiscord<TryAngle> can't I just for loop the varargs and make a proc in the for loop 😂?
18:11:46FromDiscord<Rika> ah now i get it
18:11:50FromDiscord<Rika> okay yeah sure i guess
18:11:54FromDiscord<Rika> would be a macro then
18:29:43FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3ISd
18:30:16FromDiscord<TryAngle> adding / removing `untyped` doesn't fix it 😔
18:31:36FromDiscord<TryAngle> ah
18:32:13FromDiscord<TryAngle> calling the paramters zero / one is the issue XD
18:45:29*flynn joined #nim
19:02:38NimEventerNew Nimble package! prettyclr - Small library for working with colors, see https://github.com/prettybauble/prettyclr
19:11:15*cheer joined #nim
19:26:17*noeontheend joined #nim
19:54:17*noeontheend quit (Ping timeout: 240 seconds)
20:01:59*cheer left #nim (WeeChat 3.3)
20:23:07*noeontheend joined #nim
20:37:13NimEventerNew thread by Gcao: Geniune question about JS backend support, see https://forum.nim-lang.org/t/8727
21:27:16FromDiscord<qb> Does nim have that somewhere? https://docs.rs/linux-raw-sys/0.0.5/linux_raw_sys/v5_11/general/constant.NR_exit.html
21:28:06FromDiscord<qb> Basically looking for the syscall table
21:30:16FromDiscord<Elegantbeef> https://github.com/def-/nim-syscall only package on nimble that comes up from `syscall`
21:34:23FromDiscord<qb> Yea that enum is what I'm looking for https://github.com/def-/nim-syscall/blob/master/src/linux_x86_64/nr.nim
21:42:24FromDiscord<TryAngle> is there a way to inherit in new-style concepts?
21:42:48FromDiscord<Elegantbeef> Nope they're sadly more limited
21:43:06FromDiscord<TryAngle> I see, and mixing them is not possible either?
21:43:07FromDiscord<Elegantbeef> I assume you want A is Y and procedures?
21:44:48FromDiscord<TryAngle> ah, mixing seems actually possible lol
21:45:40FromDiscord<TryAngle> In reply to @Elegantbeef "Nope they're sadly more": but the "old-style" will be kept right?
21:45:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IT3
21:46:08FromDiscord<Elegantbeef> For now atleast it'll be kept
21:46:58FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3IT4
21:47:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3IT5
21:47:24FromDiscord<TryAngle> thx
21:47:52FromDiscord<Elegantbeef> But you of course can always use the concept method, if you prefer(though might be more likely to hit a concept recurse limit)
21:48:33FromDiscord<TryAngle> In reply to @Elegantbeef "But you of course": oh, what is the limit?
21:49:07FromDiscord<Elegantbeef> I dont know the compiler will bitch at you when you reach it
21:49:34FromDiscord<TryAngle> hmmm I think the max that I will hit in the whole project will be 10
21:49:39FromDiscord<TryAngle> so I think that should be fine
21:49:42FromDiscord<Elegantbeef> Though if you're using new concepts that's less of an issue afaik, since the old method used `when compiles` internally
21:49:53FromDiscord<Elegantbeef> The new method uses more sensible reasoning afaik
22:05:27FromDiscord<jfmonty2> sent a code paste, see https://play.nim-lang.org/#ix=3ITb
22:05:34FromDiscord<jfmonty2> but I get an error because I'm attempting to redefine the `len` field
22:06:04FromDiscord<Elegantbeef> use `elif` instead of `when, when, else`
22:06:24FromDiscord<Elegantbeef> should be `when, elif, else`
22:06:31FromDiscord<jfmonty2> oh
22:06:40FromDiscord<jfmonty2> huh, didn't know that
22:06:49FromDiscord<qb> I'm trying to inject a syscall into a process with ptrace. I've found some usable cpp code but the nim version doesn't works yet. Am I missing something? https://play.nim-lang.org/#ix=3ITa
22:07:53FromDiscord<Elegantbeef> Ugh is today the day i read C++ 😛
22:08:41FromDiscord<Elegantbeef> Dont `cast` those valuse do `clong syscall_n` ....
22:08:47FromDiscord<Elegantbeef> or how ever you prefer that call
22:09:39FromDiscord<Elegantbeef> Also what compiler are you using?
22:10:48FromDiscord<metamuffin> https://youtu.be/B6ftyLpyono
22:12:36FromDiscord<qb> In reply to @Elegantbeef "Also what compiler are": gcc
22:16:01FromDiscord<qb> Gonna get some sleep. Gonna fix that casts. Thats the result of dumb copying cpp code to nim 😄
22:16:18FromDiscord<qb> (edit) "Gonna" => "I'm going to"
22:25:35FromDiscord<TryAngle> wait how do I import from a module that is above?↵import ../name↵seems to not be the correct one 😂
22:25:43FromDiscord<TryAngle> (edit) "above?↵import ../name↵seems" => "above?↵`import ../name`↵seems"
22:26:11FromDiscord<Elegantbeef> That is the proper way to import it
22:26:48FromDiscord<TryAngle> ah
22:27:01FromDiscord<TryAngle> ../↵is not compatible↵with [name1, name2]
22:30:58FromDiscord<Solitude> `".." ` as a workaround
22:46:21FromDiscord<TryAngle> does nim allow to define 3-ary operators?
23:04:58FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3ITk
23:23:01FromDiscord<Elegantbeef> `SomeSignedInt` and `SomeUnsignedInt` exist btw
23:24:30FromDiscord<Elegantbeef> The issue is it's ambiguous
23:24:41FromDiscord<Elegantbeef> `3` can be both `uint` or `int` depending on context
23:25:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ITp
23:25:47FromDiscord<Elegantbeef> @TryAngle\: ^
23:28:59FromDiscord<TryAngle> ah I see
23:29:32FromDiscord<TryAngle> so it would work in cases like this if I specifiy if it's int or uint when calling the Test function like you did?
23:30:27FromDiscord<TryAngle> but why does it work then if I manually implement all via a template?
23:31:10FromDiscord<Elegantbeef> Example?
23:31:19FromDiscord<Elegantbeef> The reason the float works btw is `1.0` is float64
23:31:34FromDiscord<Elegantbeef> Unless there is only a float32 proc i should say
23:32:20FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3ITt
23:33:40FromDiscord<Elegantbeef> Not having a typeclass is my wager, with a type class it's ambiguous if it's SomeSignedInt or SomeUnsignedInt, without type class it prefers `int`
23:34:38FromDiscord<TryAngle> hmmm should I add a PR for that or is that intended behavior? looks a bit sus
23:35:48FromDiscord<Elegantbeef> I think it's just how it works, conversions arent done to typeclasses, it is confusing though
23:35:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ITv
23:35:59FromDiscord<Elegantbeef> I have to shovel some snow so if you have follow up questions it'll be delayed
23:37:56FromDiscord<TryAngle> so it's intended?
23:45:12FromDiscord<Elegantbeef> It maybe, i think when there are overloaded calls if all are typeclasses it wants explicit