<< 23-06-2024 >>

01:00:02*nazgulsenpai quit (Quit: ZNC 1.8.2 - https://znc.in)
01:03:27*nazgulsenpai joined #nim
01:27:05*krux02 quit (Remote host closed the connection)
07:02:51*coldfeet joined #nim
07:37:37*ntat joined #nim
08:58:10*coldfeet quit (Remote host closed the connection)
09:19:59*coldfeet joined #nim
09:23:47FromDiscord<orzogc> Can the official vscode extension format codes on save? I didn't get it to work.
09:26:54FromDiscord<zumi.dxy> there's a separate unofficial extension called `nph`
09:27:00FromDiscord<zumi.dxy> that will do the formatting for you
09:32:28FromDiscord<orzogc> I get it, thanks
09:38:42*beholders_eye joined #nim
09:49:21*beholders_eye quit (Ping timeout: 256 seconds)
09:51:29*beholders_eye joined #nim
09:57:15*beholders_eye quit (Ping timeout: 264 seconds)
10:04:21FromDiscord<kots> sent a code paste, see https://play.nim-lang.org/#pasty=REmFOusd
10:05:14FromDiscord<zumi.dxy> how does it change?
10:05:40FromDiscord<kots> no more ugly double-indent when splitting a long parameter list into multiple lines, and no more separating parameters with commas
10:22:17*ntat quit (Quit: Leaving)
10:29:29FromDiscord<zumi.dxy> i kinda see the point of the double indent as awful as it looks
11:27:07NimEventerNew thread by phoenix27: Problem with object oriented programming, see https://forum.nim-lang.org/t/11829
11:53:21FromDiscord<amjadhd> Why is sort `cmp` declared with `{.closure.}` ?
11:53:37FromDiscord<amjadhd> (edit) "?" => "?↵https://github.com/nim-lang/Nim/blob/830153323af0fce9ca5c73030c2374f03367a412/lib/pure/algorithm.nim#L369"
11:55:33FromDiscord<kots> At the risk of stating the obvious... So that you can pass closures in?
12:00:22FromDiscord<amjadhd> In reply to @k0ts "At the risk of": You can pass them without: https://play.nim-lang.org/#pasty=EtwasfLh.
12:01:25FromDiscord<Phil> In reply to @amjadhd "Why is sort `cmp`": Otherwise it would assume the proc your passing in is Nimcall, which would mean it couldn't accept a closure as those come with an environment of variables they capture, unlike Nimcall procs
12:02:22FromDiscord<Phil> Since a Nimcall proc can easily be converted into a closure without logic changes one could argue there should be some kind of converter that allows Nimcall procs everywhere that closures are specified
12:02:29FromDiscord<Phil> Sadly we don't have that
12:02:49FromDiscord<kots> In reply to @amjadhd "You can pass them": Looks like it was added before closure became the default calling convention for proc types, judging by this commit message:↵https://github.com/nim-lang/Nim/commit/8d99753d6320489e4de8cf186415b0a7be8260b4#diff-cbc4d5016c6d92af2c107522f0312d77f3935fa34c90e433dbcfba6f2138d159
12:02:54FromDiscord<Phil> So it's a closure to accept the maximum possible types of procs
12:04:13FromDiscord<Phil> In reply to @k0ts "Looks like it was": Whether closure or Nimcall is the default heavily depends on which syntax you're in. ↵Iirc in a type declaration it assumes closure automatically. ↵In top level procs it assumes Nimcall.↵I forgot what it assumes for procs defined in procs
12:05:00FromDiscord<kots> Default is closure for proc types:↵https://wandbox.org/permlink/Di8Eht1VtCf0iBmp
12:06:00FromDiscord<Phil> In reply to @k0ts "Default is closure for": As a pro parameter.↵I would not bet that foo is a closure
12:06:05FromDiscord<ieltan> In reply to @k0ts "Default is closure for": well you're creating a lambda which is a closure in this case
12:06:11FromDiscord<Phil> (edit) "pro parameter.↵I" => "proc parameter of foo.↵I"
12:06:44FromDiscord<Robyn [She/Her]> In reply to @isofruit "Whether closure or Nimcall": Ooooh so that's why I need to explicitly cast my functions to my Parser type, but weirdly enough this only applies for varargs
12:07:22FromDiscord<kots> https://wandbox.org/permlink/uqIWoIULXXyKkjh3
12:07:23FromDiscord<ieltan> i think this part of Nim sucks so much lol
12:07:27FromDiscord<kots> It's still a closure guys
12:07:48FromDiscord<kots> (edit) "a" => "~~a~~"
12:08:08FromDiscord<Phil> Calling convention between Nimcall and Closure is one of those things that ideally would be transparent
12:08:19FromDiscord<Robyn [She/Her]> In reply to @ieltan "i think this part": The fact nimcall is distinct from closure?
12:08:49FromDiscord<Phil> In reply to @k0ts "It's still ~~a~~ closure": You're still passing it into the proc, messaging Nim likely does the calling convention of closure implicitly. ↵Try the same echo for foo itself
12:09:06FromDiscord<Phil> (edit) "messaging" => "meaning"
12:09:21FromDiscord<ieltan> In reply to @chronos.vitaqua "The fact nimcall is": the fact that you think you're passing a nimcall but it's actually closure
12:09:42FromDiscord<ieltan> and you need to anotate `{.nimcall.}` to avoid that
12:09:47FromDiscord<ieltan> 😐
12:09:50FromDiscord<kots> https://nim-lang.github.io/Nim/manual.html#types-procedural-type
12:10:01FromDiscord<kots> It says proc types are closure by default
12:10:03FromDiscord<Robyn [She/Her]> In reply to @ieltan "and you need to": I mean, it makes sense
12:10:15FromDiscord<kots> Can someone show me when this isn't the case?
12:10:46FromDiscord<Phil> is the default convention used for a Nim proc. It is the same as fastcall, but only for C compilers that support fastcall.
12:10:52FromDiscord<Phil> For nimcall
12:11:03FromDiscord<Phil> Closure is the default for proc types
12:11:11FromDiscord<kots> That's what I've been saying though...
12:11:21FromDiscord<kots> I'm not sure what we are disagreeing about here...
12:12:06FromDiscord<Phil> And we've been telling you it depends on which syntax you're in and it's a mixed bag.↵Outside of your proc on top level, chances are that the Nimcall calling convention is used
12:12:49FromDiscord<Phil> I'm on phone and in between exercises so I can't exactly write code rn
12:12:50FromDiscord<kots> It's not a mixed bag, when you write a proc it's nimcall, when you write a proc type it's closure
12:13:34FromDiscord<kots> When you declare a proc parameter its type is a proc type so its default convention is closure
12:13:55FromDiscord<kots> The only question here is why it was declared explicitly when it defaults to closure anyway
12:14:14FromDiscord<ieltan> In reply to @chronos.vitaqua "I mean, it makes": i'm just sauying it sucks, i remember making a custom `map`, i had to make like two versions because of the compiler crying about`{.nimcall.}` and`{.closure.}` . But now you have no clue which one is being used at call site loo
12:14:22FromDiscord<kots> If I'm missing something please point it out explicitly, I feel like I'm retarded
12:15:03FromDiscord<kots> (edit) removed "proc" | "parameter ... its" added "that is a proc,"
12:16:46FromDiscord<Robyn [She/Her]> In reply to @ieltan "i'm just sauying it": I'd say that's a non-issue since functionality is still identical, no?
12:18:05FromDiscord<ieltan> In reply to @chronos.vitaqua "I'd say that's a": erm no, if i would want to avoid closures whenever i can because they have bigger overhead. so i have to make a `{.nimcall.}` version...
12:18:16FromDiscord<ieltan> (edit) removed "if"
12:19:26FromDiscord<Robyn [She/Her]> True, didn't think of that
12:20:17FromDiscord<Robyn [She/Her]> It's a non-issue in my case since my parser combinator does parser combination at compile-time when possible
12:21:47FromDiscord<ieltan> well in my case i just have no way to know which one is called because nimcall implicitly converts to closures.
12:22:28FromDiscord<Robyn [She/Her]> Couldn't you make two functions that accepts either one?
12:22:56FromDiscord<Robyn [She/Her]> Then the one that accepts a closure can just be annotated with `{.error.}`
12:23:25FromDiscord<ieltan> yes but sometimes i need to closure too, i mean a `map` that cannot accept closure is kinda useless
12:23:37FromDiscord<Robyn [She/Her]> Fair enough
12:24:12FromDiscord<ieltan> `{.nimcall.}` is accepted because not everything is a closure and it's a good way to avoid overhead
12:25:10FromDiscord<Robyn [She/Her]> Makes sense
12:25:38FromDiscord<amjadhd> In reply to @isofruit "Since a Nimcall proc": It is converted implicitly to a closure: https://play.nim-lang.org/#pasty=xIugyPRA
12:26:43FromDiscord<kots> the answer to the original question is that it was marked as closure before closure became the default:↵https://github.com/nim-lang/Nim/commit/8d99753d6320489e4de8cf186415b0a7be8260b4↵https://github.com/nim-lang/Nim/commit/033dc50c691f37808e021856bcd0d385cf427ec2
12:27:43FromDiscord<ieltan> i tried looking up how the stdlib does it, hoping they're not just sticking with `{.closure.}`
12:27:53FromDiscord<ieltan> nope, of course theyre are
12:28:12FromDiscord<Phil> In reply to @amjadhd "It is converted implicitly": ... I'm highly wondering why that conversion didn't work for me when also dealing with async procs elsewhere, but likely a caveat of sorts
12:30:05FromDiscord<ieltan> In reply to @isofruit "... I'm highly wondering": async are totally different thing
12:35:45FromDiscord<ieltan> i guess this answers my problem: https://play.nim-lang.org/#pasty=oaLihBns
12:36:13FromDiscord<ieltan> but it's very unintuitive
12:40:06FromDiscord<ieltan> In reply to @ieltan "i guess this answers": or not, why is `baz()` calling the closure version ?
12:42:19FromDiscord<kots> cause baz is a closure, isn't it
12:42:37FromDiscord<ieltan> ah
12:42:47FromDiscord<ieltan> yeah sorry i missed the `x`
12:43:13FromDiscord<ieltan> nvm
13:49:36*xet7 joined #nim
13:59:59*xtr00 joined #nim
15:16:02*xtr00 quit (Ping timeout: 250 seconds)
15:49:13*lucasta joined #nim
15:49:42FromDiscord<saint.___.> Has there been any news on IC?
15:49:56FromDiscord<saint.___.> I can't seem to find any updates on github, but not totally sure where I should be looking
15:53:34FromDiscord<leorize> check back in 8 years, then maybe IC will be here
16:08:17*lucasta quit (Remote host closed the connection)
16:25:30*xtr00 joined #nim
16:59:41*ntat joined #nim
17:04:50FromDiscord<ieltan> lol
17:18:30FromDiscord<albassort> i need a type which is like
17:18:32FromDiscord<albassort> not pointer
17:18:39FromDiscord<albassort> anything besides a pointer
17:20:15FromDiscord<fabric.input_output> `distinct pointer`
17:27:47FromDiscord<Robyn [She/Her]> In reply to @albassort "not pointer": `not pointer`?
17:27:58FromDiscord<Robyn [She/Her]> Literally pass that as a generic argument :P
17:28:14FromDiscord<Robyn [She/Her]> !eval echo $(not pointer)
17:28:15NimBotCompile failed: /usercode/in.nim(1, 6) Error: type mismatch
17:28:29FromDiscord<Robyn [She/Her]> Huh?
17:28:38FromDiscord<Robyn [She/Her]> Oh wait
17:30:36FromDiscord<Robyn [She/Her]> !eval echo (proc(arg: (not pointer | not ptr typedesc): typeof(arg) = arg)("string")
17:30:38NimBotCompile failed: /usercode/in.nim(1, 50) Error: expected: ')', but got: ':'
17:31:10FromDiscord<Robyn [She/Her]> This is painful
17:31:32FromDiscord<Robyn [She/Her]> Hey mods, please can we get a bot that can run Nim code for the Discord and Matrix side? Would be hella useful
17:32:14FromDiscord<Robyn [She/Her]> Like, multiple lines of code
17:32:29FromDiscord<Robyn [She/Her]> !eval echo("a",↵ "b")
17:32:31NimBotCompile failed: /usercode/in.nim(1, 10) Error: undeclared identifier: '↵'
17:32:55FromDiscord<Robyn [She/Her]> :P
17:51:35*om3ga joined #nim
17:57:52*coldfeet quit (Remote host closed the connection)
18:06:04FromDiscord<leorize> nimbot is a dom product
18:06:24FromDiscord<leorize> ah no, it's in nim-lang
18:06:36FromDiscord<leorize> so further dev could be done
18:06:46FromDiscord<leorize> I guess that just meant\: PR welcome \:p
18:07:04FromDiscord<Robyn [She/Her]> Idk how to do Matrix bot development :P
18:09:13FromDiscord<leorize> just make it be able to handle multi-line discord messages from IRC side
18:15:10FromDiscord<Robyn [She/Her]> Fair point
18:15:35FromDiscord<Robyn [She/Her]> How does it work for multiple line Matrix messages? Same issue?
18:18:41FromDiscord<leorize> the pipeline is\: matrix -\> discord -\> irc
18:18:50FromDiscord<leorize> so handle discord part and you get matrix for free
18:36:59FromDiscord<Robyn [She/Her]> Makes sense
18:42:44xtr00what's up with this code? https://play.nim-lang.org/#pasty=hHgSCmVD
18:46:47FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=VmpVaqXg
18:47:51FromDiscord<Robyn [She/Her]> Doesn't handle distinct pointers but that's easy to solve with a concept
18:49:07FromDiscord<ieltan> why not `type SomePointer = ref | ptr | pointer | proc; proc test[T: not SomePointer](val: T): T`
18:50:12FromDiscord<ieltan> its also DRY if you have lots of procs where you dont want to take pointers
19:44:04*disso-peach joined #nim
19:47:00FromDiscord<Elegantbeef> @Robyn [She/Her] why `not ptr typedesc`?
19:47:09FromDiscord<Elegantbeef> In what world can you have a `ptr typedesc`?
19:50:39FromDiscord<Phil> In reply to @chronos.vitaqua "Hey mods, *please* can": I can only drop the good old "PR welcome" line here
19:52:00FromDiscord<albassort> phil
19:52:14FromDiscord<albassort> i've spent the past few hours squashing memory leaks
19:52:16FromDiscord<albassort> :)
19:52:27FromDiscord<albassort> unlike you though, my efforts are born fruit and i haven't gone insane (yet)
19:53:48FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "In what world can": I would've thought that'd do generic binding or something
19:54:03FromDiscord<Elegantbeef> I can make up word combinations aswell
19:54:04FromDiscord<Robyn [She/Her]> Though I think it just shows how dead my memory is rn
19:54:20FromDiscord<Elegantbeef> Tangential static type parameters
19:54:23FromDiscord<Elegantbeef> Look words!
19:54:27FromDiscord<Robyn [She/Her]> What would you do to prevent any `ptr`?
19:54:39FromDiscord<Elegantbeef> `not(ptr or ref)`
19:54:47FromDiscord<Elegantbeef> `or pointer`
19:55:23FromDiscord<Elegantbeef> xtr00 complex type aliases are no bueno so https://play.nim-lang.org/#pasty=TXEfBPFH
19:57:49FromDiscord<Phil> In reply to @albassort "unlike you though, my": If you got energy to shit-talk you got energy to do bot contributions 😛
19:58:18FromDiscord<albassort> im just bragging that my issues are much smaller in scale :p
19:58:53FromDiscord<Phil> Sidenote, for general debugging with multithreaded code I found balls to be pretty handy
19:59:13FromDiscord<Phil> As in, if you want to be a thousand percent safe, that's the way to go imo.↵Yes this is me shilling a disruptek project
19:59:16FromDiscord<albassort> afab people c ant debug multithreaded data leaks?
19:59:31FromDiscord<albassort> (edit) "c ant" => "cant"
19:59:46FromDiscord<Elegantbeef> It's their loss
20:00:04FromDiscord<Elegantbeef> I am confused how ACAB and AFAB intersect 😄
20:00:07FromDiscord<Phil> In reply to @albassort "afab people cant debug": Its a new form of modern sexism and misoginy, you're not cool enough to understand
20:00:24FromDiscord<Phil> In reply to @Elegantbeef "I am confused how": Some people are just assigned cop at birth
20:01:31FromDiscord<Phil> Coming off my joke-horse though, I mean the "Balls" test-lib.↵It essentially runs valgrind, helgrind, asan and tsan over your project (because valgrind/helgrind sometimes catch things asan/tsan don't and vice versa)
20:01:49xtr00Elegantbeef: thanks that works, but not intuitive.
20:02:02*ntat quit (Quit: Leaving)
20:02:10FromDiscord<Elegantbeef> Yea generic alias types are fun!
20:03:44xtr00there are more imporant things to improve in nim, so I wont create a bug for this, for now.
20:03:50FromDiscord<albassort> i think my code has classical malloc dataleaks
20:03:57FromDiscord<albassort> so nothing to worry about
22:04:50FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=xaBxCYiq
22:04:54FromDiscord<Robyn [She/Her]> Yummy hacky code
22:13:40FromDiscord<Elegantbeef> But why
22:13:55FromDiscord<Robyn [She/Her]> Parser combinator :3
22:14:25FromDiscord<Robyn [She/Her]> Recursive calls to `parseExpression` needed and since I'm doing pratt parsing, I need `subExpPrecedence`
22:14:45FromDiscord<Robyn [She/Her]> I think I need another param for `out` too...
22:16:06FromDiscord<Elegantbeef> But why the converter?
22:19:02FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "But why the converter?": Type mismatch otherwise and I don't wanna explicitly convert it
22:19:30FromDiscord<Elegantbeef> So define an overload?
22:22:54FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "So define an overload?": That's... A good idea :P
22:27:34FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=hjiTMPTd
22:27:39FromDiscord<Robyn [She/Her]> In the stdlib
22:29:57FromDiscord<Elegantbeef> Cause `or` is wrong there 😛
22:30:06FromDiscord<Elegantbeef> Wait I'm daft
22:30:14FromDiscord<Elegantbeef> No comment
22:31:44FromDiscord<Omi.> https://t.me/Hamster_kombat_bot/start?startapp=kentId7455986345↵↵↵Million dollar business
22:32:35FromDiscord<Omi.> Get started, time is limited
22:34:01FromDiscord<Robyn [She/Her]> <@&371760044473319454>
22:34:54FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "No comment": Hm, should I ask in internals then? I'ma do it
22:48:34FromDiscord<zumi.dxy> how about a one dollar business instead 😏
23:01:38FromDiscord<Elegantbeef> A million one dollar business
23:01:42FromDiscord<Elegantbeef> es
23:03:32FromDiscord<tommyzjones_20> sent a long message, see https://pasty.ee/YqMqFHVz
23:08:31*pbsds3 quit (Quit: Ping timeout (120 seconds))
23:09:02*pbsds3 joined #nim
23:16:42FromDiscord<Robyn [She/Her]> :p
23:17:00FromDiscord<Robyn [She/Her]> Anyway, maybe writing my own parser combinator was a mistake xD
23:18:46*xtr00 quit (Ping timeout: 250 seconds)
23:43:52NimEventerNew thread by mig: Forum on Firefox is broken, see https://forum.nim-lang.org/t/11831
23:49:32FromDiscord<albassort> alright i found a nim bug but i don't know how to solve it
23:50:19FromDiscord<__jont__> Having the most difficult time creating a Nim binding for a C/C++ library - namely Box2D. Anyone have any resources out there to help with creating Nim bindings? Finding language documentation hard to follow
23:50:55FromDiscord<saint.___.> In reply to @__jont__ "Having the most difficult": Is it C or c++
23:51:12FromDiscord<saint.___.> Or both
23:51:27FromDiscord<saint.___.> If you write a C interface for it then futhark can do it automatically for you
23:51:43FromDiscord<albassort> do i have a return struct from an ffi function, for some reason in my current build, if I dont echo the errorcode it will assume its 0, if i do echo it will not. This means that my unittest fails depending on if it observe it not
23:51:48FromDiscord<__jont__> In reply to @saint.___. "Is it C or": Could be either. They have box2c, which is a pure C implementation
23:51:50FromDiscord<albassort> @ElegantBeef is this a bug or a feature :)
23:51:58FromDiscord<Elegantbeef> Use a C api instead of C++
23:52:00FromDiscord<albassort> In reply to @__jont__ "Could be either. They": you'd want to use the C
23:52:01FromDiscord<saint.___.> In reply to @__jont__ "Could be either. They": Okie have you looked into futhark then? It does it automatically
23:52:02FromDiscord<saint.___.> Ya
23:52:05FromDiscord<saint.___.> It's very good
23:52:10FromDiscord<Elegantbeef> Then use c2nim or futhark
23:52:17FromDiscord<albassort> (edit) "do" => "so"
23:52:20FromDiscord<saint.___.> Try futhark first
23:52:37FromDiscord<saint.___.> I could not get c2nim to work and not easy to figure out personally
23:52:41FromDiscord<Elegantbeef> > so i have a return struct from an ffi function,
23:52:42FromDiscord<Elegantbeef> ...
23:52:48FromDiscord<Elegantbeef> What do you expect
23:52:52FromDiscord<__jont__> In reply to @saint.___. "Okie have you looked": I’ve seen it mentioned but haven’t used it yet. C2nim didn’t output anything worthwhile
23:52:54FromDiscord<albassort> it to work as expected?
23:52:57FromDiscord<Elegantbeef> Returning a struct should work find if the ABI is the same
23:53:23FromDiscord<saint.___.> In reply to @__jont__ "I’ve seen it mentioned": Install it and it should work good. Ppl here will be able to help you too but basically it should all work
23:53:23FromDiscord<Elegantbeef> So provide an example so I can see what you're doing instead of throwing darts at my monitor... I'm running out of spare monitors
23:53:27FromDiscord<albassort> it has worked fine for like 2 weeks up until RIGHT Now where im getting this issue on this particular build
23:53:33FromDiscord<Elegantbeef> C2nim works best with `gcc -E`
23:53:36FromDiscord<saint.___.> Just have to learn what sort of nim types correspond to c types
23:53:45FromDiscord<albassort> grumble grumble grumble
23:53:49FromDiscord<saint.___.> And then pass your data in and it will work
23:54:13FromDiscord<albassort> i'll change the rust build slightly and see if that will make it not do this
23:54:16FromDiscord<Elegantbeef> @albassort I do wish I could just intuit the code you've written but I'm only a simple man without supernatural powers
23:54:23FromDiscord<Elegantbeef> Just show the Nim bindings and your usage
23:55:18FromDiscord<albassort> i'm not ready for the beef critique
23:55:35FromDiscord<Elegantbeef> Well then you are not read for help
23:55:51FromDiscord<Elegantbeef> Are you by anychance using a `ref` in the Nim struct?
23:56:02FromDiscord<Elegantbeef> If so you NEED to mark it `{.cdecl.}`
23:56:05FromDiscord<albassort> no ref, its a pure unt8
23:56:08FromDiscord<Elegantbeef> Otherwise Nim will NRVO it
23:56:10FromDiscord<albassort> (edit) "unt8" => "uint8"
23:56:28FromDiscord<__jont__> In reply to @saint.___. "Install it and it": For sure, will try it out. Thank you everyone
23:56:35FromDiscord<albassort> uint8 straight from rust's memory, no pointers, no smart pointers, 1 byte of memory, organic, farm raised
23:56:56FromDiscord<saint.___.> In reply to @__jont__ "For sure, will try": No problem!
23:57:05FromDiscord<Elegantbeef> Well then what's the Nim header?
23:57:24FromDiscord<albassort> everything is synced up and it worked effortlessly in the past
23:57:47FromDiscord<albassort> there are like 20 tests for this function, it only happens for 1 of them
23:58:49FromDiscord<albassort> i recompiled both nim and rust, removed the echo, and it works fine
23:58:51FromDiscord<albassort> ??????????
23:59:09FromDiscord<albassort> alright this is too silly maybe i should keep this
23:59:15FromDiscord<albassort> (edit) "alright this is too silly maybe i should keep this ... " added "for bug tracking"
23:59:39FromDiscord<albassort> because its reproducible so long as i keep the rust without an extra \n