<< 07-01-2022 >>

00:00:02FromDiscord<Elegantbeef> So what needs to placed in the body of this proc is the `mgetOrPut` symbol that matches the one we want, and since we dont have an instantiated generic i dont think `semOverloadedCall` will work
00:01:36FromDiscord<Elegantbeef> I've been wrong before so if you can make my statement wrong i'll be happy 😛
00:11:02FromDiscord<SirOlaf> How are generic overrides resolved then
00:11:18FromDiscord<Elegantbeef> Generic overrides wouldnt be allowed to borrow afaict
00:11:27FromDiscord<SirOlaf> But they must be resolved somehow
00:11:30FromDiscord<SirOlaf> Even without borrow
00:11:35FromDiscord<Elegantbeef> They have more specific types
00:11:48FromDiscord<Elegantbeef> On instantiation their types are used to dispatch
00:12:05FromDiscord<Elegantbeef> The dispatch is done on a instantiated type
00:12:12FromDiscord<SirOlaf> Guess that makes sense
00:12:45FromDiscord<SirOlaf> Why are borrowed functions different though?
00:13:02FromDiscord<SirOlaf> Generic functions get ignore from what I know, why are borrowed generic functions not ignored too
00:13:12FromDiscord<SirOlaf> Until a concrete type is given
00:13:38FromDiscord<Elegantbeef> The issue is we need to get the symbol
00:14:02FromDiscord<Elegantbeef> I guess this could be delayed until generic instantiation
00:14:05FromDiscord<SirOlaf> Point is that the entire resolution should be unneeded until later
00:14:34FromDiscord<Elegantbeef> So yea at generic instantiation is when you need to make the borrow it seems
00:14:54FromDiscord<SirOlaf> Yep, that is the idea. I have no idea where to even begin with that though
00:15:04FromDiscord<Elegantbeef> `semInst`
00:15:50FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/seminst.nim#L403-L404 here i think
00:18:35FromDiscord<SirOlaf> searchForBorrowProc still needs to do something about it
00:20:25FromDiscord<Elegantbeef> Check if the symbol flags has `sfBorrow` if so run that proc, else instantiate body?
00:22:39FromDiscord<SirOlaf> Gotta slow down there, this is new territory for me
00:22:52FromDiscord<SirOlaf> seminst that is
00:25:43FromDiscord<SirOlaf> First question I have is how it can get to generateInstance if searchForBorrowProc fails before
00:25:59FromDiscord<SirOlaf> Or does it happen the other way around
00:28:49FromDiscord<Elegantbeef> You dont call search if it's generic
00:29:36FromDiscord<Elegantbeef> I guess generic with unresolved types
00:30:34FromDiscord<SirOlaf> So simply stop semBorrow?
00:31:17FromDiscord<Elegantbeef> I think so if it has generic parameters you wait until generic instantiation to borrow
00:31:21FromDiscord<Elegantbeef> that seems to make sense to me
00:31:42FromDiscord<SirOlaf> It makes sense, but whether or not that's how things are done in the compiler is a mystery to me
00:32:16FromDiscord<Elegantbeef> Yea it's yet to be seen if this will work
00:35:15FromDiscord<SirOlaf> Now how do you check if it has generic params
00:35:47FromDiscord<SirOlaf> I may or may not have seen a function for that purpose at some point
00:35:48FromDiscord<Elegantbeef> `procAst[genericParamsPos].len > 0`
00:36:20*tiorock joined #nim
00:36:21*tiorock quit (Changing host)
00:36:21*tiorock joined #nim
00:36:21*rockcavera is now known as Guest1211
00:36:21*Guest1211 quit (Killed (strontium.libera.chat (Nickname regained by services)))
00:36:21*tiorock is now known as rockcavera
00:36:21FromDiscord<Elegantbeef> There might be
00:36:36*krux02 quit (Remote host closed the connection)
00:37:05FromDiscord<SirOlaf> There is a isGenericRoutine
00:37:30FromDiscord<Gorylek😚> Hi
00:37:44FromDiscord<Elegantbeef> Yellow
00:38:02FromDiscord<SirOlaf> (edit) "There is a isGenericRoutine ... " added "in ast"
00:38:36FromDiscord<SirOlaf> In reply to @SirOlaf "There is a isGenericRoutine": Does what it says
00:39:37FromDiscord<SirOlaf> So, I can now prevent semBorrow from doing things
00:40:16FromDiscord<Elegantbeef> Nice we're half way there wooooaaah
00:41:59*rockcavera quit (Ping timeout: 256 seconds)
00:43:54FromDiscord<SirOlaf> Actually not quite, it doesn't enjoy that
00:44:33FromDiscord<SirOlaf> Or no, fixed itself
00:45:56FromDiscord<SirOlaf> Ok it does what it should. Trying to use mgetOrPut creates a new error, which is expected (`Error: internal error: wrong AST for borrowed symbol`)
00:46:13FromDiscord<SirOlaf> So now it has to be made usable
00:47:49FromDiscord<SirOlaf> Now how should generateInstance deal with this
00:48:38FromDiscord<Elegantbeef> Check if the `sfBorrow in procSym.flags` if so make the body the borrowed symbol, otherwise instantiate the body
00:50:43FromDiscord<SirOlaf> How can I get the body though
00:51:12FromDiscord<Elegantbeef> `procAst[bodyPos] = semBorrowProc`
00:53:04FromDiscord<SirOlaf> `n[bodyPos] = fn.ast` ?
00:53:26FromDiscord<SirOlaf> Or using getBody
00:53:45FromDiscord<Elegantbeef> semBorrow writes to body
00:54:01FromDiscord<Elegantbeef> So you just do `semBorrow` in the tree if it's supposed to borrow
00:54:02FromDiscord<Elegantbeef> Otherwise you instantiate the body
00:55:13FromDiscord<SirOlaf> That is a bit of a dilemma
00:55:20FromDiscord<Elegantbeef> Why?
00:55:26FromDiscord<SirOlaf> semBorrow can't succeed, can it
00:55:36FromDiscord<Elegantbeef> it can at the point of the generic isntantiation
00:55:46FromDiscord<Elegantbeef> Since we now have a concrete type instead of a generic inst
00:55:52FromDiscord<Elegantbeef> generic invocation\
00:56:04FromDiscord<SirOlaf> Oh yeah, we finally got concrete types
00:58:07*rockcavera joined #nim
00:58:08*rockcavera quit (Changing host)
00:58:08*rockcavera joined #nim
00:58:15FromDiscord<SirOlaf> Problem is that I don't have access to it from seminst
00:58:38FromDiscord<Elegantbeef> Reorder it so you do
00:58:48FromDiscord<SirOlaf> Great plan
00:58:55FromDiscord<SirOlaf> Issue is that I also can't import it
00:59:27FromDiscord<Elegantbeef> You can move code around
01:00:02FromDiscord<SirOlaf> Wouldn't I need to move semBorrow into a different file then
01:00:04FromDiscord<SirOlaf> Seems a bit intrusive
01:01:05FromDiscord<Elegantbeef> You gotta do what you gotta do
01:01:31FromDiscord<Elegantbeef> Get it to work then clean it up
01:05:11FromDiscord<SirOlaf> Issue seems to just be that seminst is included before semstmts. Moving it produces more issues though, so this is quite the puzzle
01:09:57FromDiscord<Elegantbeef> Just move the borrow stuff into the main module for now
01:10:50FromDiscord<SirOlaf> Easier said than done
01:11:10FromDiscord<SirOlaf> searchForBorrowProc for example depends on lots of stuff in semcall
01:11:16FromDiscord<SirOlaf> So can't move it out
01:11:39FromDiscord<SirOlaf> Who would have thought the real challenge would be getting the code in the right order
01:12:45FromDiscord<Elegantbeef> If you send the diff over i could look at it 😀
01:13:54FromDiscord<SirOlaf> Couldn't I just predecalre
01:13:59FromDiscord<SirOlaf> (edit) "predecalre" => "forward declare"
01:14:40FromDiscord<Elegantbeef> Depends if the modules are imported or included
01:14:45FromDiscord<SirOlaf> All is included
01:14:49FromDiscord<SirOlaf> That's why they all depend on each other
01:14:53FromDiscord<Elegantbeef> Then perhaps
01:32:44FromDiscord<SirOlaf> In reply to @SirOlaf "Actually got it to": We are back at this issue
01:33:39FromDiscord<Elegantbeef> Is the type a generic instance or generic invocation?
01:33:52FromDiscord<SirOlaf> Which one
01:34:11FromDiscord<Elegantbeef> Inside the proc we've declared
01:34:23FromDiscord<Elegantbeef> IE is `DefaultTable`
01:34:49FromDiscord<SirOlaf> How or where would I check this
01:34:52FromDiscord<SirOlaf> Not quite following
01:35:40FromDiscord<Elegantbeef> check the `ast[paramPos][0].typ.kind`
01:36:28FromDiscord<Elegantbeef> If it's a `genericInvocation` we're lacking the instantiation info in our proc header
01:37:03FromDiscord<SirOlaf> In reply to @Elegantbeef "check the `ast[paramPos][0].typ.kind`": Which ast though
01:37:14FromDiscord<SirOlaf> At what stage of this process
01:37:37FromDiscord<Elegantbeef> Before you `semBorrow` do `echo n[paramPos][1.typ.kind]`
01:37:49FromDiscord<Elegantbeef> `echo n[paramPos][1].typ.kind`\
01:38:06FromDiscord<Elegantbeef> Inside the generate instance
01:38:31FromDiscord<SirOlaf> Do you mean genericParamsPos?
01:38:37FromDiscord<SirOlaf> Because paramPos is not declared
01:38:38FromDiscord<Elegantbeef> No
01:39:09FromDiscord<Elegantbeef> `paramsPos`\
01:40:43FromDiscord<SirOlaf> That gives me sigsegv
01:40:53FromDiscord<SirOlaf> So not quite the output you might want
01:41:39FromDiscord<Elegantbeef> You did do it only inside the borrow branch right?
01:42:39FromDiscord<SirOlaf> I put an if statement at the location you showed on github and placed the echo there
01:44:00FromDiscord<Elegantbeef> odd
01:47:19FromDiscord<SirOlaf> It does not have a paramsPos
01:47:23FromDiscord<SirOlaf> Not long enough
01:47:38FromDiscord<SirOlaf> Or no that's wrong
01:48:59FromDiscord<SirOlaf> It does not have a typ
01:49:16FromDiscord<Elegantbeef> it might be `result.ast` instead
01:49:35FromDiscord<Elegantbeef> Seems that might be the AST we want to use
01:50:04FromDiscord<Elegantbeef> so pass that to sem borrow instead perhaps
01:50:09FromDiscord<SirOlaf> Sure
01:54:10FromDiscord<SirOlaf> That doesn't have typ either
01:55:17FromDiscord<SirOlaf> Also same type mismatch error
01:58:53FromDiscord<Elegantbeef> Hmppph
01:59:27FromDiscord<Elegantbeef> Could you shoot me the git diff, i want to see something without bugging you
02:00:28FromDiscord<SirOlaf> Bold of you to assume I got anything set up for that
02:01:01FromDiscord<Elegantbeef> \`git diff \>\> "distinct.diff"
02:01:08FromDiscord<Elegantbeef> Then just throw that file on a site and send it
02:02:16FromDiscord<SirOlaf> https://media.discordapp.net/attachments/371759389889003532/928830869077131284/distinct.diff
02:02:20FromDiscord<SirOlaf> Not many changes to see
02:05:57FromDiscord<Elegantbeef> Hmm could you do `git diff --no-color` seems that is not playing nice
02:07:33FromDiscord<SirOlaf> https://media.discordapp.net/attachments/371759389889003532/928832197555789834/distinct.diff
02:08:19FromDiscord<Elegantbeef> Ok it's just not playing nice whatsoever
02:09:22FromDiscord<Elegantbeef> Are you by anychance using powershell?
02:09:27FromDiscord<SirOlaf> That I am
02:09:39FromDiscord<Elegantbeef> Ah apparently it ruins git diffs
02:09:44FromDiscord<Elegantbeef> Guess i'll manually apply the patch
02:09:53FromDiscord<SirOlaf> Good to know
02:21:18FromDiscord<Elegantbeef> Oh you were passing `fn` to `semBorrow` which is the uninstantiated symbol
02:21:51FromDiscord<SirOlaf> What is supposed to be passed
02:21:58FromDiscord<Elegantbeef> `result`
02:22:07FromDiscord<SirOlaf> So result.ast and result
02:22:09FromDiscord<Elegantbeef> It then causes an issue with the mismatch at the 3rd position in my test file
02:22:19FromDiscord<Elegantbeef> i think it can be `n`
02:23:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ljs
02:24:10FromDiscord<SirOlaf> I don't have that error
02:24:44FromDiscord<Elegantbeef> What do you have?
02:25:03FromDiscord<SirOlaf> Currently Error: no symbol to borrow from found again
02:25:06FromDiscord<SirOlaf> Lemme recompile
02:25:29FromDiscord<Elegantbeef> Little hint if you arent already do `./koch temp c ./someFIle.nim` if you arent already
02:25:44FromDiscord<Elegantbeef> I guess on windows it's `koch.exe`?
02:26:06FromDiscord<SirOlaf> I tried that and promptly gave up
02:26:19FromDiscord<SirOlaf> Complains about a missing lib file or something
02:26:24FromDiscord<Elegantbeef> Ah
02:26:35FromDiscord<Elegantbeef> Not on windows so cannot help much there
02:31:05FromDiscord<SirOlaf> Did you change anything other than fn
02:31:27*neurocyte0917 joined #nim
02:32:48FromDiscord<Elegantbeef> did change the `else` to an `elif` statement
02:33:07FromDiscord<Elegantbeef> ` elif c.inGenericContext == 0:` instead of `else` for the instantiate body
02:33:29*neurocyte091 quit (Ping timeout: 256 seconds)
02:33:29*neurocyte0917 is now known as neurocyte091
02:33:42FromDiscord<SirOlaf> Isn't that checked above
02:34:32FromDiscord<Elegantbeef> It was the check that was the prior
02:34:36FromDiscord<Elegantbeef> You removed it, i put it back
02:35:19FromDiscord<SirOlaf> Pretty sure I didn't remove anything
02:35:30FromDiscord<SirOlaf> Either way, this is odd
02:35:46FromDiscord<Elegantbeef> there was an `if c.genericContext ==0` guarding the body instantiation
02:35:48FromDiscord<Elegantbeef> When you added the sym check you removed that
02:36:04FromDiscord<SirOlaf> It's there for me
02:36:32FromDiscord<SirOlaf> And the diff show it too
02:36:52FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/928839576427061339/image.png
02:36:58FromDiscord<Elegantbeef> Oh nvm i see
02:37:02FromDiscord<Elegantbeef> You made this go inside
02:37:30FromDiscord<SirOlaf> Was it not supposed to go inside?
02:38:18FromDiscord<Elegantbeef> I just moved the `if c.genericContext == 0` to an elif branch
02:38:42FromDiscord<Elegantbeef> Dont think so
02:38:45FromDiscord<Elegantbeef> Could be wrong
02:40:16FromDiscord<SirOlaf> How on earth can your error be different from mine
02:40:26FromDiscord<Elegantbeef> Cause i have different flow
02:41:29*noeontheend joined #nim
02:41:42*arkurious quit (Quit: Leaving)
02:41:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ljy
02:42:17FromDiscord<SirOlaf> No I changed it
02:43:01FromDiscord<Elegantbeef> mydiff.diff https://media.discordapp.net/attachments/371759389889003532/928841123147960320/mydiff.diff
02:44:43FromDiscord<SirOlaf> That is identical
02:45:09FromDiscord<SirOlaf> What code are you testing with
02:45:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Ljz
02:45:44FromDiscord<Elegantbeef> Reduced the complexity a bit to still catch edge cases
02:45:49FromDiscord<Elegantbeef> But also makes it easier to reason
02:45:55FromDiscord<SirOlaf> That does now give me the same error
02:46:29FromDiscord<SirOlaf> Must have changed some strange stuff in my test then
02:47:08FromDiscord<Elegantbeef> The issue now is that we're skipping the generic for `key` so not getting a `DefaultTable` there
02:47:18FromDiscord<Elegantbeef> I mean `val`
02:47:30FromDiscord<SirOlaf> How is that
02:47:41FromDiscord<SirOlaf> Seems strange
02:47:45FromDiscord<Elegantbeef> Cause it's skipping over all distincts
02:47:58FromDiscord<Elegantbeef> But we want `B` to stay whatever `B` is
02:49:42FromDiscord<SirOlaf> Where could it be skipping
02:50:06FromDiscord<SirOlaf> Guess stacktrace kinda says
02:50:09FromDiscord<Elegantbeef> line 727 of semcall
02:50:21FromDiscord<SirOlaf> Also my weird koch error was because of working dir, working now
02:54:51nixfreaknim[m]I having lots of issues with understanding inline procs , I know its stupid but can someone please show me in this example ? https://play.nim-lang.org/#ix=3LjA
02:55:18nixfreaknim[m]I would I call both of those procs correctly ?
02:55:40FromDiscord<Rika> What’s the issue?
02:55:46FromDiscord<Rika> Just call them like normal
02:56:27FromDiscord<Elegantbeef> Also you may want to do `i: 0..2`
02:56:27FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3LjB
02:56:27FromDiscord<Elegantbeef> Works fine
02:58:02FromDiscord<Elegantbeef> Well olaf i'm at the end of my guesses of what can be done
02:58:08FromDiscord<Elegantbeef> So good luck from here
02:58:27FromDiscord<SirOlaf> Thanks for the assistance up till now
03:00:12FromDiscord<Elegantbeef> No problem, you're closer to having it work than i was
03:12:12FromDiscord<Varriount> How would I go about compiling Nim to WebAssembly?
03:15:05FromDiscord<Elegantbeef> Impbox has a wasm file for nico that i used
03:15:15FromDiscord<Elegantbeef> Which i think is derived from the tutorial treeform has
03:55:42*Gustavo6046_ joined #nim
03:56:32*Gustavo6046 quit (Ping timeout: 240 seconds)
04:09:38*Gustavo6046_ is now known as Gustavo6046
04:35:06NimEventerNew post on r/nim by derrpwave: nip: a simple package to get your public IP address with nim, see https://reddit.com/r/nim/comments/rxyp67/nip_a_simple_package_to_get_your_public_ip/
04:36:17*noeontheend quit (Ping timeout: 240 seconds)
04:50:11FromDiscord<michaelb> sent a code paste, see https://play.nim-lang.org/#ix=3LjY
04:50:33FromDiscord<michaelb> if you have dig and awk installed, try pasting that line in your terminal 😄
04:51:25*Gustavo6046 quit (Ping timeout: 240 seconds)
04:52:32FromDiscord<Elegantbeef> Who's going to make the issue closing the client and wrapping the echo with a `when isMainModule`
05:14:33*cyraxjoe joined #nim
05:18:57*cyraxjoe quit (Ping timeout: 240 seconds)
05:19:16*cyraxjoe joined #nim
05:24:11*Gustavo6046 joined #nim
05:41:16*cyraxjoe quit (Quit: I'm out!)
05:43:04*rockcavera quit (Remote host closed the connection)
05:43:11*cyraxjoe joined #nim
05:46:45*cyraxjoe quit (Client Quit)
05:48:20*cyraxjoe joined #nim
05:53:01*MightyJoe joined #nim
05:53:05*cyraxjoe quit (Ping timeout: 256 seconds)
06:09:52*Gustavo6046 quit (Quit: Leaving)
07:13:20*jjido joined #nim
07:21:09FromDiscord<eyecon> Why is `strformat` singular but `sequtils` plural? I always forget which is which. Why is `algorithm` singular but `setutils` plural?
07:21:23FromDiscord<eyecon> Is there a system to it or is it just random?P
07:21:29FromDiscord<eyecon> (edit) "random?P" => "random?"
07:23:11FromDiscord<Solitude> strformat implements single thing
07:23:18FromDiscord<Solitude> algorithm shoud've been plural, i guess
07:23:43*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
07:23:50FromDiscord<congusbongus> seems random to me↵imo they should all have been singular, then there's no chance of confusion
07:26:34FromDiscord<xflywind> https://nim-lang.org/docs/contributing.html#evolving-the-stdlib-conventions
07:26:55FromDiscord<xflywind> > New module names should prefer plural form whenever possible, e.g.: std/sums.nim instead of std/sum.nim. In particular, this reduces chances of conflicts between module name and the symbols it defines.
07:36:58*PMunch joined #nim
07:45:06*jjido joined #nim
08:51:25*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:31:17*joast quit (Ping timeout: 240 seconds)
09:48:47*neurocyte091 quit (Quit: The Lounge - https://thelounge.chat)
09:50:00*neurocyte0917 joined #nim
10:24:52FromDiscord<evoalg> @ElegantBeef I wanna ask you further about `mixin` but if you're about to hit the sack I'll wait until tomorrow?
10:25:12FromDiscord<Elegantbeef> Feel free to ask right now
10:25:56FromDiscord<evoalg> https://play.nim-lang.org/#ix=3Lls ... it doesn't seem to make any difference?
10:26:36FromDiscord<Elegantbeef> That's a template so the mixin isnt even really needed
10:26:59FromDiscord<evoalg> ahhh ... I was trying to follow what you were saying about it the other day and I got confused 😉
10:27:40FromDiscord<evoalg> if I don't need it I don't have to worry about it I guess 🙂
10:28:30FromDiscord<Elegantbeef> It's needed in generics more than templates
10:28:41FromDiscord<Elegantbeef> Though i think it can be used in some cases of templates to solve issues
10:29:09FromDiscord<evoalg> gotcha ... I'll test in generics - thank you!
10:29:36FromDiscord<Elegantbeef> I'll save you the effort https://play.nim-lang.org/#ix=3Llv
10:29:45FromDiscord<Elegantbeef> You can see in this case first `doThing` isnt declared before the proc
10:29:58FromDiscord<Elegantbeef> Secondly the first `doThing` in scope is used
10:30:04FromDiscord<Elegantbeef> in both cases
10:30:19FromDiscord<Elegantbeef> Which is cause a single procedure is generated
10:30:32FromDiscord<Elegantbeef> one for `showcaseMagic2[int]` is used regardless where you call it from after first instantiation
10:31:00FromDiscord<evoalg> gosh you always come through! ... I will absorb....
10:31:37FromDiscord<Elegantbeef> Say you want to have a routine that you can change the behaviour on a per module or even per scope basis, you'd want the template
10:31:56FromDiscord<Elegantbeef> But if you just want a routine that you implement in a given module and it always calls the right stuff you'd mixin with the generic
10:32:53FromDiscord<evoalg> nice ... and so you personally use mixin?
10:33:05FromDiscord<Elegantbeef> If it's needed
10:33:07FromDiscord<Elegantbeef> Same with bind
10:33:47FromDiscord<Elegantbeef> bind is the opposite of mixin, instead of taking the scope of the instantiation into account it takes only the scope of declaration
10:34:10FromDiscord<Elegantbeef> So if you never want a procedure to be overridden in a generic you'd do `bind doThing`
10:34:54FromDiscord<evoalg> oh wow thank you ... this will take me a little while ... I may be some time 😉
10:35:25FromDiscord<Elegantbeef> It's all about generics, best might be to play with multiple files adding/removing procs before the generic one, exporting/unexporting them
10:35:50FromDiscord<Elegantbeef> one could probably do a whole talk on generics and open/closed symbols
10:36:48FromDiscord<evoalg> gosh, and this isn't even getting onto advanced stuff like macros
10:37:03FromDiscord<Elegantbeef> Well macros play off this stuff
10:37:20FromDiscord<Elegantbeef> If you understand what a symbol is and what it means to be closed/open it helps
10:38:09FromDiscord<evoalg> I don't know what they mean ... I ask you a question and I always end up with two new questions 😄
10:38:21FromDiscord<Elegantbeef> A symbol is just a name that points to something
10:38:29FromDiscord<Elegantbeef> `int` is a name that points to a type
10:38:41FromDiscord<Elegantbeef> `var a = 100` `a` is a name that points to that variable
10:39:05FromDiscord<Elegantbeef> Being opened means the choice isnt defined yet
10:39:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Llz
10:39:59FromDiscord<Elegantbeef> inside `doOtherThing` `doThing` is open since it's uncertain what it could be, but it knows that it is either the float/int overload
10:40:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LlB
10:40:42FromDiscord<Elegantbeef> Though possibly not actually closed in the AST, but it's the idea that counts
10:41:55FromDiscord<evoalg> gotcha ok, and so proc calls can be open like `doThing(a)` in the first eg is open
10:42:56FromDiscord<evoalg> proc calls themselves must be just another symbol
10:43:14FromDiscord<Elegantbeef> They're not but that's what you'll learn with macros
10:43:25FromDiscord<Elegantbeef> They're a `call` and the first child of that is a symbol
10:43:36FromDiscord<Elegantbeef> So close
10:44:21FromDiscord<Elegantbeef> But given you arent touching macros yet it doesnt matter 😛
10:45:17FromDiscord<Elegantbeef> Point being all named things are symbols and an open symbol is when there is ambiguity that will be resolved, a close symbol is a symbol that's lock at declaration to not consider instantiation scope
10:47:38FromDiscord<evoalg> nice thank you ... as always you're awesome! It feels good to understand some of this
10:49:22FromDiscord<Elegantbeef> No problem and good day(night)
11:16:42*jjido joined #nim
11:19:54FromDiscord<Shiba> Can you run nim code on nim?
11:20:29FromDiscord<Shiba> Cna you run nim code in nim
11:20:42FromDiscord<Shiba> (edit) "nim" => "nim?"
11:21:47FromDiscord<Rika> ?
11:21:48FromDiscord<valerga> like macros?
11:21:56FromDiscord<Rika> The VM? NimScript?
11:22:11FromDiscord<Shiba> Yes
11:22:27FromDiscord<Rika> `nim e script.nims`
11:22:55FromDiscord<Rika> Limitations apply
11:23:01FromDiscord<valerga> i still need to make my first macro, i don't really understand them
11:23:49FromDiscord<valerga> what's a good exercise to get the subject?
11:24:24FromDiscord<valerga> the docs pass me by
11:26:26FromDiscord<Rika> In reply to @valerga "what's a good exercise": When you want to do something very repetitive and a proc can’t do it because you need to pass in code as data
11:30:43FromDiscord<valerga> tbh i've never had such problem
11:31:01FromDiscord<valerga> maybe because I never considered it
11:32:25FromDiscord<evoalg> In reply to @valerga "maybe because I never": there is https://dev.to/beef331/demystification-of-macros-in-nim-13n8 but I think Elegantbeef said some of that is outdated with new stuff?
11:33:09FromDiscord<evoalg> also https://forum.nim-lang.org/t/8658 ?
11:40:22NimEventerNew thread by Pietroppeter: One Language to Rule the Mole, see https://forum.nim-lang.org/t/8780
11:45:49*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:04:28FromDiscord<Rika> OMG thats cute
12:10:06madpropshaha nice, i dig the mole
12:10:35FromDiscord<Rika> its good
12:41:18FromDiscord<SirOlaf> Feel like the bug from yesterday is on its last legs. It manages to resolve the overload correctly and just fails during type comparison
12:52:34FromDiscord<valerga> https://media.discordapp.net/attachments/371759389889003532/928994522086654022/backdrop-1920.jpg
12:52:45FromDiscord<valerga> a mole and his friends
12:52:54FromDiscord<SirOlaf> In reply to @SirOlaf "Feel like the bug": In fact, disabling the type check makes it work completely
12:53:20FromDiscord<SirOlaf> So just gotta make it accept the check
12:55:51FromDiscord<SirOlaf> Although [] isn't quite accepted for some reason
12:57:53FromDiscord<SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3LmM
13:03:01*jjido joined #nim
13:06:41*fvs quit (Quit: WeeChat 3.4)
13:35:51FromDiscord<eyecon> In reply to @valerga "what's a good exercise": There's https://dev.to/beef331/demystification-of-macros-in-nim-13n8
13:36:20*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:41:21*qwr wouldn't say that something needs to be very repetative with macros, just use them when no other language feature can remove repeatation/boilerplate that annoys you
13:41:53FromDiscord<Rika> qwr: its a "general use case", not the only
13:41:54FromDiscord<Rika> just an idea
13:42:07FromDiscord<Rika> you can also use it to convert "ugly code" into nicer-looking code
13:58:54FromDiscord<pietroppeter> someone stop me... I may even have submitted the mole thread to an orange site...
14:00:28*rockcavera joined #nim
14:00:28*rockcavera quit (Changing host)
14:00:28*rockcavera joined #nim
14:15:46FromDiscord<SirOlaf> Anyone know how the compiler resolves nested generics
14:22:27*tiorock joined #nim
14:22:27*tiorock quit (Changing host)
14:22:27*tiorock joined #nim
14:22:27*rockcavera is now known as Guest2947
14:22:27*tiorock is now known as rockcavera
14:25:56*Guest2947 quit (Ping timeout: 256 seconds)
14:30:27*arkurious joined #nim
14:53:35PMunch@SirOlaf, yes
14:53:44PMunchWell I certainly hope so
14:54:18PMunch@pietroppeter, I kinda like the idea of using a mole as a mascot
14:54:41FromDiscord<SirOlaf> Do you know? Because this generic borrow breaks apart for nested generics
14:54:59FromDiscord<SirOlaf> Picks the wrong candidate or something, still digging
15:00:17FromDiscord<SirOlaf> Decides that `proc (a: T, i: I: Ordinal, x: sink S)` is better than `proc (t: var DefaultTable[[]=.A, []=.B], key: A, val: sink B)`
15:03:05FromDiscord<Patitotective> Are nimble packages insenstive-case too?
15:03:08FromDiscord<Patitotective> (edit) "insenstive-case" => "insensitive-case"
15:08:21FromDiscord<Rika> package names?
15:10:39FromDiscord<Patitotective> yes
15:10:50PMunch@SirOlaf, I have no idea
15:11:13PMunchI was just joking by saying that someone probably knows, since you asked if anyone knows
15:11:20PMunch@Patitotective, nope
15:11:37FromDiscord<Patitotective> Ok thanks
15:29:31FromDiscord<ajusa> Is it possible to use strformat at run time?
15:31:08FromDiscord<ajusa> that doesn't make sense I guess since strformat can evaluate expressions, which requires it to be done at compile time. is strutils interpolation the best option at runtime then?
15:32:51FromDiscord<Rika> what?
15:33:28FromDiscord<Rika> do you mean `&some_runtime_string`?
15:33:29FromDiscord<Rika> no
15:34:06FromDiscord<ajusa> In reply to @Rika "do you mean `&some_runtime_string`?": yes, and I realize it isn't possible now. If the string is known at compile time though can I still do it?
15:34:19FromDiscord<Rika> well yes
15:34:35FromDiscord<Rika> !eval import strformat; let a = 2; let b = 3; const c = "{a+b}"; echo &c
15:34:36NimBotCompile failed: /usercode/in.nim(1, 65) Error: type mismatch: got <system.string>
15:34:43FromDiscord<Rika> whoaaaat
15:34:49FromDiscord<Rika> maybe static: ?
15:35:00FromDiscord<Rika> dunno im tired i dont want to deal with this
15:35:28FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Lo8
15:36:11FromDiscord<Patitotective> sent a code paste, see https://paste.rs/JdH
15:36:22FromDiscord<Rika> how do you know my age, thats sus
15:36:27FromDiscord<Rika> also no
15:36:31FromDiscord<Rika> technically no
15:36:41FromDiscord<Solitude> In reply to @Patitotective "Can I create a": stop pythoning
15:36:42FromDiscord<Rika> you will have to wrap your types in a variant type
15:37:04FromDiscord<Rika> yeah idk at that point use an object
15:37:04FromDiscord<Patitotective> In reply to @Solitude "stop pythoning": ;-;
15:37:18FromDiscord<Solitude> every single python refugee asks that question
15:37:47FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lo9
15:38:13FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3Loa
15:38:53FromDiscord<Patitotective> In reply to @Solitude "read a tutorial https://nim-lang.org/docs/tut1.html": no, i mean, i dont want an object
15:39:06FromDiscord<Patitotective> but maybe a tuple hmmmm
15:39:12FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Lob
15:39:33FromDiscord<Patitotective> how would i use it?
15:41:14NimEventerNew thread by Xigoi: Nimdenter, see https://forum.nim-lang.org/t/8781
15:41:28FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Lod
15:41:49FromDiscord<Rika> In reply to @NimEventer "New thread by Xigoi:": holy fuck
15:42:08FromDiscord<Patitotective> hmmmmmmmmmmmm↵i will use an object, no one want tables
15:42:09FromDiscord<Patitotective> hehe
15:42:15FromDiscord<Patitotective> thanks anyways
15:42:16FromDiscord<Patitotective> 🙃
15:45:03FromDiscord<Patitotective> well, hehe, im really trying to simulate (or emulate if you think) this library in nim https://patitotective.github.io/PREFS/
15:45:08FromDiscord<Patitotective> any suggestions?
15:45:09FromDiscord<Patitotective> lol
15:45:13FromDiscord<Patitotective> (edit) "https://patitotective.github.io/PREFS/" => "https://patitotective.github.io/PREFS"
15:49:10FromDiscord<Rika> the object variant
15:49:47FromDiscord<Rika> it seems well defined and the types arent variable, so yeah its an appropriate use case
15:50:16FromDiscord<Rika> you can see that its used in the json module
15:50:26FromDiscord<Patitotective> let me see
15:51:14FromDiscord<ajusa> In reply to @NimEventer "New thread by Xigoi:": This is hilarious
15:55:21FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Loq
15:56:17*pro joined #nim
16:00:04FromDiscord<Rika> pretty much
16:26:19FromDiscord<SirOlaf> Why does magic bypass matchesAux in matches
17:08:06FromDiscord<Patitotective> should i follow this style guide? https://nim-lang.org/docs/nep1.html
17:11:27FromDiscord<auxym> probably. I think it's the style most of the community uses.
17:41:17FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LoX
17:43:19FromDiscord<eyecon> How does the compiler distinguish `a.b` referring to the value of a (potentially callable) field `b` of `a` or the result of `b(a)`? Simply based on the non-existence of the other?
17:44:40FromDiscord<eyecon> E.g. I say `if s.len == 3` and this is understood as `if len(s) == 3` but it could also have been a field `len` of the variable `s`
17:45:47FromDiscord<el__maco> I would assume one of these forms takes precedence and that's it?
17:50:01FromDiscord<eyecon> I'm on a roll with compiler crashes I guess: https://play.nim-lang.org/#ix=3Lp3
17:51:11FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3Lp5
17:51:31FromDiscord<ajusa> In reply to @eyecon "This is an honor:": I don't think that's a compiler crash? You're calling a function that hasn't been initialized
17:52:01FromDiscord<eyecon> I get that, but shouldn't the compiler catch this case?
17:52:48FromDiscord<eyecon> Ah, you mean it's a runtime crash
17:52:53FromDiscord<ajusa> Ye
17:52:54FromDiscord<eyecon> Sorry, you're right of course
17:53:16FromDiscord<eyecon> My point was that it could have been caught at the compilation phase
17:53:22FromDiscord<ajusa> Adding `myspecial.len = proc(): int = 5` and reordering code to make sense results in it working.
17:54:00FromDiscord<SirOlaf> Might be a bug with default object constructors
17:55:03FromDiscord<SirOlaf> If not, only way to prevent would be tracking if it's initialized and that's hard
17:55:11FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Lp8
17:55:15FromDiscord<ajusa> See https://nim-lang.org/docs/manual_experimental.html#strict-not-nil-checking
17:56:33FromDiscord<ajusa> I believe Araq has mentioned or alluded to making not nil the default for Nim 2, as that'd be a pretty large breaking change (many people use nil, especially with C libraries). That's one of the reasons it isn't enabled by default right now.
17:57:25FromDiscord<eyecon> Yes, explicit nillability (nilability?) would change so much
17:57:50FromDiscord<eyecon> In reply to @el__maco "I would assume one": I guess it's the field access that has higher precedence: https://play.nim-lang.org/#ix=3Lp9
17:58:13FromDiscord<SirOlaf> In reply to @eyecon "Yes, explicit nillability (nilability?)": Sounds like it would also change the compile times in a bad way
17:58:56FromDiscord<eyecon> It's good to know that `b(a)` remains unambiguous though
18:00:06*pro quit (Quit: WeeChat 3.4)
18:06:46FromDiscord<ajusa> Is there a parseSomeNumber or something similar that parses to an Int, then tries parsing to a float?
18:07:13FromDiscord<eyecon> But which type would it return?
18:07:23FromDiscord<ajusa> Some number is a type
18:07:33FromDiscord<ajusa> Oh wait it mostly for procs, never mind
18:08:00FromDiscord<ajusa> Guess I'll do it explicitly and use a template for reusability
18:16:19*mikko quit (Quit: WeeChat 2.7.1)
18:40:30*krux02_ joined #nim
18:42:22FromDiscord<auxym> SomeNumber is a typeclass, not a type
18:44:04FromDiscord<auxym> The return type of a proc needs to be known at compile time. Nim is a static language, your proc (or template) cannot decide to return either a float or an int based on its input at runtime.
18:45:55*user_ joined #nim
18:46:38*user_ quit (Client Quit)
18:46:44FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Lpp
18:49:26FromDiscord<auxym> That could work, but I think you'd need `{.dirty.}` or `{.inject.}` otherwise `n` will get gensym'd to some garbled name.
18:49:56FromDiscord<auxym> Oh I see you're passing it as a param
18:50:10FromDiscord<auxym> should be good
18:51:38FromDiscord<auxym> As long as everything in `body` assumes `n` is SomeNumber and not specifically a float or int.
18:51:55FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Lps
18:52:11FromDiscord<ajusa> I'm pretty proud of this for validation, reduces a ton of the code I'd need to write otherwise.
18:53:13FromDiscord<auxym> Yeah, that's what great about nim templates and macros
18:53:30FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Lpt
19:00:18NimEventerNew thread by JohnAD: Fully understanding closure iterators, see https://forum.nim-lang.org/t/8782
19:05:59*pippin left #nim (#nim)
19:07:12FromDiscord<SirOlaf> Have another question that will probably go unanswered, is there a function to recursively the basetypes of distinct generics
19:07:20FromDiscord<SirOlaf> (edit) "Have another question that will probably go unanswered, is there a function to recursively ... the" added "determine"
19:07:44FromDiscord<SirOlaf> Specifically of their type parameters
19:08:16FromDiscord<SirOlaf> Think that's the thing that's missing to make borrowed generic functions work
19:12:50*Gustavo6046 joined #nim
19:15:14FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LpE
19:15:16FromDiscord<Patitotective> sent a code paste, see https://paste.rs/pC5
19:15:54FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3LpE" => "https://play.nim-lang.org/#ix=3LpF"
19:16:09FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3LpF" => "https://play.nim-lang.org/#ix=3LpG"
19:18:35FromDiscord<SirOlaf> Should work if you make the prefs argument var
19:18:43FromDiscord<Patitotective> let me try
19:22:29FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LpI
19:23:42FromDiscord<Patitotective> Shouldn't `PContent` be `OrderedTable[string, PrefsNode]`?
19:42:07*fvs joined #nim
19:42:27FromDiscord<Casey.McMahon> sent a code paste, see https://play.nim-lang.org/#ix=3LpO
19:42:36FromDiscord<Casey.McMahon> (edit) "https://play.nim-lang.org/#ix=3LpO" => "https://play.nim-lang.org/#ix=3LpP"
19:44:15FromDiscord<leorize> depends on the degree of complexity you want your system to be capable of
19:44:43*PMunch quit (Quit: leaving)
19:45:46FromDiscord<Casey.McMahon> haha, what do you mean?
19:46:29FromDiscord<leorize> do you want to be aware of cmake's syntax to replace things, or do you just want quick 'n dirty text replacement?
19:48:10FromDiscord<Casey.McMahon> quick n dirty for now
19:50:53FromDiscord<Isofruit> So you have a file and want to find and replace "foo bar baz" with "foo bat cave" in that file, as a one-of?
19:50:59FromDiscord<leorize> the `lines` iterator is useful for extracting lines, then pair it with `regex` or `npeg` to extract what you need
20:13:11FromDiscord<Patitotective> btw This is how package's structure looks like https://media.discordapp.net/attachments/371759389889003532/929105404829503508/Screenshot_from_2022-01-07_15-07-33.png
20:13:12FromDiscord<Patitotective> I've got some types defined in `niprefs/prefs.nim` and in `niprefs.nim` I have `import niprefs/prefs` but I'm not able to use those types when importing _niprefs_ with `import niprefs` but it works with `import niprefs/prefs`
20:13:33FromDiscord<Patitotective> (edit) "I've got some types defined in `niprefs/prefs.nim` and in `niprefs.nim` I have `import niprefs/prefs` but I'm not able to use those types when importing _niprefs_ with `import niprefs` ... but" added "in an external module"
20:16:37FromDiscord<Patitotective> do i need to redefine them in `niprefs.nim`?
20:17:05FromDiscord<Patitotective> (all types in `niprefs/prefs.nim` are marked with `¨`)
20:17:08FromDiscord<Patitotective> (edit) "`¨`)" => "``)"
20:17:13FromDiscord<leorize> you have to re-export it in `niprefs`
20:17:18FromDiscord<leorize> Nim does not have package imports
20:17:31FromDiscord<Patitotective> In reply to @leorize "you have to re-export": re-export?
20:17:52FromDiscord<leorize> add `export prefs` in `niprefs.nim`
20:18:17FromDiscord<Casey.McMahon> sent a code paste, see https://play.nim-lang.org/#ix=3Lq1
20:18:48FromDiscord<Patitotective> In reply to @leorize "add `export prefs` in": Thanks 🙃
20:20:14FromDiscord<leorize> that works, regex would be a touch more efficient but this one is simple enough↵(@Casey.McMahon)
20:28:12FromDiscord<leorize> though instead of using a boolean, `break` is much better
20:28:20FromDiscord<leorize> or `parseutils.skipUntil`
20:34:08FromDiscord<Isofruit> Man, I'm doing easy meta programming and my head still hurts
20:34:27FromDiscord<Isofruit> I can only imagine the brain-cramps you can give yourself if you actually dive deep into the topic
20:35:39FromDiscord<leorize> my advise for you would be less spontaneous mutations and more general rewrites
20:37:11FromDiscord<leorize> the AST structure punishes spontaneous mutation by trapping you in a maze of complexity
20:37:47FromDiscord<Isofruit> I'm not even dealing with macros, just pragmas whose values I want to access at compile time
20:37:57FromDiscord<Isofruit> But some of these pragmas are associated with types in Options
20:37:59FromDiscord<Isofruit> and gnaaaaaa
20:38:18FromDiscord<leorize> using macros might be better lol
20:38:48FromDiscord<leorize> the API for non-macro stuff is just sad in my experience
20:39:14FromDiscord<Isofruit> Before I give myself that type of migraine, mind taking a look at a code-sample and tell me if that's really better done with macros?
20:39:27FromDiscord<leorize> sure
20:39:33FromDiscord<Isofruit> You familiar with norm?
20:40:04FromDiscord<leorize> I'm somewhat familiar
20:41:21FromDiscord<Isofruit> That already works, because that mean's you're likely familiar that it has the concept of `Model` a `{.tableName.}` pragma and that you can grab a Model's SQL table via the `table()` function
20:45:58FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Lqb
20:47:24FromDiscord<Isofruit> Lets call that proc `getRelatedFieldName`↵If I go `getRelatedFieldName(B, A)` I want that to output `myA`.↵Mort importantly, I want `getRelatedFieldName(B, Surprise)` to ALSO output `myA`.
20:48:14FromDiscord<leorize> definitely macros for this
20:48:28FromDiscord<SirOlaf> Look what you made me do https://media.discordapp.net/attachments/371759389889003532/929114288445083658/Capture.PNG
20:48:42FromDiscord<Isofruit> I claim innocence
20:48:50FromDiscord<leorize> but fair warning\: typed macros are the stairways to madness
20:48:55*jjido joined #nim
20:49:02FromDiscord<Isofruit> It's just
20:49:02FromDiscord<Isofruit> Gnaaa
20:49:19FromDiscord<SirOlaf> All I needed was someone that knows how generics work
20:49:51FromDiscord<Isofruit> I have multiple models to the same SQL Tables for simplicity reasons.↵And I just want to get the foreign key field name somewhat dynamically >_>
20:50:23FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lqd
20:50:29FromDiscord<Isofruit> Oh well, I guess looking into macros or madness
20:50:48FromDiscord<SirOlaf> I am now in need of an algorithm that pulls out child nodes into branches that are distinct generic types
20:51:38FromDiscord<Isofruit> What should the code you just posted express Patitotective?
20:52:54FromDiscord<Patitotective> `PrefsNodeObj` is an object that can have multiple types because I want to create a custom table that supports different value types
20:53:03FromDiscord<Patitotective> and I want it to be able to store enums
20:53:37FromDiscord<Patitotective> `PrefsNodeKind` represents the type `PrefsNodeObj` can have
20:53:56FromDiscord<Patitotective> (edit) "type" => "types"
20:54:17FromDiscord<Isofruit> You want to define enums at runtime then? Or at compile time?
20:54:51FromDiscord<leorize> you should try my union\: https://github.com/alaviss/union↵(@Patitotective)
20:56:20FromDiscord<Patitotective> In reply to @leorize "you should try my": oh, so i can delete all my code and just make `OrderedTable[string, union(int, string, etc)]`?
20:57:03FromDiscord<Isofruit> It keeps being true: The best code is the code you don't write yourself. Until it isn't
20:57:27FromDiscord<Patitotective> In reply to @Isofruit "It keeps being true:": dont say that ;-;
20:58:11FromDiscord<Isofruit> If I could already have a library that did this generic stuff for me and not have to write it myself?
20:58:22FromDiscord<Isofruit> I would delete the hundreds of lines of code I already have in a heartbeat!
20:58:44FromDiscord<leorize> pretty much↵(@Patitotective)
20:59:01FromDiscord<leorize> I have like one user atm so I always welcome more \:p
20:59:49FromDiscord<Patitotective> In reply to @leorize "I have like one": i'll be glad to use someone else's code lmao↵nice package 🙃
20:59:51FromDiscord<Patitotective> (edit) "🙃" => "👍"
21:04:51FromDiscord<Isofruit> Okay, macros seem intimidating
21:04:59FromDiscord<Isofruit> I'll give generic typing one more try
21:05:11FromDiscord<leorize> while you try that I'll write you a quick macro
21:05:31FromDiscord<Isofruit> `when`, come to my aid!
21:07:17*dithpri joined #nim
21:07:26FromDiscord<Patitotective> In reply to @leorize "while you try that": seems like _union_ is not published in nimbe (?) should i install from the github repo?
21:07:31FromDiscord<Patitotective> (edit) "nimbe" => "nimble"
21:08:16FromDiscord<leorize> yea you should
21:11:39FromDiscord<Isofruit> I think I can solve this... If I manage to access the type `A`in a `none(A)` case so I can call `A.table()`
21:12:02*fvs left #nim (WeeChat 3.4)
21:12:03FromDiscord<Isofruit> (edit) "so" => "of `Option[A]`so"
21:13:13*Lord_Nightmare quit (Ping timeout: 256 seconds)
21:13:14FromDiscord<Isofruit> I can already check whether `Option[Whatever]` contains a Model or not, I'm just struggling with accessing the typedesc
21:13:51FromDiscord<Isofruit> (edit) "I can already check whether ... `Option[Whatever]`the" added "in" | "contains a Model" => "the `Whatever` inherits from `Model`"
21:14:28FromDiscord<SirOlaf> The compiler can now translate `var Table[system.string, DefaultTable[system.string, system.string]]` into `var Table[system.string, Table[system.string, system.string]]` and yet my fix does not work
21:14:54FromDiscord<SirOlaf> Has Beef resurrected yet
21:15:34FromDiscord<Isofruit> Is beef the messiah?
21:16:15*Lord_Nightmare joined #nim
21:16:30FromDiscord<SirOlaf> Am hoping this gives him some new ideas, because I'm about to run out of them
21:17:50FromDiscord<leorize> wdym trouble with accessing the typedesc?↵(@Isofruit)
21:20:09FromDiscord<Isofruit> Remember the earlier types.↵`B.table()` works. If I can access the type B itself (which I assume is called `typedesc` since you do `proc(a: typedesc[T])` when you want to tell a proc the parameter will be the type and not an instance of it), I'm done
21:20:50FromDiscord<leorize> you mean you wanna access `Whatever` in `Option[Whatever]`?
21:21:03FromDiscord<Isofruit> Yeah, specifically `Whatever` and not an instance of it
21:21:15FromDiscord<Isofruit> because the instance can be none
21:21:17FromDiscord<Isofruit> and none murders me
21:21:23FromDiscord<leorize> typetraits has the answers what you need
21:22:59FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Lqp
21:23:04*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
21:23:04FromDiscord<Isofruit> Oh, typetraits
21:23:11FromDiscord<Isofruit> Hmmmm
21:23:55FromDiscord<reilly> Looking at the example given for methods in the manual (https://nim-lang.org/docs/manual.html#methods), I don't really see what makes this functionally any different from regular old procs.
21:25:07*Lord_Nightmare joined #nim
21:26:22FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lqr
21:27:13FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3Lqr" => "https://play.nim-lang.org/#ix=3Lqs"
21:28:59FromDiscord<Patitotective (Patitotective)> sent a long message, see http://ix.io/3Lqu
21:31:00*rockcavera quit (Remote host closed the connection)
21:31:00FromDiscord<leorize> sent a code paste, see https://paste.rs/NNv
21:31:03FromDiscord<Patitotective (Patitotective)> sent a code paste, see https://play.nim-lang.org/#ix=3Lqw
21:32:46FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=3Lqx
21:33:05FromDiscord<leorize> note that `Content` is merely an alias, any other `union(string | int | bool)` is the same as `Content`
21:34:22FromDiscord<leorize> the best way to see it is to change all `method` -\@reilly)
21:34:37FromDiscord<ajusa> oh hey union I love that library, used it a few projects of mine
21:34:47FromDiscord<Isofruit> Found the one user
21:35:10FromDiscord<leorize> I guess I have more than one users lol
21:35:21FromDiscord<Isofruit> Now you have
21:35:23FromDiscord<Isofruit> TWO users
21:36:21FromDiscord<ajusa> before union: `TypeKind = enum tkString, tkInt, tkFloat`↵after union: `VNType = union(int | float | string)`↵I just wish it had more docs, and some integration with the pattern matching that hax built
21:37:25FromDiscord<Isofruit> I've read through typetraits now, I can't seem to find anything related to accessing nested types within objects↵Were you trying to point me towards "stripGenericParams" leorize?
21:37:47FromDiscord<haxscramper> There is a bug with generics that prevented from using union with pattern matching to the full extent, but in the end it does not require any special interactions
21:38:24FromDiscord<haxscramper> In reply to @haxscramper "anyway, if remove generics": This one
21:38:54FromDiscord<leorize> https://nim-lang.github.io/Nim/typetraits#genericParams.t%2Ctypedesc↵(@Isofruit)
21:39:27FromDiscord<Isofruit> squints↵Hmmmm I assume that's banking on that Option is an enum
21:40:29FromDiscord<Isofruit> Ohhhhhh
21:40:47FromDiscord<Isofruit> When I played around with it I was an idiot and gave it an instance, not a type
21:47:36FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3LqF
21:47:58FromDiscord<Solitude> .get
21:48:04FromDiscord<Solitude> .get(0)
21:58:14FromDiscord<Isofruit> SON OF A HORSESHOE IT WORKS
21:59:14FromDiscord<leorize> do let me know what docs would you like to see, I'll write some more when I have time↵(@ajusa)
21:59:23FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3LqI
21:59:32FromDiscord<Isofruit> If anyone wanted to see the monstrosity I built
22:00:28FromDiscord<leorize> it's shorter than my macro, so there is that
22:00:28FromDiscord<haxscramper> I haven't checked it since then
22:01:05FromDiscord<Isofruit> Macros are one of those things I'm currently still too afraid to touch
22:01:08FromDiscord<Isofruit> Which is likely silly
22:01:22FromDiscord<leorize> you should not touch them now
22:01:29FromDiscord<Isofruit> But I'm already having my hands full comprehending my problems through the lenses of generics and templates
22:01:33FromDiscord<leorize> like you need a couple library to sanely program them
22:02:15FromDiscord<Isofruit> I assumed as much. I like templates though
22:02:37FromDiscord<Isofruit> They are fairly comprehensible, expand code into position X
22:03:15FromDiscord<Isofruit> Used one to save myself the hassle of doing the same try-except-sendHTTP400Response block over and over again where only the try block chances
22:03:16FromDiscord<leorize> templates are nice
22:03:22FromDiscord<Isofruit> (edit) "chances" => "changes"
22:03:36FromDiscord<leorize> use it in moderation to avoid code bloat, though
22:04:09FromDiscord<Isofruit> Yeh, I only intend to use the one, I see no usecase for others since I can typically do generics
22:04:51FromDiscord<Isofruit> My order of attempts pretty much goes:↵normal procs > generics > templates > macros (neeeeveeeeeer)
22:05:00FromDiscord<SirOlaf> Something you can't do is borrow generic function from generic types
22:05:04FromDiscord<SirOlaf> (edit) "function" => "functions"
22:05:24FromDiscord<leorize> I usually have to use a template in that case↵(@SirOlaf)
22:05:37FromDiscord<Isofruit> This sounds like the kind of idea I would only want to have after either copious amounts of coding to the point my brain is in delirium or alcohol
22:06:02FromDiscord<leorize> you should put macro in a separate branch of the tree lol
22:06:37FromDiscord<leorize> that stuff is not only more powerful, it doesn't have interop with non-macros
22:07:03FromDiscord<SirOlaf> In reply to @leorize "I usually have to": I have it fixed as long as the generics aren't nested, which is why I have been looking for assistance
22:07:14FromDiscord<Isofruit> I read templates are like the nice version of macros, limited but comprehensible.↵Are macros just massive code generators?
22:07:50FromDiscord<leorize> macros are code transformers
22:08:03FromDiscord<Isofruit> So a language over the language
22:08:15FromDiscord<leorize> sorta
22:08:37FromDiscord<leorize> I believe [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org) got a fix or smt↵(@SirOlaf)
22:08:54FromDiscord<SirOlaf> He was helping me yesterday
22:09:20FromDiscord<SirOlaf> And we actually kinda did get it to work with flat generics, just didn't realize
22:09:54FromDiscord<leorize> \\o/ that's cool
22:10:08FromDiscord<SirOlaf> Issue is that nesting completely kills it
22:10:29FromDiscord<SirOlaf> And I have run out of ideas after converting the distinct type into base didn't work
22:17:26FromDiscord<Isofruit> If there is one thing I'm wonky on about generics with when statements is: You don't know if you built them wrong until you ensured every path of the when-controlflow has been traversed and not caused the compiler to die
22:18:20FromDiscord<Isofruit> Just found two bugs in the earlier generic thingy that I did not notice because my code example didn't use my generic function in a way that caused these "when" bits that were badly coded to ever be used
22:18:43FromDiscord<Isofruit> (edit) "Just found two bugs in the earlier generic thingy that I did not notice because my code example didn't use my generic function in a way that caused these "when" bits that were badly coded to ever be used ... " added "(I fixed it in the code sample I posted earlier, but dang)"
22:21:49FromDiscord<Elegantbeef> Concepts 😛↵(@Isofruit)
22:22:04FromDiscord<SirOlaf> The man is back
22:22:08FromDiscord<Elegantbeef> Isnt the nesting issue just cause of `val: B`↵(@SirOlaf)
22:22:16FromDiscord<SirOlaf> I have created a new error
22:23:12FromDiscord<SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3LqQ
22:23:28FromDiscord<SirOlaf> Which is strange, because the type is obviously completely different
22:24:15FromDiscord<SirOlaf> Basically semOverloadedCall (or rather semOverloadedCall) produces nonsense
22:24:24FromDiscord<SirOlaf> (edit) "semOverloadedCall)" => "semResolvedCall)"
22:24:39FromDiscord<Isofruit> In reply to @Elegantbeef "Concepts 😛 (<@180601887916163073>)": Sorry, generics + work noodled my brain through, I know you want to express sth. related to when we last chatted with that, but my brain is just not parsing it atm.
22:24:46FromDiscord<Elegantbeef> What's your searchforborrowproc look like now?
22:24:48FromDiscord<Elegantbeef> Also how did you reason what to skip and what not to?
22:25:26FromDiscord<SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3LqR
22:25:43FromDiscord<SirOlaf> Actually quite simple and elegant, but should check more node types
22:25:47FromDiscord<Elegantbeef> I'm saying using concepts will ensure the stuff works at compile time instead of at instantiation
22:26:03FromDiscord<Elegantbeef> We dont want to base layered generics afaik
22:26:31FromDiscord<Isofruit> concepts as in "think this through beforehand and have a concept of it in your head already before you start"?
22:26:33FromDiscord<Elegantbeef> with what we had yesterday was the issue not just `val: B` was dropped to `Table[string, seq[string]]`?
22:26:36FromDiscord<SirOlaf> In reply to @Elegantbeef "We dont want to": Well yeah, probably not seeing how my thing doesn't work at all
22:26:39FromDiscord<Elegantbeef> No the Nim concepts system
22:26:47FromDiscord<SirOlaf> (edit) "not" => "not,"
22:26:54FromDiscord<Isofruit> https://tenor.com/view/umm-confused-blinking-okay-white-guy-blinking-gif-7513882
22:27:13FromDiscord<Isofruit> I shall google that one
22:27:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LqS
22:27:37FromDiscord<Isofruit> I have not ever seen that
22:27:49FromDiscord<Elegantbeef> It user defined duck typing basically
22:27:50FromDiscord<Isofruit> Not even seen a single line of code with a "concept" thingy in it
22:28:01FromDiscord<Elegantbeef> Kinda like TS interfaces
22:28:25FromDiscord<SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3LqT
22:28:42FromDiscord<Isofruit> Wait! I do TS! ... could this have made my thingy easier?↵I'll need to have a read on that, recover brainmass and then see
22:28:49FromDiscord<SirOlaf> My thought process when making the basify function was that B is Table but it gets DefaultTable
22:29:13FromDiscord<Elegantbeef> Concepts are compile time interfaces, you define a Concept and use it as a type class to limit what types can be used
22:29:31FromDiscord<Elegantbeef> No the issue is the otherway around
22:29:40FromDiscord<Elegantbeef> B is `DefaultTable` but it gets `Table`
22:30:04FromDiscord<Elegantbeef> I think we should only skip generics if they dont have `tfFromGeneric` in the type flags
22:30:12FromDiscord<Elegantbeef> Though that might be wrong
22:30:19FromDiscord<Elegantbeef> Sorry "only skip types"\
22:31:24FromDiscord<SirOlaf> Can we verify what B is
22:32:11FromDiscord<SirOlaf> In reply to @Elegantbeef "I think we should": And in what step would this be done
22:32:12FromDiscord<Elegantbeef> B in our case is going to be what ever type `val` gets so it should be the B parameter of DefaultTable which in this case is `DefaultTable[string, string]`
22:32:33FromDiscord<Elegantbeef> When making the call in search for borrow i think
22:32:34FromDiscord<Elegantbeef> I could be wrong
22:33:14FromDiscord<Isofruit> > Now I know why I don't know of Concepts!
22:33:25FromDiscord<Isofruit> I have never even looked at experimental features
22:33:41FromDiscord<Isofruit> https://nim-lang.org/docs/manual_experimental.html#concepts↵Good to know there's docs on it though
22:35:29FromDiscord<Isofruit> Ohhh and that way I could've narrowed down the generic type I use in `getRelatedFieldName` to types that have these characteristics that I need
22:36:21FromDiscord<Elegantbeef> Well concepts dont need a flag and i've used them a fair bit
22:36:22FromDiscord<Elegantbeef> The syntax might be a bit confusing, but otherwise they're nice
22:37:12FromDiscord<Elegantbeef> Yep if you're doing something where you want duck typing but it to be more concrete this is how you get it.
22:37:16FromDiscord<Isofruit> Which... I don't think would've spared me from writing that logic out in the first place on how to extract a given tablename from either a norm-model-type directly, an fk-pragma or an Option[norm-model-type]... I think I'd have still needed to write that out
22:37:52FromDiscord<Isofruit> (edit) "Which... I don't think would've spared me from writing that logic out in the first place on how to extract a given tablename from either a norm-model-type directly, an fk-pragma ... or" added "on a field of a norm-model-type"
22:38:21FromDiscord<Isofruit> Would (and still can) narrow down the interface nicely though
22:38:56FromDiscord<Isofruit> (edit) "interface nicely" => "types you can throw into that function"
22:39:07FromDiscord<Isofruit> (edit) "Would (and still can) narrow down the types you can throw into that function ... though" added "nicely"
22:39:34FromDiscord<SirOlaf> sent a code paste, see https://paste.rs/4SW
22:39:44FromDiscord<Elegantbeef> No
22:39:49FromDiscord<Elegantbeef> I mean inside searchForBorrowProc
22:39:59FromDiscord<Elegantbeef> Skip over the parameters that come from generic
22:40:17FromDiscord<Elegantbeef> Since when borrowing anything that's from generic is not going to be the distinct we want
22:41:02FromDiscord<SirOlaf> Why would basically removing parameters help
22:41:09FromDiscord<Elegantbeef> We arent removing
22:41:15FromDiscord<Elegantbeef> We're not skipping over generics
22:41:51FromDiscord<Elegantbeef> in the example we have `var DefaultTable[string, DefaultTable[...]], key: string, val: DefaultTable[...]`
22:42:16FromDiscord<Elegantbeef> we're presently making it `Table[string , DefaultTable[...]], key: string, val: Table[...]`
22:42:27FromDiscord<Elegantbeef> The B of the first does not match the B of the proc, so there is a mismatch
22:42:38FromDiscord<Elegantbeef> It expects B to be a `DefaultTable`, but got `Table`
22:42:47FromDiscord<Elegantbeef> `<Table[system.string, DefaultTable[system.string, system.string]], string, Table[system.string, system.string]>`
22:42:54FromDiscord<Elegantbeef> Look at that error message
22:43:17FromDiscord<Elegantbeef> The proc def is `proc mgetOrPut[A, B](t: var Table[A, B]; key: A; val: B): var B`
22:43:35FromDiscord<Elegantbeef> The B in `Table[A, B]` does not match the B of `val: B`
22:43:40FromDiscord<SirOlaf> I see that, but whatever you mean by skip does not make sense to me
22:44:00FromDiscord<Elegantbeef> do not get the distinct base of any thing that comes from generic, just put the type you have there
22:44:13FromDiscord<Elegantbeef> So instead of writing `Table` in `val` we write `DefaultTable`
22:45:04FromDiscord<SirOlaf> Do you want the desiredTypes to be changed or something? There is nothing else being used for skipping, is there
22:45:05FromDiscord<Elegantbeef> The idea being i dont think it makes any sense to implement a generic proc where you want to get the base over any parameter that comes from generic
22:45:20FromDiscord<Elegantbeef> Inside search for borrow
22:45:26FromDiscord<Elegantbeef> Presently we do `t.getDistinctBase` or whatever it's called
22:45:29FromDiscord<Elegantbeef> On all parameters
22:45:45FromDiscord<Elegantbeef> We should only do it on parameters that arent from generic afaict
22:46:08FromDiscord<Elegantbeef> I cant give you a line number but it's in the for loop of search for borrow
22:47:11FromDiscord<SirOlaf> Can't hurt to try I guess
22:48:19FromDiscord<Isofruit> Leorize, you still reading?
22:48:46FromDiscord<Elegantbeef> We're on matrix saying our name pings us
22:49:42FromDiscord<Elegantbeef> Leroize they cant see reactions across the bridge
22:49:56FromDiscord<leorize> oh yea
22:50:04FromDiscord<leorize> o/ @Isofruit
22:50:38FromDiscord<Isofruit> I'm about to make an SO question + answer it myself (regarding the entire "access type within an option generically") so I can have an easier time googling that kind of problem in the future.↵Just wanted to ask whether you wanted a shoutout in the answer and to whom I should do that
22:50:44FromDiscord<SirOlaf> In reply to @SirOlaf "Can't hurt to try": What does hurt is that I am still not quite sure what the plan is. x gets set to t.baseOfDistinct, so stopping that makes x a bit questionable
22:51:05FromDiscord<Elegantbeef> This is what i have right now
22:51:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LqY
22:51:08FromDiscord<Isofruit> Since you significantly helped me in that regard
22:51:12FromDiscord<SirOlaf> In reply to @Elegantbeef "This is what i": And does it work
22:51:19FromDiscord<leorize> I don't have an SO account unfortunately↵(@Isofruit)
22:51:19FromDiscord<Isofruit> ~~Aka pushed me face first towards the solution~~
22:51:20FromDiscord<Elegantbeef> It does not
22:51:39FromDiscord<Elegantbeef> It still fails sem overload, but this is the correct thing to do afaict
22:52:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LqZ
22:52:30FromDiscord<Elegantbeef> Which is what we want
22:53:00FromDiscord<Elegantbeef> We now just have the issue that semoverloadedcall doesnt like the types
22:53:43FromDiscord<Isofruit> In reply to @leorize "I don't have an": Discord name mention in the SO answer it is 😛
22:53:46FromDiscord<SirOlaf> It has never liked the types
22:54:09FromDiscord<Elegantbeef> We finally have the right types though
22:54:36FromDiscord<Elegantbeef> So now we only have to question "why does sem overload not like us"
22:56:06FromDiscord<SirOlaf> Culprit is still semResolvedCall
22:56:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Lr1
22:57:08FromDiscord<SirOlaf> resolveOverloads decides on ` proc (t: var Table[mgetOrPut.A, mgetOrPut.B], key: A, val: B): var B` which should be right
22:57:13FromDiscord<SirOlaf> (edit) "` proc" => "`proc"
22:58:36FromDiscord<SirOlaf> Or maybe I'm in the wrong section, but something does decide on that signature
22:59:15FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lr2
23:01:33FromDiscord<SirOlaf> In reply to @SirOlaf "Or maybe I'm in": I was checking pickBestCandidate, but that just returns good candidates so resolveOverloads does decide on it
23:01:50FromDiscord<Elegantbeef> Have you tried to start on the macro patito?
23:02:02FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lr5
23:02:06FromDiscord<Patitotective> In reply to @Elegantbeef "Have you tried to": yes lol
23:02:31FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3Lr5" => "https://play.nim-lang.org/#ix=3Lr6"
23:02:47FromDiscord<Elegantbeef> content is going to be a `nnkCurly` with `colonExprExpr` as each value
23:03:27FromDiscord<Patitotective> where is that documented?
23:03:28FromDiscord<Elegantbeef> So what you'll want to do is iterate over everything in content getting the second element `[1]` and making it `infix(yourExpr[1], "as", ident"PContentTypes")`
23:03:41FromDiscord<Elegantbeef> do `echo treeRepr content`
23:03:48FromDiscord<Elegantbeef> It's documented in the AST of Nim
23:04:04FromDiscord<Elegantbeef> Actually this probably will be a `nnkTableConstr`
23:04:09FromDiscord<Elegantbeef> Eitherway same thing internally
23:04:30FromDiscord<Elegantbeef> It'll have a list of `a: b` in AST you want to grab `b` and replace it with `b as PTypeContent`
23:04:56FromDiscord<Elegantbeef> Then finally you'll do `newCall(bindSym"toOrderedTable", content)`
23:05:01FromDiscord<Elegantbeef> And that'll do it all for you
23:05:32FromDiscord<Elegantbeef> `bindSym` is needed if you `import std/tables` in the macro module and want to ensure it calls it regardless where you go if you dont `export tables`
23:05:33FromDiscord<Patitotective> let me try (btw i wasn't importing `std/macros` lol)
23:05:35FromDiscord<Patitotective> Thanks
23:05:37FromDiscord<Patitotective> 🙃
23:06:16FromDiscord<leorize> if you'd like to see an auto-union for arrays and KV pairs, please open an issue
23:06:21FromDiscord<SirOlaf> So, I think this actually does work
23:06:55FromDiscord<SirOlaf> Comment out the ``result = nil` in the compareTypes branch
23:06:58FromDiscord<SirOlaf> For testing
23:07:01FromDiscord<SirOlaf> (edit) "``result" => "`result"
23:07:50FromDiscord<Patitotective> In reply to @leorize "if you'd like to": i will open a pull request when i solve it hehe
23:08:49FromDiscord<Elegantbeef> Ah so it perhaps may be my fault
23:09:56FromDiscord<SirOlaf> Question is why the type check fails even though it can be run
23:11:37FromDiscord<Elegantbeef> I dont even get what that branch is for
23:12:05FromDiscord<SirOlaf> Not sure either, but I discovered before that commenting out the result reset makes things work
23:12:25FromDiscord<SirOlaf> Because resolve does succeed
23:12:38FromDiscord<SirOlaf> It's probably an extra check in case the candidate is bad
23:17:36FromDiscord<Patitotective> sent a code paste, see https://paste.rs/21C
23:18:03FromDiscord<Elegantbeef> I mean you can use return but it's not idiomatic
23:18:10FromDiscord<Elegantbeef> you need to annotate the macro with `: untyped`
23:19:08FromDiscord<Patitotective> Yeeey, it worked↵Thanks
23:19:09FromDiscord<Patitotective> 🙃
23:21:45FromDiscord<SirOlaf> So yeah, with this line commented out, the original example from the github issue compiles too
23:21:57FromDiscord<SirOlaf> In other words, you were 100% right about skipping those types
23:22:13FromDiscord<SirOlaf> (edit) "So yeah, with this line commented out, the original example from the github issue compiles too ... " added "(after adding a []=)"
23:22:21FromDiscord<Elegantbeef> Dont say that it'll go straight to my head
23:22:27FromDiscord<Elegantbeef> Why are the types not equal is now the question
23:22:52FromDiscord<Elegantbeef> Dont add `[]=`
23:22:58FromDiscord<Elegantbeef> Just do `(nested["key1"]["key2"])` 😀
23:23:07FromDiscord<Elegantbeef> That way you set the var that it returns
23:23:26FromDiscord<SirOlaf> Imagine choosing the ugly way
23:24:01FromDiscord<Elegantbeef> Hey it's the entire point of this
23:24:17FromDiscord<Elegantbeef> Someone didnt realize that `[]=` would need to be defined
23:24:32FromDiscord<Elegantbeef> Anyway we now need to figure out why compare types fails, the echo'd values were identical
23:24:35FromDiscord<Elegantbeef> So it's odd
23:28:07FromDiscord<SirOlaf> This problem never stops giving I guess
23:29:24FromDiscord<Elegantbeef> Hey you're "adding" a feature
23:29:30FromDiscord<Elegantbeef> It's complicated
23:30:02FromDiscord<SirOlaf> Oh no, it's great
23:30:09FromDiscord<SirOlaf> But it's surprising how deep it goes
23:31:37FromDiscord<Elegantbeef> Also you'll probably want/need to add that this and the composite type class works in the manual
23:31:49FromDiscord<Patitotective (Patitotective)> do you mean an issue to nim? lol↵(@Patitotective)
23:32:30FromDiscord<SirOlaf> In reply to @Elegantbeef "Also you'll probably want/need": Honestly have no idea what a composite type class is
23:32:45FromDiscord<SirOlaf> Just keep seeing it in the compiler but ignore it every time
23:33:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Lrh
23:33:44FromDiscord<Elegantbeef> A composite typeclass is the magic typeclass for all generics of a given type
23:34:08FromDiscord<SirOlaf> Doesn't that get expanded to A[any]
23:34:23FromDiscord<Elegantbeef> No it's a composite typeclass
23:34:27FromDiscord<Elegantbeef> It doesnt expand
23:34:34FromDiscord<Elegantbeef> It's a `tyCompositeTypeClass` or w/e
23:35:32FromDiscord<SirOlaf> That works though, and I think I saw it getting expanded internally
23:36:32FromDiscord<Elegantbeef> Anyway araq said it should be documented and i havent got around to it
23:36:49FromDiscord<Elegantbeef> So as it's related seems like something you could take the time to do 😛
23:37:04FromDiscord<Isofruit> Elegantly delegating beefy documentation
23:37:08FromDiscord<Isofruit> I see I see
23:37:16FromDiscord<Isofruit> 😄
23:37:47*cyraxjoe joined #nim
23:37:52*MightyJoe quit (Ping timeout: 256 seconds)
23:37:57FromDiscord<Elegantbeef> Eh i fixed the issue didnt think it needed to be documented
23:38:02FromDiscord<Elegantbeef> Someone merged it before i could add documentation
23:38:05FromDiscord<Elegantbeef> It's not my fault!
23:38:59FromDiscord<Isofruit> Fully fair 😄 I just saw an opportunity and had to take it
23:41:52FromDiscord<Isofruit> Alrighty, enough coded for today, solving this damn "get me the related field between two models based on tablenames" issue took like 3h
23:42:20FromDiscord<Elegantbeef> Code review time?
23:44:08FromDiscord<Isofruit> Look, I barely managed to code that monstrosity up there, I barely managed to find a single way to write this, I got leorize to see if he couldn't do it via macro rather than try the path of generics.↵I don't see myself writing a better version of the above until I've gained a lot more experience in the language
23:44:41FromDiscord<Isofruit> I think my remaining brain cells will just implode
23:44:51FromDiscord<Elegantbeef> Ok
23:45:21FromDiscord<Isofruit> unless
23:45:24FromDiscord<Elegantbeef> Can i atleast see the code?
23:45:30FromDiscord<Isofruit> I noticed it is an utter pain in the neck to chain when conditions
23:46:30FromDiscord<Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Lrn
23:47:37FromDiscord<Isofruit> That code tries to find the foreign-key-field of the model that points from Model B to Model A.↵But it makes sure to check this based on tablename and not just the model-type
23:47:40FromDiscord<SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3Lro
23:47:52FromDiscord<Elegantbeef> You can reduce the number of when statements!
23:48:09FromDiscord<Isofruit> I tried to throw them together with "and" statements, I got compilation issues
23:48:26FromDiscord<Isofruit> So at some point I just gave up and made one when per expression
23:50:16FromDiscord<Isofruit> ~~There's only so much you can do before you just submit to the compiler~~
23:50:59FromDiscord<Elegantbeef> Is it the `var distinct`?↵(@SirOlaf)
23:51:25FromDiscord<SirOlaf> Not quite sure yet
23:51:43FromDiscord<SirOlaf> But possible I guess
23:52:28*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:52:38FromDiscord<SirOlaf> result = sameFlags(a, b)
23:52:39FromDiscord<SirOlaf> This fails
23:52:45FromDiscord<SirOlaf> The flags just aren't the same
23:54:58FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lrq
23:56:46FromDiscord<SirOlaf> One of the two types has the tfVarIsPtr flag
23:56:51FromDiscord<SirOlaf> Other doesn't
23:57:03FromDiscord<SirOlaf> What does this flag mean
23:59:00FromDiscord<Elegantbeef> `# 'var' type is translated like 'ptr' even in C++ mode`
23:59:25FromDiscord<SirOlaf> Oh, it has documentation
23:59:34FromDiscord<SirOlaf> Nice
23:59:44FromDiscord<Elegantbeef> Yea rare Nim compiler comments