<< 27-07-2020 >>

00:10:21*vicfred quit (Remote host closed the connection)
00:10:44*vicfred joined #nim
00:12:49*oddp quit (Ping timeout: 264 seconds)
00:23:05*fredrikhr quit (Read error: Connection reset by peer)
00:23:30*fredrikhr joined #nim
00:24:10*fredrikhr quit (Read error: Connection reset by peer)
00:24:35*fredrikhr joined #nim
01:05:38*Tlongir joined #nim
01:08:19*Tongir joined #nim
01:10:25*Tlongir quit (Ping timeout: 240 seconds)
01:19:31*apahl quit (Ping timeout: 272 seconds)
01:21:07*apahl joined #nim
01:23:03FromDiscord<Anuke> sent a code paste, see https://play.nim-lang.org/#ix=2spM
01:24:31voltistIs anyone on here the developer of NiGui?
01:31:36FromDiscord<slymilano> jiro4989 just posted a github actions for cross-platform build/release. it's really great!
01:31:49FromDiscord<Yardanico> @Anuke that's the wrong command
01:31:58FromDiscord<slymilano> git tag v0.0.1 and boom you got your app for all three major's easily reachable for your end user.
01:32:00FromDiscord<Yardanico> Replace arm with arm64
01:32:01FromDiscord<slymilano> shmexy
01:32:09FromDiscord<Yardanico> arm is armv7
01:33:03FromDiscord<Yardanico> arm64 is aarch64 and is armv8a
01:33:37FromDiscord<Yardanico> @voltist yes, he's there sometimes, but it's better to open an issue in NiGui to ask something about it
01:33:46FromDiscord<Yardanico> !seen TrustableCode
01:33:47disbotTrustableCode never seen.
01:34:00FromDiscord<Yardanico> !seen trustable-code
01:34:01disbottrustable-code never seen.
01:36:26FromDiscord<Yardanico> Hmmm
01:38:19bunghttps://github.com/nim-lang/Nim/issues/5768 this should close
01:38:21disbotdb_sqlite can't correctly quote binary data ; snippet at 12https://play.nim-lang.org/#ix=2spS
01:41:27bungI've read all stdlib,js lablled issues till now
02:03:37FromDiscord<Yardanico> Why it should be closed? I don't understand
02:10:01bunghttps://github.com/nim-lang/Nim/pull/14408/files#diff-0285f3281e8cf19b0275e85bc908d119R774
02:10:02disbotadd bindParams to db_sqlite
02:10:11*muffindrake quit (Ping timeout: 272 seconds)
02:10:38bungdb_sqlite now have bind params api, can bind binary data null etc.
02:11:27FromDiscord<impbox> nice
02:11:45*muffindrake joined #nim
02:25:48*outtabwz quit (Quit: leaving)
02:38:54*fredrikhr is now known as couven92
02:42:23FromDiscord<Varriount> impbox: Who did the music for smalltrek? It's nice.
02:42:38FromDiscord<Varriount> Reminds me of one of my favorite schmups
02:48:20*Cthalupa quit (Ping timeout: 244 seconds)
02:48:47*Cthalupa joined #nim
02:52:05*lritter quit (Ping timeout: 240 seconds)
02:52:58*lritter joined #nim
02:58:47*waleee-cl quit (Quit: Connection closed for inactivity)
03:03:31*arecacea1 quit (Read error: Connection reset by peer)
03:03:34*B4s1l3 joined #nim
03:04:08*arecacea1 joined #nim
03:06:23FromDiscord<Varriount> Reminds me music by [Slimegirls](https://slimegirls.bandcamp.com/)
03:06:42FromDiscord<Varriount> (edit) '[Slimegirls](https://slimegirls.bandcamp.com/)' => 'Slimegirls (https://slimegirls.bandcamp.com/)'
03:09:30*FromDiscord quit (Remote host closed the connection)
03:09:45*FromDiscord joined #nim
03:15:20*Tlanger joined #nim
03:18:17*Tongir quit (Ping timeout: 265 seconds)
03:19:20FromDiscord<impbox> @Varriount i did
03:19:42FromDiscord<impbox> it was very rushed on my gameboy
03:20:32FromDiscord<impbox> i see the resemblance, very gameboy sound
03:23:42FromDiscord<impbox> https://soundcloud.com/luna-and-the-spacebaes/spatial-anomaly a song me and my partner created out of the smalltrek music
03:23:50shashlickshared data across threads again - when is this going to be solved
03:24:24FromDiscord<Varriount> shashlick: When we finally come up with a solution for world hunger and global peace.
03:24:36FromDiscord<impbox> you can't share data across threads?
03:25:08FromDiscord<impbox> pretty sure i've been doing that
03:25:34FromDiscord<Varriount> Not without either using the Boehm GC, or pointers.
03:25:47shashlickhow are you - cannot use any nim types
03:25:50FromDiscord<Varriount> Or copying data
03:26:07FromDiscord<impbox> hmm maybe i'm using boehm, is that the default?
03:26:21shashlicknope
03:26:37*B4s1l3 is now known as opDispatch
03:26:45FromDiscord<impbox> is this a recent change you're talking about?
03:27:06shashlickthis is why arc/orc exist
03:27:08FromDiscord<impbox> i haven't played with threads lately, but nimsynth was sharing global data between threads
03:27:25shashlickcause the refc gc doesn't support it
03:27:28FromDiscord<Varriount> impbox: What method were you using to share data, channels?
03:27:36FromDiscord<impbox> nah, just accessing globals
03:27:39FromDiscord<impbox> with locks
03:27:58FromDiscord<Varriount> Did the globals have any reference types in them?
03:28:43FromDiscord<impbox> i'll check the code so i'm not giving misleading data
03:28:49FromDiscord<Varriount> Where you get into trouble is if you store a reference from thread A in a global, then copy it into thread B
03:29:09FromDiscord<impbox> hmm is it copying? i thought both threads could access the same data
03:29:13FromDiscord<Varriount> (copy the reference, not the data the reference points to)
03:29:45shashlicki cannot opt for boehm here, it works great for this
03:29:52shashlickhave to use pure nim stdlib
03:30:05shashlickand cannot assume boehm is installed
03:30:58FromDiscord<Varriount> To put it another way, a thread cannot handle references (either directly, or indirectly through an object) that were not created in that thread
03:31:18FromDiscord<Elegant Beef> The default GC has seperate heaps per thread, right?
03:31:28FromDiscord<Varriount> Yes
03:32:53shashlickone option is to have one thread that manages the data and use channels back and forth with that thread
03:33:08shashlickjust a mess though - just trying to parallelize some code
03:33:36FromDiscord<Varriount> shashlick: Launch separate processes. >:D
03:34:19shashlickdoesn't help cause they still need to coordinate
03:34:37FromDiscord<Varriount> Pipes?
03:35:00shashlickbasically i'm experimenting with parallelizing nimble
03:35:33FromDiscord<Varriount> Parallel downloads?
03:35:41shashlickya and processing dependencies
03:35:51shashlickbut cannot install the same dependency multiple times
03:36:07shashlickhas to be some coordination
03:36:13FromDiscord<Varriount> Isn't that the kind of thing channels are good at?
03:36:25shashlickthen i'll need a thread keeping track of this
03:36:33FromDiscord<Varriount> Have each thread push/pull jobs onto/from the channel
03:37:02FromDiscord<impbox> can you just use async instead of threads?
03:37:17shashlicki would have but am spawning processes which need to be parallelized
03:37:33shashlickfor that i'll need asynctools which isn't stdlib
03:37:42disruptekso put it in.
03:38:01shashlicki might just ditch this experiment
03:38:33FromDiscord<impbox> is nimble such a bottleneck that it needs optimising?
03:38:36shashlickdoubt i can improve performance very drastically without major rework
03:39:57shashlicklet's just call it a fun experiment that originated from @PMunch's https://github.com/nim-lang/nimble/issues/722
03:39:58disbotConcurrent downloads of packages
03:40:04*fredrik92 joined #nim
03:40:31FromDiscord<impbox> mmm concurrent downloads sounds like it shouldn't require threads
03:40:51FromDiscord<impbox> spawn a bunch of processes, wait for them all to finish
03:41:09*jeko quit (Quit: Leaving)
03:42:13shashlickone point worth consideration is that most packages only have 2-3 deps so the tree could get wide but you don't know child deps unless you download the parent
03:43:04FromDiscord<impbox> could be stored as metadata in the ... whatever it's called that nimble talks to
03:43:50*couven92 quit (Ping timeout: 260 seconds)
03:43:58shashlickthe package repo only includes urls to repos, not deps and version info
03:44:06FromDiscord<impbox> so far!
03:44:16shashlickit isn't a db - just a json file
03:45:32shashlickperformance is a distraction after all, let's just call it a useless Sunday and move on
03:45:44shashlicksome day data sharing across threads will be easy
03:45:46FromDiscord<impbox> but even without threads, check when one process finishes and check if new deps are added by it
03:45:57FromDiscord<impbox> then spawn processes for those deps
03:46:03FromDiscord<impbox> and keep a queue of processes
03:48:19shashlicksome day, will consider this again, for now need to focus on bugs again
03:50:31shashlicksomeone pick a defect
03:51:05FromDiscord<impbox> better error messages for nimble scripts
03:51:18shashlickthat should be improved with recent changes
03:51:26FromDiscord<impbox> \o/
04:06:01*supakeen quit (Quit: WeeChat 2.8)
04:06:39*supakeen joined #nim
04:09:05*altarrel quit (Quit: Konversation terminated!)
04:17:06*narimiran joined #nim
04:17:54disruptek!repo cps
04:17:55disbothttps://github.com/disruptek/cps -- 9cps: 11Continuation-Passing Style for Nim 🔗 15 15⭐ 0🍴 7& 1 more...
04:18:29disruptekbad news:
04:18:35disruptektomorrow is shower sunday.
04:19:01FromGitter<kennymalac> Hey, out of curiousity, is it possible to override default keywords such as if, else, and =
04:19:38disruptek!eval var `if` = "woot"
04:19:40NimBot<no output>
04:21:13FromDiscord<impbox> kennymalac you can use them as non keywords by quoting with backticks i think
04:21:17FromDiscord<Elegant Beef> you can strop variables
04:21:17FromDiscord<Elegant Beef> Yea
04:21:19FromDiscord<impbox> not the same as overriding them
04:21:37FromGitter<kennymalac> I'm trying to compare nim to a lisper
04:22:10FromGitter<kennymalac> nim to Common lisp to a lisper*
04:22:18disruptek!repo belamenso/v
04:22:19disbothttps://github.com/belamenso/v -- 9v: 11Write Nim only with 'v' 15 24⭐ 3🍴
04:25:40FromDiscord<Rika> *flashbacks to the last lisper who was here*
04:28:47skrylar[m]that is horrifying
04:45:38*opDispatch left #nim ("Konversation terminated!")
04:47:54*fredrikhr2 joined #nim
04:48:07*fredrikhr2 is now known as fredrikhr
04:51:52*fredrik92 quit (Quit: Client Disconnecting)
04:58:07*fredrikhr quit (Quit: The Lounge - https://thelounge.chat)
05:02:07*fredrikhr joined #nim
05:30:02Zevvdisruptek: so, how many nim bugs have you summoned over the last weeks again?
05:55:01*maier joined #nim
06:09:38*Vladar joined #nim
06:29:13*jjido joined #nim
06:38:40*aurelius joined #nim
06:44:14*hoijui joined #nim
06:46:19*solitudesf joined #nim
06:55:00*lritter quit (Quit: Leaving)
07:11:00Zevvwho wants a fun little puzzle
07:11:01Zevvhttp://ix.io/2sqi
07:11:20Zevvwinners gets a large beer at next fosdem
07:17:36*nikita` joined #nim
07:18:09FromDiscord<Rika> what if we dont drink beer
07:20:55FromDiscord<Rika> Zevv: checking the two's "bits" by casting them into an int64 shows that theyre exactly the same in memory, it seems
07:21:26ZevvA kebab or falafel good for you?
07:21:30FromDiscord<Rika> so it seems that its impossible to distinguish them
07:21:46Zevvright so
07:21:53FromDiscord<Rika> uh i dont live in europe so its extremely unlikely you'll ever meet me
07:22:18ZevvWho cares. you have local deliveries I bet :)
07:22:21*Tongir joined #nim
07:23:13FromDiscord<Rika> wait, let me redo my "observation"
07:23:19Zevvhaha
07:23:41Zevvthe fun thin is: disruptek has a case where there is different behaviour depending on cast vs conversion
07:23:50Zevvbut it's pretty convoluted
07:24:25*Tlanger quit (Ping timeout: 240 seconds)
07:24:31FromDiscord<Rika> so maybe its not minimized correctly
07:25:00Zevvsure, but then again. His code does A with casting and B when converting.
07:25:36*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:26:54FromDiscord<Rika> then maybe its not just "when a type inherits another", maybe theres another thing in combination that causes the issue
07:27:03Zevvthere must be.
07:27:27ZevvI think there's some funny AST going on in all the macros in the code
07:27:32Zevvbut I don't understand that code :/
07:57:02*hoijui quit (Ping timeout: 260 seconds)
08:11:02FromDiscord<Varriount> Zevv: Could the behavior be C compiler related?
08:11:08Araqshashlick, awesome work on Nimble! Thank you!
08:11:10ZevvI don't know. There *is* different codegen
08:11:17*Araq is going through his github related emails
08:18:17*dzamo joined #nim
08:21:13*dzamo quit (Client Quit)
08:21:32*dzamo joined #nim
08:25:46*jjido joined #nim
08:26:22AraqZevv, don't understand your snippet
08:26:34Araqif you explain it once again, I might help out
08:29:02Zevvwell, disruptek "fixed" something in CPS yesterday by casting between derived object types
08:29:05Zevvinstead of converting
08:29:21ZevvI don't understand his CPs code anymore, but my point was that if he needed to cast, something is wrong
08:29:35Zevvbecause everthing should be perfectly fine, typewise, after CPS transformations
08:29:48Zevvbut he seems to have a case where his bug is "fixed" by casting instead of converting
08:29:56ZevvThere is an actual difference in the codegen
08:30:13Zevvbut I don't understand what the different behaviour could be between a casted and converted object
08:30:23Zevvbecause the end result is exactly the same, it is only a different path of going there
08:30:52ZevvBut I strongly oppose between putting in any kind of casting in the CPS code, because we basically lose the help of the compiler there if we mess up
08:31:27Zevvso this snippet is just a way of showing two ways to get to the same result, and my question was if there is any distinguishable difference between these two objects - one casted and one converted
08:31:34Zevvbecause the C-code *is* different
08:31:44Zevvdoes that make sense?
08:34:23FromDiscord<Varriount> Zevv: Wouldn't the conversion code have conversion checks?
08:34:38FromDiscord<Varriount> (assuming you're not turning them off)
08:35:14AraqZevv, I agree with you
08:35:31Araqand 'cast' shouldn't be used
08:35:52FromDiscord<impbox> just so i can follow along, what's CPS?
08:36:05Araqwe have different code paths in the Nim compiler though because type conversions are checked at runtime
08:37:06Araqand I hunted a maybe related codegen bug for the last days
08:38:06Zevvthat would make sense.
08:38:20ZevvThe problem is that this bug is triggered after all this CPS juggling with the AST
08:38:46Zevvso it might also be that his problem is caused by funny AST which is not right but also not quite wrong
08:39:01ZevvI'm not sure how strict the compiler is on AST that it does not generate from the Nim parser
08:39:20ZevvI've seen the occasional 'ill formed' message, but I bet there's a million ways to get the C-gen to mess up with custom AST
08:39:34Araqit's strict but I suppose e.g. nkConv is usually not generated by a macro
08:39:47Araqand yeah, getting it to "strict" was a pita :-)
08:40:17Zevvmakes perfect sense.
08:40:42ZevvProblem is that I do not understand the underlying stuff of disruptek issue. I do understand that I am right and he is wrong, but I needs some time to realize that
08:40:55Zevv s/he needs/
08:43:06FromDiscord<Varriount> @impbox I'll PM you, to avoid cluttering up the chat
08:45:46*xet7 quit (Ping timeout: 260 seconds)
08:47:05*aurelius quit ()
08:47:34*xet7 joined #nim
08:48:14*aurelius joined #nim
09:07:37*oddp joined #nim
09:14:12FromGitter<alehander92> ok
09:15:22*Tlanger joined #nim
09:18:13*Tongir quit (Ping timeout: 264 seconds)
09:20:23*ofelas quit (Ping timeout: 258 seconds)
09:40:56*dzamo quit (Quit: dzamo)
09:41:18*dzamo joined #nim
09:50:33ZevvVarriount: sure, but I turned everything off with -d:danger
09:54:49*Tongir joined #nim
09:56:59*Tlanger quit (Ping timeout: 240 seconds)
10:09:47*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:14:12FromDiscord<Varriount> Araq: Regarding closures (and closure iterators) do you know why they are slower than regular function calls? Is it the accesses to the closure environment?
10:18:41Araqwell it's a closure call, closure calls introduce an 'if' that good optimizers can optmize out but when I checked years ago they didn't
10:20:01Araqthe environment and heap allocations don't help either but look
10:20:34Araqthe real costs here come from the Future + callbacks + closure iterator interactions
10:21:07Araqif you could only use Futures, or only callbacks or only closure iterators it would be better
10:25:25FromGitter<alehander92> can you inline many calls
10:25:29FromGitter<alehander92> to just goto-s
10:25:39FromGitter<alehander92> like, can one write a simple compiler for no-async code
10:25:45FromGitter<alehander92> that just generates a single big call
10:25:56FromGitter<alehander92> without creating new frames etc
10:26:21FromGitter<alehander92> and just rearranging everything into different parts of the code (and limiting stack variables )
10:26:27Araqthat's how my Lego Mindstorm Not quite C implementation worked
10:26:38Araqit's terrible and you lose recursion but it works
10:26:48FromGitter<alehander92> oh yeah recursion
10:26:54Araqit was a valid strategy for Fortran code before they added recursion to Fortran
10:27:04FromGitter<alehander92> interesting
10:27:13FromGitter<alehander92> but does it help somehow performance
10:27:32FromGitter<alehander92> or is it just a cool-that-it-can be done
10:27:40FromGitter<alehander92> thing
10:28:58FromGitter<alehander92> like, frames are just there, so it's not really a matter of creating them, and moving vars to heap is probably not cool
10:36:50*outtabwz joined #nim
10:39:57FromDiscord<Clyybber> Araq: Is there a way I can access the template scope of a template generated symbol?
10:40:26FromDiscord<Clyybber> In semProcAux
10:43:33Zevvwait what
10:43:35Zevvdid you make NQC?
10:46:13FromDiscord<Yardanico> Implementation for Lego Mindstorm it seems
10:48:49Zevvyeah man I grew up with that stuff
10:49:13Zevvmindstorms software sucked big time, but luckily there was NQC
10:51:44FromDiscord<Yardanico> Oh nice so the closure leak was a real one
10:52:09FromDiscord<Yardanico> That's nice to know, I hope we won't have other leaks with async after that one is fixed
10:52:33FromDiscord<Yardanico> 1 line fix :D
10:56:35FromDiscord<Clyybber> that 1 line fix is only temporary afaict
10:56:54FromDiscord<Clyybber> because in general we still want to have the isDecl firstwrite optimization
10:57:37FromDiscord<Yardanico> Oh
11:00:03FromDiscord<Yardanico> Also @Clyybber is it fine to merge #15085 ?
11:00:04disbothttps://github.com/nim-lang/Nim/pull/15085 -- 3Add test-cases for #12576 and #12523
11:00:20FromDiscord<Clyybber> Oh, I was just looking at it
11:02:03*NimBot joined #nim
11:03:02FromDiscord<Yardanico> And yeah, I can probably do some comment renamings in the test suite to our new scheme
11:03:11FromDiscord<Yardanico> I mean the # bug #12345 stuff
11:03:12disbothttps://github.com/nim-lang/Nim/issues/12345 -- 3Confusing error with static parameters ; snippet at 12https://play.nim-lang.org/#ix=26CQ
11:03:18FromDiscord<Clyybber> not needed IMO, but if you want to go ahead :)
11:04:35AraqZevv, ah no, that was poorly worded, it was "my Mindstorm"
11:04:43Araqbut I didn't write the software
11:05:31Araq <Yardanico> that fix fixes your reduced test case
11:05:49Araqbut the async leak remains, well it got a little better
11:06:48Araqa different reduction would be sweet ;-)
11:07:03FromDiscord<Yardanico> Oh okay I'll see
11:08:49AraqClyybber: the 'isFirstWrite' rule is mostly unaffected
11:09:14Araqonly closures were affected
11:10:45AraqClyybber: alternatively you can work on making forward declarations obsolete
11:11:22Araqthey make things more complex with almost no known benefits
11:15:08FromDiscord<Clyybber> yeah
11:15:38FromDiscord<Clyybber> Araq: But you changed the only call that sets isDecl to true in var/let sections
11:16:15Araqbut for n.kind != nkSym which means it's a "lifted" variable
11:16:38Araqit's var env.v = 3 which should really be evn.v = 3
11:16:45FromDiscord<Clyybber> oh, I missed that part
11:16:49FromDiscord<Clyybber> right, makes sense
11:17:32*krux02 joined #nim
11:19:41*fredrikhr quit (Read error: Connection reset by peer)
11:20:48Araqalehander92, on a modern CPU it's not an optimization anyway. But thinking about it, it's how GPUs work
11:20:59Araqafaik
11:21:16FromDiscord<Yardanico> Also I forgot about -d:nimAllocStats , guess reducing would be easier with it
11:21:25*fredrikhr joined #nim
11:27:27*dulsi quit (Quit: Leaving)
11:29:49*fredrikhr quit (Read error: Connection reset by peer)
11:30:30*fredrikhr joined #nim
11:30:52*dulsi joined #nim
11:33:18*hoijui joined #nim
11:39:27*oriba joined #nim
11:45:07*fredrikhr quit (Read error: Connection reset by peer)
11:45:31*fredrikhr joined #nim
11:50:52*waleee-cl joined #nim
11:59:03icyphoxany good examples for xmlparser?
12:01:03FromDiscord<Yardanico> Idk, it's not that hard
12:01:21FromDiscord<Yardanico> E.g. https://github.com/Yardanico/nim-snippets/blob/master/logcheck/main.nim#L82
12:01:51FromDiscord<Yardanico> https://github.com/Yardanico/nim-snippets/blob/master/tg_export_parse.nim#L6
12:02:03icyphoxyeah i was wondering what to do with the XmlNode object
12:02:09icyphoxfound some procs i can use in xmltree
12:02:32FromDiscord<Yardanico> nimquery is a good lib
12:02:43FromDiscord<Yardanico> For using CSS selectors to parse html
12:02:56icyphoxah no, this is pure XML
12:03:01icyphoxxmpp stanzas
12:03:32FromDiscord<Yardanico> It'll still work
12:03:50FromDiscord<Yardanico> Current html parser is built on top of the XML one
12:04:06FromDiscord<Yardanico> https://github.com/GULPF/nimquery
12:04:17FromDiscord<Yardanico> parseHtml returns a XmlNode
12:05:08icyphoxnice
12:05:11icyphoxi'll check this out
12:06:02*supakeen quit (Quit: WeeChat 2.8)
12:06:39*supakeen joined #nim
12:13:00FromDiscord<dom96> > if you could only use Futures, or only callbacks or only closure iterators it would be better↵@Araq[IRC]#0000 what makes you think you can't?
12:13:28Araqasync's design uses all three
12:13:37FromDiscord<dom96> > Oh nice so the closure leak was a real one↵@Yardanico what's the context on this?
12:13:53Yardanicohttps://github.com/nim-lang/Nim/issues/15076 the last comment repro was fixed
12:13:54disbotMemory leaks with async (closure iterators?) under ORC ; snippet at 12https://play.nim-lang.org/#ix=2snX
12:13:55Araqcontext is --gc:orc + async
12:14:11Araqand it's still leaking, I'm looking into the problem right now
12:14:16FromDiscord<dom96> Araq: async /await/'s design
12:14:26Araq(but it leaks less now, yay)
12:14:46FromDiscord<dom96> Nothing stops you from using futures on their own, except the mess that brings to your code 🙂
12:15:12FromDiscord<dom96> but maybe there is a way to reduce that mess by creating an async await macro which doesn't use closure iterators
12:15:40*fredrikhr quit (Read error: Connection reset by peer)
12:16:24Araqyeah but
12:18:08Araqin the end it doesn't matter much. I prefer to do things differently.
12:18:41Yardanico"(allocCount: 600092, deallocCount: 499967)" oh i see
12:18:44Yardanicofrom my first example hm
12:18:57*fredrikhr joined #nim
12:19:47Yardanicobtw I was labeling some issues yesterday, we still have ~300 unlabeled ones (although some of them are hard to properly label)
12:19:59Yardanicoi mean open unlabeled issues
12:20:15FromDiscord<dom96> Araq: that's a shame, because async is very stable and used in production by many.
12:21:52Araqdom96: well my way has the benefit that we might get rid of "closure iterators" entirely
12:22:03Araqand end up with a smaller Nim
12:23:21Araqwith your proposed way all we get is refactorings for our async.
12:24:36*fredrikhr quit (Read error: Connection reset by peer)
12:25:18*fredrikhr joined #nim
12:25:49Araqor maybe in the end we understand closure iterators better and can write a decent spec and eliminate edge cases
12:26:48FromDiscord<dom96> > with your proposed way all we get is refactorings for our async.↵I guess, but you said that only using Futures would be an improvement. I assume that's a win in and of itself. Even if we get there by refactoring async.
12:34:51Yardanicook I minimized the original leak to only importing asyncfutures :P
12:35:01Yardanico"(allocCount: 30020, deallocCount: 25018)" for 5k iterations
12:36:28*sagax quit (Remote host closed the connection)
12:37:24Yardanicoah wait
12:37:24*aurelius quit (Remote host closed the connection)
12:38:13YardanicoAraq: did you test the original snippet (the first one from the issue) so you said there's still a leak?
12:38:21Yardanicobecause it seems like this leak comes from debugging info of futures
12:38:56AraqYardanico: yeah, valgrind suggests that
12:39:13Yardanicoif you compile with -d:release you get "(allocCount: 500090, deallocCount: 499967)", although this might still mean a leak
12:39:22Yardanicoand it does, valgrind still shows a bit of leaks
12:41:50silvernode[m]Tonight was my last night off work, I had 10 days off. I got about 6 more hours to kill before sleep time and need to motivate myself to work on code. -_-
12:43:38Yardanicooh lol
12:43:51Yardanicoit might have to do something with Future[T] inheriting from FutureBase
12:44:03Yardanicoif I replace every Future[void] with FutureBase (everywhere in the code), that leak goes away
12:44:29*sagax joined #nim
12:45:06*jjido joined #nim
12:45:50Yardanicoleaks in - https://gist.github.com/Yardanico/694ae199eac7b864bc3fb822ae401d15, doesn't leak with - https://gist.github.com/Yardanico/a58949aea5653c4163c3f91b60a2b657, whole diff - https://gist.github.com/Yardanico/a3e1ba90f9d0e34e5edac07b88b59153
12:46:21FromDiscord<XxDiCaprioxX> Anybody here who used Discordnim?
12:46:30Yardanicoyou should use dimscord instead :)
12:46:32Oddmongerare there differents ways of writing a cast ?
12:47:16YardanicoOddmonger: not really, there's only one way of writing a real "cast" in nim
12:47:27Yardanico@XxDiCaprioxX discordnim is unmaintained really
12:47:28Oddmongerie i want to cast a cstring to a string, so i did (naively): print_string( (string) foo() )
12:47:29FromDiscord<XxDiCaprioxX> Okay, but is that a good library?
12:47:29Yardanicodimscord OTOH is
12:47:40FromDiscord<XxDiCaprioxX> I mean dimscord
12:47:42Yardanico@XxDiCaprioxX well the current IRC bridge uses it
12:47:45Yardanicothe author is active here
12:47:54YardanicoOddmonger: well that'll work
12:47:57Yardanicobut it's not a "cast"
12:47:59Yardanicoit's a conversion
12:48:03Yardanicoconversions are safe, casts are not
12:48:13Oddmongerah
12:48:14Yardanicoand what you did is possible due to command syntax
12:48:16Yardanicoe.g.
12:48:21Yardanico!eval (echo)5
12:48:23NimBot5
12:48:50FromDiscord<XxDiCaprioxX> Okay thank you @Yardanico[IRC]#0000
12:48:59Oddmongerwhooo
12:49:00Oddmongerok
12:49:10Oddmongerthank you
12:49:11Yardanicothe more readable way is
12:49:21Yardanicoprint_string(string(foo()))
12:49:24Yardanicoor foo().string
12:49:26Yardanicoor string foo()
12:49:32Oddmongerah
12:49:34YardanicoUFCS
12:49:43Oddmongeri did: cast[string](foo())
12:49:47Yardanicodon't do that
12:49:59Yardanicothere's a $ operator for cstring defined which converts it to a string
12:50:02Araqdo not 'cast'!
12:50:17Araqread the tutorials once again please
12:50:41Oddmongeryes i think i need to
12:51:13Oddmongerusually i read once, understand everything, write something trickier than «hello world» and read it again
12:51:47FromDiscord<dom96> I've got a project on my ideas list to rate Nim packages in terms of how many `cast`, `ptr`, `pointer`, `addr` etc. are used in the code. Avoid these features as much as you can.
12:52:02FromDiscord<Rika> Cast only needed if you want to do super dumb shit like I do lol
12:52:06YardanicoI can do that I guess @dom96
12:52:12Yardanicobecause I already have the code for pkgraph
12:52:17Yardanicoto clone all nimble packages :D
12:52:19FromDiscord<Rika> @dom96 so basically a code quality analyzer?
12:52:30FromDiscord<Rika> Or rather, one component to it
12:52:31Yardaniconeed to clone them again though since I had to delete them
12:52:43Yardanicoalso Araq btw I parsed all #nim IRC logs
12:52:59Yardanicofrom when nimbot started working
12:53:02Yardanico!ping
12:53:02NimBotpong
12:53:02FromDiscord<dom96> I mean if you want go for it
12:53:05Yardanico!lag
12:53:05NimBot19ms between me and the server.
12:53:09Yardanicofast
12:53:15FromDiscord<dom96> But I wasn't thinking about doing it for all packages
12:53:24FromDiscord<dom96> it's something that you should be able to run on specific packages
12:53:33FromDiscord<dom96> and it was inspired by a Rust program that looks for `unsafe`
12:53:37FromDiscord<dom96> can't remember it's name though
12:53:45FromDiscord<Rika> runsafe
12:53:49FromDiscord<Rika> I'd name a program that
12:54:02FromDiscord<Rika> Lol (I don't know the name, I'm just guessing)
12:54:05*Kaivo joined #nim
12:56:54FromDiscord<Varriount> Wow, lots of PRs popping up today
12:57:15FromDiscord<Clyybber> Araq: Hmm, WDYT about attaching scopes to symbols?
12:57:29FromDiscord<Clyybber> This would make template scope mixing perhaps easier
12:57:33AraqI don't like it
12:57:57Araqscopes are mutable
12:58:12Araqand poorly understood
12:58:53FromDiscord<Varriount> Poorly understood from an implementation perspective, or a conceptual perspective?
13:00:55YardanicoAraq: well I seem to have minimized it to less than 100 loc
13:01:12Yardanico"(allocCount: 30020, deallocCount: 25018)"
13:01:14Yardanicohttps://gist.github.com/Yardanico/817a7a7c71344ddb8f5aa1374ee466d0
13:01:35Yardanicoif you just do Future and not Future[T] - leak disappears
13:01:41Yardanicomaybe because then the type is just aliased
13:01:55Yardanicoor if you use FutureBase directly
13:02:01FromDiscord<Clyybber> Araq: Should `template a: untyped = proc p() {.gensym.}; proc p() {.gensym.} = discard` work?
13:03:23Yardanicoseems to be related to " stackTrace: seq[StackTraceEntry]" directly
13:03:34Yardanicoif I remove that field and it's initialization - there's "almost" no leak
13:03:38Yardanico"(allocCount: 25018, deallocCount: 25017)"
13:04:17Yardanicoyeah seems like it doesn't dealloc this stackTrace field
13:04:45AraqClyybber: good question
13:05:20Araqso ...
13:05:41AraqTelegram tells me I can only use it until September the 1st unless I update my OS
13:05:46Yardanicowat
13:06:05Yardanicohuh, do they want to not support win7 anymore?
13:06:08Araqproblem is updating my OS (X) is impossible because my hard disk lacks the space for an update
13:06:12Yardanicooh osx
13:06:21Yardanicoah sorry you're on win10 right
13:06:37Yardanicothere are two Telegram apps for macOS - one is telegram desktop, other is "native" one
13:06:38Araqand I cannot attach an external disk either because OSX doesn't support NTFS
13:06:52Araqany solutions?
13:07:17Yardanicowhich telegram do you use?
13:07:29Yardanicothere's https://apps.apple.com/us/app/telegram/id747648890 which is the native telegram I was talking about
13:07:35Yardanico"Compatibility
13:07:35YardanicoOS X 10.11 or later, 64-bit processor"
13:08:16AraqI'll probably simply buy a new laptop tbh
13:08:57Araqdon't know a single feature I'll miss from mac. certainly not the broken keyboard and the lack of games
13:09:04Yardanicohehe
13:09:38FromDiscord<Rika> Perhaps the trackpad
13:10:11Araqah damn, will miss valgrind
13:10:30Araqmaybe the sanitizers have become good enough though
13:12:16Yardanico well if I try to run that leak example with clang's memory sanitizer (with orc and -d:useMalloc), it exits on "use of uninitialized value" in orc.nim
13:12:23Yardanicoin collectWhite
13:12:25Yardanico:D
13:12:39FromDiscord<dom96> valgrind works on Linux right?
13:12:43Yardaniconot on windows
13:12:52Yardanicoand 4raq doesn't like linux a lot :P
13:12:53federico3dom96: yes
13:13:04FromDiscord<dom96> Araq can use WSL
13:13:07Yardanicoah right
13:13:09Yardanicothat's a thing now
13:13:47FromDiscord<Clyybber> I doubt it works with valgrind though
13:13:52Yardanicoit does
13:14:01Yardanicowsl2 virtualises the whole kernel with HyperV
13:14:02FromDiscord<Clyybber> hardware watchpoints too?
13:14:21Yardaniconot sure about that :P
13:14:23AraqYardanico: do we use uninited data in collectWhite?
13:14:36YardanicoAraq: well clang errors on line 244 in orc.nim
13:14:43Yardanico"if t.color == colWhite and (t.rc and isCycleCandidate) == 0:"
13:15:55Oddmongeris it possible to have 0 padding with strformat ? Like {foo:03.2f} (which compiles but does not add zeros before)
13:15:56FromDiscord<Clyybber> gensymmed but untyped (as in no symbols but idents) doesn't really make sense does it?
13:16:00Yardanicomaybe the stack trace is wrong
13:16:48Oddmongerstrangely in the sample of strformat page, it seems to be the right way to do
13:17:19FromDiscord<Clyybber> Araq: Do we support such stuff? Gensymmed untyped idents?
13:17:27Oddmongerwell, never mind. > is better
13:18:05AraqClyybber: yeah
13:18:25Araqin fact, gensymed symbols usually start with "untyped" (sym.typ == nil)
13:18:43Araqas type checking is done after symbol lookup
13:19:36FromDiscord<Clyybber> Oh, yeah, I meant to say: Do we support gensymmed, non-symbol-lookuped idents
13:19:49FromDiscord<Clyybber> If that makes any sense :p
13:20:07Araqno, idents cannot be gensymed
13:20:13FromDiscord<Clyybber> Ok, good
13:20:43AraqYardanico: so what's the best test case that leaks?
13:20:54YardanicoAraq: the one I posted in the issue
13:21:00Yardanicoit's the one related to debug stack trace info
13:21:09Yardanicohttps://github.com/nim-lang/Nim/issues/15076#issuecomment-664382380
13:21:10disbotMemory leaks with async (closure iterators?) under ORC ; snippet at 12https://play.nim-lang.org/#ix=2snX
13:21:39Yardanicoif i rremove stack trace lines (the field and it's initialization) - there's basically no leak
13:22:12Yardanicoalso it only leaks with object inheritance, if you directly use FutureBase - it doesn't leak
13:24:03*hoijui quit (Ping timeout: 272 seconds)
13:25:56Yardanicoi tried removing one of the closure iterators (or even just the closure proc), but they seem to be needed
13:26:45Yardanicobut at least even now async leaks much, much less with orc (with -d:release or -d:danger)
13:28:13*pietroppeter joined #nim
13:28:34Yardanicowith 100mil iterations of the first snippet in the issue (the one with async macro) with orc and danger - "(allocCount: 500080010, deallocCount: 499960007)"
13:29:05Yardanicobtw, about getAllocStats - should allocCount and deallocCount always match for ARC, and always match for ORC after GC_fullCollect() ?
13:31:38Araqnot yet as we don't free the gDisp variable
13:31:50Yardanicooh
13:32:00YardanicoI mean for cases other than async :)
13:32:15Yardanicoand when there's no cycles (for arc)
13:32:34Araqyes but in general you need to beware that globals can keep things alive
13:32:45Yardanicoah right
13:33:18FromDiscord<dom96> what do these alloc/dealloc numbers look like for the default GC?
13:33:26Yardanicoit doesn't support them I think
13:34:49FromDiscord<dom96> hrm, would it be difficult to introduce? Might be useful to see if A) the default GC also leaks B) the globals are to blame.
13:35:42Araqdom96: we do support -d:nimTypeNames and listing the alive objects with the old GCs
13:35:59Araqand we know it's quite free of leaks
13:36:26FromDiscord<dom96> sure, I know, I used that to find some leaks myself
13:36:42Araqbut the numbers are never as precise as ORC because of the conservative stack tracing
13:37:01FromDiscord<dom96> would be nice to have the same alloc/dealloc numbers though
13:37:25Zevvdisruptek awake yet?
13:37:31Araqwell in theory the numbers should be the same, we don't elide allocations
13:37:39Araq(though we should...)
13:38:52YardanicoAraq: well for 100 thousand futures with refc getAllocStats() says "allocCount: 33"
13:38:58Yardanicoand deallocCount: 25
13:39:16Yardanicowhich is kinda wrong I think
13:39:42Araqmaybe it counts blocks requested from the OS
13:40:39Yardanicobtw will when defined(gcOrc): still be available in the future?
13:41:01Araqsure
13:42:32Yardanicoseems like the nimyaml creator is okay with supporting orc in the future (when it doesn't leak for sure), and they said they'll look into removing the "source" pointer used in the lexer
13:42:33Yardanicohttps://github.com/flyx/NimYAML/issues/85
13:42:34disbotNimYAML compatibility with ARC/ORC.
13:43:34FromDiscord<dom96> Why don't we finally introduce a nice ``gc`` enum instead of ``gcOrc`` and whatever else?
13:43:44FromDiscord<Clyybber> we do have something like that
13:43:50FromDiscord<Clyybber> but its not an enum rn afaik
13:44:05FromDiscord<Clyybber> but a string
13:52:07Araqwow
13:52:16Araqif I comment out
13:52:23Araq #result.stackTrace = getStackTraceEntries()
13:52:34Araqthe deallocation count is off by one only
13:52:44Yardanicoexactly
13:52:47Yardanico:P
13:52:48FromDiscord<Clyybber> so its stackTraces not getting freed
13:52:55FromDiscord<dom96> nice
13:53:02FromDiscord<Clyybber> and if you comment that out, only the last one is not getting freed
13:53:15YardanicoI said the thing about stack trace before btw :P
13:53:29leorize[m]is @euantorano here?
13:53:46leorize[m]I'm not sure what's their irc handle
13:54:00Araqand cursor inference makes ORC so much faster ...
13:54:10Araq(in theory)
13:54:19Araqit's a pure beauty
13:54:45Yardanicodid you look into the cursorifier issue I reported yet? although it's still not truly minimized (depends on lists module)
13:54:49leorizeeuantor: are you euantorano on github?
13:55:12AraqYardanico: no, that's scheduled as my next bugfix
13:55:15Yardanicoah nice :D
13:55:39FromDiscord<dom96> does ARC work wellish with JS backend (yet)?
13:55:51leorizearc doesn't exist for js :P
13:56:03leorizethe entire gc switch is now ignored on js fwiw
13:56:15Yardanico@dom96 it wouldn't make sense
13:56:21Yardanicoyou can't control memory in JS really
13:56:32Araqyou can, ArrayBuffer etc
13:56:34*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:56:35Yardanicooh
13:56:46Yardanicowould that be faster than using the native JS's gc though?
13:56:53leorizeobviously not :P
13:57:07FromDiscord<dom96> What I'm trying to get at is: are the ARC improvements going to enable less NimCopy's?
13:57:15FromDiscord<dom96> or rather, have they already?
13:57:20leorizealready
13:57:29FromDiscord<dom96> I recall Araq saying that they would
13:57:35Araqyeah
13:57:43Araqbut not yet implemented
13:57:54leorizea side effect of arc is that destructors and move semantics are developed further and optimized :P
13:57:59Araqmaybe there is a fortunate interaction that I'm unaware of
13:58:19FromDiscord<dom96> leorize: `:P :P :P :P :P`
13:58:26Araqleorize: the JS backend doesn't take advantage of moves though
13:58:27Yardanico:P is nice!
13:58:40FromDiscord<Clyybber> :p
13:59:16leorize[m]it's a habit of mine to mask my poor english to avoid offending people xd
13:59:33Yardanicooh right about the ircord bridge - a few days ago I added irc formatting -> markdown and markdown -> irc, but didn't test it extensively though
13:59:41Yardanicosince I have nim irc logs parsed, maybe I can try to test it on that
13:59:47*jjido joined #nim
14:00:04FromDiscord<dom96> Your English is indistinguishable from someone that's a native speaker IMO
14:00:24Yardanicoyeah, leorize[m]'s english is pretty nice
14:00:29Yardanicomine is kinda worse :P
14:00:59Araqproblem with ArrayBuffers is DOM interop
14:01:15Araqotherwise I would have tried them for Karax back then
14:01:17FromDiscord<dom96> Also I actually do use ArrayBuffers in my game
14:01:42*vicfred quit (Quit: Leaving)
14:02:02*vicfred joined #nim
14:02:05FromDiscord<dom96> Otherwise serializing the data structures into thrift binary would have been a bigger pain than it was
14:02:41leorize[m]I'm terrible at figuring out the tone though, so my messages might come across as offensive
14:02:45leorize[m]but thanks for the compliment :)
14:03:34FromDiscord<dom96> Maybe it's just me, but I'm starting to associate the use `:P` with a negative tone.
14:03:41FromDiscord<dom96> (edit) 'Maybe it's just me, but I'm starting to associate the use ... `:P`' => 'Maybe it's just me, but I'm starting to associate the useof'
14:03:43FromDiscord<Clyybber> the trick is to actively spout bad english so when you accidentally insult someone, they'll know its because of your bad english
14:04:04Yardanicothanks
14:04:08Yardanicoi'll remember that
14:04:18Yardanico+
14:04:31FromGitter<Lecale> I think it depends on the size of the toungue :p or :P
14:04:32Yardanicosory diden't men to sent "+"
14:04:48FromDiscord<Clyybber> lol, its the opposite for me, I use `:p` to turn something that could be interpreted in a negative way into a tongue-in-cheek, nicey way :p
14:05:20FromDiscord<Rika> I think I'm slowly transitioning from :P to xd
14:05:31Yardanicothat's worse
14:05:32Yardanicoimo
14:05:47Yardanicoand then you'll also start using "bruh"
14:05:50leorize@dom96 #15093 should address the getAppFilename issue by documenting it
14:05:51disbothttps://github.com/nim-lang/Nim/pull/15093 -- 3os: documents potential security implications of getAppFilename
14:06:13FromDiscord<dom96> Obviously need to transition to :Þ
14:06:49Yardanicosure :P
14:06:52Yardanicowhat about :)
14:07:05FromDiscord<Clyybber> what about :))))))))))
14:07:17Yardanicobut yes, I think I use ":P" so it doesn't sound harsh or rude too
14:07:24FromDiscord<Clyybber> fits the honeybadger
14:07:25leorize`:)` is context-dependent, the facebook version of that emoji looks like you're dead inside
14:07:38FromDiscord<Clyybber> appropriate emoji, thanks
14:07:40Yardanicowell it's true
14:07:49FromDiscord<dom96> It doesn't matter what emote you use, if what you're saying sounds rude to someone then an emote won't help. It'll just cause an association between that emote and rudeness.
14:07:59FromDiscord<Recruit_main707> 🙂 discord one also looks pretty dead
14:08:00FromDiscord<Clyybber> fuck you :)
14:08:08FromDiscord<Clyybber> :p
14:08:14FromDiscord<Rika> Yardanico: okay.
14:09:19Yardanico@Clyybber fuck you /s :) :P :D xd bruh
14:09:32FromGitter<Lecale> An I know nothing about compilation question - is there an obvious solution to the issue I raised here https://github.com/halonium/halonium/issues/1 , short of wearing a tin foil hat :p :p xd stfuartfm
14:09:33disbotCompilation Error
14:09:49FromDiscord<Clyybber> @Yardanico reported to the discord server admins
14:09:49Yardanicohrm
14:09:52FromDiscord<dom96> What I'm guessing happens is: you write a message that you know may be construed as rude, so you throw in a `:P`. The person that reads it can see that it's rude and the `:P` loses it's cheeky interpretation.
14:11:05Yardanico@Lecale I think you need libzip
14:11:16Yardanicobut I'm not sure how zip package imports libzip
14:11:25leorizethey might be missing zlib, not sure
14:11:55FromDiscord<Clyybber> @dom96 just out of curiousity, did you think that about this message https://discordapp.com/channels/371759389889003530/371759389889003532/736940642336374816 too ?
14:12:17Yardanicobtw, as I said yesterday - I published #nim message sqlite db
14:12:29Yardanicoin https://github.com/timotheecour/Nim/issues/126#issuecomment-663849153
14:12:32disbotneed a way to access raw db for gitter, irc, forum, enables more powerful search on local clients via raw db access ; snippet at 12https://play.nim-lang.org/#ix=2srB
14:12:42Yardanicowe really need a DB for the forum too
14:12:50Yardanicoit contains a lot of useful info which can be kinda hard to find
14:12:53AraqYardanico: if I remove the [T] it also works
14:13:01YardanicoAraq: yes I know :P
14:13:03Araqso it's not inheritance
14:13:07Yardanicooh
14:13:10Araqit's generic inheritance
14:13:21*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:13:34FromGitter<Lecale> cool
14:13:36Yardanicowell I know that it works when removing [T], maybe I should've left that in the comments
14:13:49*fredrikhr quit (Read error: Connection reset by peer)
14:14:26*fredrikhr joined #nim
14:14:33FromDiscord<dom96> @Clyybber I wouldn't call it rude, but it definitely annoyed me at the time.
14:15:06FromDiscord<Clyybber> yeah, thats why I added the :p, because I thought it might be annoying
14:15:13FromDiscord<dom96> lol
14:15:14FromDiscord<Clyybber> didn't work :p
14:15:18Yardanicothere are only 23k messages with :P in #nim
14:15:29FromDiscord<dom96> and hence my hatred for `:P` grew
14:15:32Yardanicoout of ~1238755 total
14:15:33FromDiscord<Clyybber> lol
14:15:44*mbuchel joined #nim
14:15:53Yardanicohttps://i.imgur.com/Ho9O4fx.png
14:16:04mbuchelis there a way to have a circular reference?
14:16:06mbuchelin nim
14:16:07Yardanicoyes
14:16:19mbucheli mean recursive import
14:16:26Yardanicowell it's partially possible
14:16:36mbuchelhow would i do it?
14:16:43FromDiscord<dom96> Yardanico: You should see how many of those started showing up recently 😄
14:16:50YardanicoI know :(
14:17:08Yardanicothere are 714 messages containing 🙂
14:17:10FromDiscord<Clyybber> lol :(
14:17:14leorize[m]mbuchel: you don't, the "partial" way is buggy at best and should be avoided
14:17:20Yardanicois it?
14:17:24FromDiscord<Clyybber> its not buggy
14:17:26YardanicoI think 4raq said it actually works pretty well
14:17:31Yardanicoif you actually use it properly
14:17:33leorize[m]currently the best we can do is to bundle everything into one file
14:17:49Yardanicooh yeah I also found some nice troll messages in the DB
14:18:00FromDiscord<lqdev> mbuchel: see the example here https://nim-lang.org/docs/manual.html#modules
14:18:08mbucheli am really against bundling everything inside one file, especially with the protocol i am working on currently
14:18:10FromDiscord<dom96> Monorepo? Let's go a step further and create monofiles 😄
14:18:12leorize[m]if `a <-> b` and you setup `b` so that `import a` works, `import b` explodes.
14:18:29Yardaniconimx uses circular imports btw
14:18:42FromDiscord<dom96> mbuchel: you're best off using the utils/types pattern in my experience
14:18:52mbuchelyep that is what i am doing
14:19:03mbuchelbut the protocol i am working on was very poorly designed
14:19:08mbucheland has recursive imports
14:19:18Yardanicodoes that matter really?
14:19:27Yardanicoyou can always kinda restructure it
14:19:30leorize[m]why does recursive import have anything to do with a protocol?
14:19:33mbuchelyou have a file ei, which requires pyld, but pyld requires ei
14:19:49mbucheli am trying to match the same as the xsd file they provide for the protocol
14:20:07mbuchelso it would be easier to expand in the future
14:20:55Yardanicoenglish language be like https://i.imgur.com/7xWUxyk.png
14:20:56mbuchelalso thanks for that modules section
14:21:04mbuchelthere are some things from there i can use
14:21:24Yardanicooh no there's dom using :P in that screenshotr
14:21:25Yardanicobusted
14:21:45leorizelol
14:22:05Yardanicouhh guess my english was influenced a bit by this chat :P
14:22:11Yardanicohttps://i.imgur.com/UpQcNFj.png
14:23:08FromDiscord<dom96> Yardanico: fake news
14:23:09FromDiscord<Clyybber> you turned the so yeah into well yes
14:23:17Yardanicowell yes, well yes
14:23:41FromDiscord<dom96> I like how most of what I write ends with a period.
14:23:53YardanicoI wonder what can happen if I use markov chains on this DB
14:23:56Yardanicohttps://i.imgur.com/kFMdpWd.png
14:23:59FromDiscord<dom96> But yeah, I did use `:P` in the past
14:25:00supakeen:p
14:25:22Yardanico:) has been used more times than :P in total
14:25:27Yardanicoonly 1k message difference though
14:25:30supakeendom96: what library did you rock for the star game or something by yourself?
14:25:59FromDiscord<dom96> supakeen: I wrote one: gamelight
14:26:11FromDiscord<Clyybber> Araq: This doesn't seem to be needed anymore https://github.com/nim-lang/Nim/blob/devel/compiler/semexprs.nim#L1206 (checked with the tests), is it ok to remove?
14:26:29FromDiscord<dom96> Ugh, I thought I could disable link previews in Discord
14:26:34Yardanicoyou can't :(
14:26:42FromDiscord<dom96> but it also disables them when someone pastes image links
14:26:53FromDiscord<dom96> pretty sure that's a bug because it displays a white space
14:26:58FromDiscord<dom96> and not the image link itself
14:27:20Araqclyybber, yeah if the CI says everything is fine it's safe to be removed
14:27:25FromDiscord<dom96> Maybe it's time I transition to IRC again
14:27:26supakeenAh I see, I've been toying with `nico` :)
14:28:11FromDiscord<dom96> supakeen: yeah, nico is cool but has some specific limitations AFAIK
14:28:20FromDiscord<dom96> like I don't think I'd be able to build Stardust using it
14:28:26Yardanicowell that's what nico was made for
14:28:28Yardanicosomething like pico8
14:28:37Yardanicocreate pixel games easily
14:28:42FromDiscord<dom96> yeah
14:28:46supakeenYea I'm currently scratching my game-building itch for a dungeon crawler with nico and so far i'm ok.
14:28:55supakeenLove the simplistic pico8 api indeed.
14:29:47FromDiscord<dom96> Yeah, it's good to have restrictions. They help creativity especially with games.
14:29:48Yardanicowell I have a small game-buildting itch, but either for an osu!mania clone or an RTS (which is much harder than an osu!mania clone)
14:30:10FromDiscord<dom96> Yardanico: just gotta c2nim 0 A.D. 😄
14:30:14Yardanicolol
14:30:25Yardanicomaybe Zero-K instead? :)
14:30:35supakeenRTS sounds cool too.
14:30:42YardanicoThere's an open source Spring engine for RTS
14:30:45Yardanicoand Zero-K - https://github.com/ZeroK-RTS/Zero-K
14:30:46supakeenAny specific ideas about it if you just think freely without being realistic? :)
14:31:20Araqno matter what game you program
14:31:29Araqif you make it "text based" I'm gonna kill you
14:31:33Yardanicononono
14:31:37AraqI hate this terminal bullshit
14:31:46YardanicoI was born after the text-based games era :)
14:31:47FromDiscord<Clyybber> you will kill *me*
14:31:48Araqeven DOS had better stuff
14:32:05FromDiscord<dom96> nethack ftw
14:32:10supakeennimhack
14:32:18FromDiscord<Clyybber> I don't know why, but theres something that intrigues me about text based games
14:32:36FromDiscord<dom96> now can we create a multiplayer nethack hmmmm
14:32:39supakeenwhat if i pretend to draw a terminal with sdl?
14:32:46FromDiscord<Clyybber> now that, that is shit
14:32:48Yardanicothere's an imgui-like lib for terminal btw
14:32:49FromDiscord<Clyybber> that I hate
14:33:07Araqsupakeen: that's the start of every good game engine with hot code reloading
14:33:12Araq:D
14:33:23supakeeni think that's how dwarf fortress does it nowadays
14:33:31supakeenthough perhaps they still have different backends :)
14:33:33FromDiscord<Clyybber> dwarf fortress still has TEXT_MODE
14:33:52Araqpress tab and get quake's console. and even that one is better than iTerm
14:33:53FromDiscord<Clyybber> but with the steam release it will get a nice graphical mode
14:34:11Araq(Nah, iTerm is ok)
14:35:07supakeenIs that the one that does DNS lookups for all the text you select?
14:35:48supakeenAh yes, and the one that had code execution if you look at the wrong bytes (e.g. a logfile).
14:36:18supakeenI will not understand why that terminal is so complex at least they fixed column redraws on it.
14:40:18euantorleorize: Apologies for the delay; yes I'm `euantorano` on GitHub :)
14:40:26Yardanicoi have to agree, some people try to add some stupid features to terminal emulators
14:40:31Yardanicolike why would you need images in the terminal
14:40:33Yardanicouse a proper GUI then
14:40:46Yardanico(looking at people who use it exclusively for neofetch)
14:40:57FromDiscord<Rika> :BlobSweatAnimated:
14:41:19leorizeeuantor: can you help me figure out why stdlib/tssl in #15066 just exit with error code 1 on freebsd? thanks :)
14:41:20disbothttps://github.com/nim-lang/Nim/pull/15066 -- 3asyncnet, net: don't attempt SSL_shutdown if a fatal error occurred
14:41:30FromDiscord<Rika> Ngl I was considering using a term emu for that feature
14:42:23euantorleorize: I can certainly take a look, though I'm at work right now. I'll try have a quick look now and might have to get back to you later
14:45:16*FromDiscord quit (Remote host closed the connection)
14:45:31*FromDiscord joined #nim
14:50:13FromDiscord<exelotl> about text-based games... someone released a beautiful looking ascii tileset for my favourite roguelike https://github.com/PropFeds/terminal-blues
14:50:37FromDiscord<exelotl> I find it really hard to play though
14:50:48FromDiscord<exelotl> i've been playing with the default graphical tiles for years
14:52:12FromDiscord<exelotl> now I have to remember that a yellow "b" is a fire beetle, a pink "b" is a grid bug
14:59:12FromDiscord<Varriount> dom96: It's a shame there are no when-case statements. They would be helpful (at least internally for the compiler/standard library)
15:00:02FromDiscord<Varriount> exelotl: What is POWDER like? Hardcore and intricate, or more forgiving?
15:00:17solitudesfits not forgiving
15:00:43solitudesfits like a less complicated nethack, i suppose
15:00:45FromDiscord<Rika> well its a roguelike
15:02:40disruptek!last zevv
15:02:40disbotZevv spoke in 12#nim 85 minutes ago 12https://irclogs.nim-lang.org/27-07-2020.html#13:37:25
15:02:42disruptekso.
15:02:54Zevvso.
15:03:02disruptekdo we write ast that is correct or ast that works?
15:03:04Zevvthis town is too small for the both of us
15:03:08disrupteklol
15:03:15disruptekg'day zevv
15:03:20Zevvmoin disruptek
15:03:22Zevvslept well?
15:03:35disruptektoo many bugs up here.
15:03:51Zevvknow the feeling
15:04:01*audiofile joined #nim
15:04:09disruptekTIL nnkConv
15:04:21Zevvwhat is that stuff even
15:04:35Zevvyou just put in a dotExpr and hoped that made sense, right
15:04:53disruptekno, it was nnkCall.
15:05:13Araqusing nnkCall to construct type conversion is correct btw
15:05:17disruptekbut, nnkConv doesn't seem to work.
15:05:24disruptekhence my query.
15:05:28disruptekdo we write ast that is correct or ast that works?
15:05:45AraqnnkConv isn't correct, it's part of Nim's black hole
15:05:47Zevvlet me draw a little venn diagram
15:05:53Araqwhich is sem'checked ASTs
15:06:16Zevvso, what would you recommend
15:06:59disruptekhe's going to recommend typed.
15:07:11disruptekbut we shouldn't have to go there yet.
15:07:25Araqconstruct untyped ASTs
15:07:40disruptekl0rd knows i'm trying.
15:09:05*altarrel joined #nim
15:10:25*maier quit (Ping timeout: 240 seconds)
15:10:34Zevvso, we could go with the cast, but only if we cna properly isolate the underlying problem of the conversion going wrong and file a proper nim issue for that
15:10:41Zevvbecause I would really hate to have the cast in cps
15:10:53ZevvI feep cps might end op being provable somehow, and with a cast you throw that away
15:11:03disruptekit's already proven.
15:11:16disruptekanyway, i don't care.
15:11:35Zevvcast away, then
15:11:37disrupteki'm trying to develop semantics. the machinery isn't important to me.
15:12:24disruptekoh, the root cast /was/ a dotexpr
15:12:39Zevvright
15:12:57Zevvnot sure if nim understands your intention there.
15:13:04disruptekthe child cast /is/ a call.
15:13:11FromGitter<alehander92> why cast
15:13:12Zevvshould also be nnkConv
15:13:15ZevvWHY CAST?!
15:13:17FromGitter<alehander92> why is it such a problem
15:13:18ZevvWHYYYYYYY
15:13:19disruptekAIIEEEE!
15:13:19FromGitter<alehander92> to cast
15:13:22FromGitter<alehander92> i cast often
15:13:25FromGitter<alehander92> like i get it
15:13:27Zevvyou cast, you fail
15:13:29disruptekOMGOMGOMGOMG
15:13:32FromGitter<alehander92> but sometimes he compiler should trust me
15:13:39FromGitter<alehander92> i mean i am a human
15:13:43Yardanicobut why cast
15:13:45Yardanicoif it's not needed
15:13:46FromGitter<alehander92> AND I NEED TO BE LOVED
15:13:52disrupteklook, it's like when i used to teach esl to spanish kids in nyc.
15:14:03Yardanico==============================
15:14:08disruptekthey were always so confused about the difference between `right` and `correct`.
15:14:12FromGitter<alehander92> can i interview yourself
15:14:21FromDiscord<dom96> plz dont cast bois
15:14:28Zevvscrew you guys, I'm going home
15:14:34FromGitter<alehander92> but how can you have AST without CAST
15:14:38disrupteki'd tell them, listen, you can stick a banana up your ass -- it fits `right`, but it's not `correct`.
15:14:51Zevvalehander92: are you pulling legs?
15:15:09Zevvit's just a tree of sum types. Where is the casting?
15:15:17FromGitter<alehander92> yeah i have no idea
15:15:24FromGitter<alehander92> i am just trying to make puns
15:15:32Zevvooooh I see it C-AST
15:15:33Zevvdude
15:15:41Zevvit's actually pretty good. Too bad I let you explain it
15:15:47FromGitter<alehander92> it's basic
15:15:49FromGitter<alehander92> but thank you
15:15:54Zevv:slow clap:
15:16:08FromGitter<alehander92> disruptek but what is correct
15:16:10FromGitter<alehander92> but not right
15:16:17FromGitter<alehander92> is it a correction facility
15:16:20Zevvanway disruptek: nnkConv does not solve it for you, so there might be a hole in nnConv - is that a safe conclusion of this adventure>?
15:16:40FromGitter<alehander92> because i think they might have imperfect work there
15:16:49disruptekZevv: not really.
15:17:23disruptekper araq nnkConv is the domain of typed ast and not our baliwick.
15:17:39disruptekbailiwick, too.
15:18:37disrupteki thought my solution to shadowing proc params was pretty cute.
15:19:25Zevvoh i missed that, tell it to me
15:19:41disruptekjust put the body in a block:
15:20:34disrupteki'm thinking that we can use the block to do something interesting.
15:20:42disrupteklike exception handling.
15:21:34Zevvooh right, why not
15:21:51disruptekremember that we know the return type and we can stuff the exception in on the way out.
15:21:58ZevvI spent a few minutes this afternoon to build some primitives like iterators and coroutines
15:22:08disrupteksome day it will generate a nim compiler error, of course.
15:22:29disruptekwhere is your commit?
15:22:46Zevvnot there yet
15:22:56*Zevv is now known as Zevv[m]
15:23:21*disruptek is now known as disruptek[o]
15:23:39*Yardanico is now known as yardanico[ok]
15:23:51yardanico[ok]ok
15:24:11*yardanico[ok] is now known as Yardanico
15:24:58disruptek[o]wtf someone stole my asd nick.
15:25:01Yardanicowtf
15:25:20disruptek[o]that's bs
15:27:06*vicfred quit (Quit: Leaving)
15:27:20*disruptek[o] is now known as disruptek
15:27:22*disruptek growls.
15:30:40*hoijui joined #nim
15:35:10Zevv[m]disruptek: https://github.com/disruptek/cps/blob/master/stash/iterator.nim
15:35:15Zevv[m]pretty basic stuff
15:38:56Zevv[m]ore reload, if you like Option[]
15:39:04disrupteklooks good to me.
15:39:25Zevv[m]we need more trampolining then strictly necessary, maybe
15:39:28Zevv[m]but I don't care for now
15:39:36Yardanicobtw, why you still need to specify the type ?
15:39:43Yardanicohttps://github.com/disruptek/cps/blob/master/stash/iterator.nim#L29 here for example
15:39:45Yardanicowhat's the reason
15:39:51disruptekthe ast is untyped.
15:39:53Yardanicoso?
15:40:00disruptekwe cannot infer the type.
15:40:08disruptekwe need the type in order to construct the continuation.
15:40:09Yardanicojust use auto :P
15:40:19disruptekhard to define objects with auto.
15:40:55disruptekhmm, i wonder if we could use a fuckton of generics, though.
15:41:07Yardanicobut i hope that this limitation will eventually be removed, right? :P
15:41:10Yardanicocurrent way looks kinda ugly
15:41:24disrupteki'm not bothered.
15:41:24Yardanicoalso do you really need a while loop in each proc which uses the cps macro?
15:41:28disruptekno.
15:43:06Zevv[m]so, there is really no way to punch your code through two macros, right? First do an untyped pass, then a typed one after that
15:43:27Zevv[m]Yardanico: no, but that's one of the reasons you'd *want* to do this
15:43:29disrupteki haven't done it, but someone told me it was a thing.
15:43:56Zevv[m]Yardanico: but do note how cool this is: the concept of 'yield' and 'resume' is all in that file.
15:44:00Zevv[m]there is no magic
15:44:50disruptekit's a big deal. eventually, people will understand.
15:45:01disruptekit'll take time. people need to use this stuff.
15:45:04Zevv[m]it's like monads
15:45:48*rockcavera joined #nim
15:45:50disruptekit's like mescaline, but monads works, too.
15:46:24Zevv[m]disruptek: I'd like to talk to you
15:46:25Zevv[m]about rvalues
15:46:28Zevv[m]or is it too soon for that
15:46:31Zevv[m]in our relationship
15:46:48Yardanicoabout types
15:46:51YardanicoI know it's a bit of a hack
15:46:55disruptekwe should think about this generics idea first.
15:46:56Yardanicobut what about using typeof
15:47:15Yardanicovar a: typeof(expression) = expression
15:47:16disruptekit's not possible because the types need to be defined before they are inferred.
15:47:19Yardanicovar a: typeof(5) = 5
15:47:42Zevv[m]var a = doThis()
15:47:52Zevv[m]var a: typeof(doThis()) = doThis() ?
15:48:03Yardanicoyes
15:48:53Araqthis is so weird
15:49:00Yardanicothe leak? :P
15:49:10Araq Future[T] = ref object of RootObj # about 30_000 allocs
15:49:21Araq Future[T] = ref object # about 25_000 allocs!
15:49:22Yardanico:DD
15:49:37Araqbut it's inheriting from nothing, what causes 5000 more allocations?
15:49:54disruptekmethod names?
15:49:55FromDiscord<dom96> wat
15:50:00FromDiscord<dom96> it's inheriting from RootObj?
15:50:06YardanicoFutureBase does, yes
15:50:09FromDiscord<dom96> That's not nothing
15:50:25Yardanicodisruptek: nim async doesn't use methods even if it uses inheritance
15:50:49disruptekthe names are constants but we dispatch dynamically.
15:51:11Yardanicoah maybe the isObj thing you mean?
15:51:28FromDiscord<Shucks> ❤️
15:51:32disrupteki dunno, it's mere intuition.
15:53:15Zevv[m]so disruptek, what's next on the list
15:53:20disruptekgenerics.
15:53:56Araqdom96: RootObj is an empty object, inheriting from it doesn't cause more allocations
15:54:05Zevv[m]disruptek: how generics, tell me
15:54:10Zevv[m]what do you need to genericize
15:54:24Zevv[m]because I don't think I needed this yet?
15:54:26disrupteknoroutine field values.
15:54:33Zevv[m]hmmm
15:54:58Zevv[m]is that something we need *now*
15:55:03Zevv[m]and please don't call'em that
15:55:14disrupteklol
15:57:03Zevv[m]yarn. floss. twine.
15:57:04Zevv[m]pick one
15:57:31FromDiscord<dom96> Araq: and yet it seems it does? 🙂
15:57:35Zevv[m]I think generics can wait. It's cool and all but will complicate your macros and will not bring essential stuff on the table now
15:58:01disruptekit brings type inference, which isn't nothing.
15:58:19Zevv[m]type inference for what parts?
15:59:06disrupteknoroutine field values.
15:59:28Zevv[m]yeah but not for stuff on the environment
15:59:32Zevv[m]which is more painful
15:59:38disruptekyes, stuff on the environment.
15:59:44Zevv[m]mo way
15:59:47Zevv[m]var i = 3
15:59:50Zevv[m]'give i a type'
15:59:52Zevv[m]you won't solve that
16:00:24Zevv[m]you want this? http://ix.io/2ss2
16:01:21Araqdom96, yeah, it's not explainable
16:01:32Yardanicowait you can't find the cause of it?
16:01:39Yardanicoi mean not yet :P
16:01:47*audiofile quit (Quit: Default Quit Message)
16:02:06disrupteki will solve that.
16:02:25disruptekCont[typeof(rando)](fn: ..., rando: rando)
16:02:26Yardaniconow where's our color change on github
16:02:29Yardanicoa month passed
16:02:40Zevv[m]disruptek: sure, nice. but you wont solve local variables to get type by magic
16:02:56disruptekthe local vars don't need a type; it's inferred.
16:03:18Zevv[m]no way.
16:03:22disruptekvar rando = env_3(locals_3).rando
16:03:22Zevv[m]surprise me
16:03:36disruptekyard gave us the hint.
16:03:57Zevv[m]no that was wrong
16:04:04Zevv[m]I just tried, doesnt compute
16:04:08disruptekwhy don't you make us `:=`() mr. go lover?
16:04:16Zevv[m]bah
16:04:31Zevv[m]neverr
16:04:57disruptekyou tried what?
16:05:17Zevv[m]var a: typeof(foo()) = foo()
16:05:53disrupteki dunno what that is.
16:05:55Zevv[m]var a: typeof(5) = 5 might
16:06:04Yardanico!eval import strutils; var a: typeof("a b".split()) = "a b".split(); echo a
16:06:04disrupteki'm talking about something different, i guess.
16:06:06NimBotCompile failed: /usercode/in.nim(1, 54) Error: type mismatch: got <seq[string]> but expected 'string'
16:06:27disruptekholdon, i will create an example.
16:06:34Zevv[m]yes sir please sir
16:06:47Yardanicodisruptek: we're talking about the fact that you have to resort to specifying the type
16:06:50Yardanicolike in that zevv's exampole
16:06:52Yardanicoexample*
16:06:55Yardanicowhich is IMO quite ugly :)
16:06:57disrupteki know, chucklehead.
16:07:12disrupteki mean, yardanico.
16:07:24Zevv[m]dude
16:07:26Zevv[m]rude
16:07:37Zevv[m]I will fry my fries and eat them not. bbl
16:07:45Zevv[m]s/not/now/
16:07:49disruptekhttp://ix.io/2ss4/nim
16:08:22disruptektypeless type inference.
16:09:51*FromDiscord quit (Remote host closed the connection)
16:10:08*FromDiscord joined #nim
16:13:42FromDiscord<jcs224> I have a question about convention. If I have a `proc` called `readLine`, which is already in the standard library, what would be the "proper" way to avoid a namespace collision with that existing function? There are quite a lot of keywords in Nim. Coming from JavaScript.
16:14:02Yardanicowell, does your readLine proc have the same signature as the one in stdlib?
16:14:43Yardanicoif signatures are different, there wouldn't be any collisions
16:14:54FromDiscord<jcs224> Yeah, it takes a `Socket` as the first argument, same as the stdlib one. That's the only argument.
16:14:57Yardanicoif there are collisions, you can always specify the module name before the identifier
16:15:04FromDiscord<dom96> You don't have to do anything, your `readLine` will already be in a different module and therefore different namespace
16:15:23disruptekjust don't import the stdlib version.
16:15:26Yardanicolol
16:16:29FromDiscord<jcs224> Ok thanks. I tried just naming it `readLine` and it works fine. I have to get used to the automatic nature of importing, importing in JS and PHP is much more explicit. I've used Python but very little.
16:17:18Yardanicoyou can always use the python way of importing but it's not really needed most of the time :)
16:19:56FromDiscord<jcs224> and thanks for the super-prompt responses. Loving this language so far!
16:24:21disruptekleorize: we're missing half the nightlies for devel last couple nights...?
16:24:53leorizedisruptek: it's a bug caused by fusion, only fixed today
16:24:59disruptekcool.
16:25:12disrupteki'm loving this new fusion thing.
16:25:15disruptekreally great.
16:25:47disruptekwhat else can i do to help? 😉
16:27:58euantorleorize: I've had a quick look and posted a comment on the PR. Looks like the process gets a `SIGSEV`
16:28:57*vicfred joined #nim
16:29:34leorizethanks for looking
16:29:45leorizeseems to be a bug with threads
16:40:31*waleee-cl quit (Quit: Connection closed for inactivity)
16:41:48Zevv[m]whats fusion
16:42:18FromDiscord<dom96> (bad answers only)
16:43:10disruptekan innovation to shorten ci runs.
16:45:45bungold problem, how I test unittest ?
16:46:27Yardanicojust test it ?
16:46:33Yardanicoexpected output
16:47:10Yardanicosee e.g. https://github.com/nim-lang/Nim/blob/devel/tests/stdlib/tunittest.nim
16:47:58bungoh, that's easy, so I just copy paste my console outputs
16:51:25bunghmm, there's file name line column
16:51:29Yardanicoyes
16:54:40bunghow I hanlde the line column things ? hard code will make it hard to change
16:55:09Yardanicowell don't handle it
16:55:21Yardanicojust insert it in the test, and then tune so the output is the same
16:57:28bungoh, basically just change some line number ,that's ok
16:58:34*superbia1 joined #nim
16:58:39*someunknownuser joined #nim
16:59:37someunknownuserHello
16:59:43Zevv[m]Hello
17:00:08someunknownuserdoes anyone know why osproc's hasData proc blocks until data is available?
17:00:23someunknownuser(at least on linux)
17:00:30*WilhelmVonWeiner joined #nim
17:00:45*superbia quit (Ping timeout: 240 seconds)
17:01:22someunknownuserIt looks like it calls select internally, but passes nil for the timeout argument, which results in it blocking until data becomes available.
17:01:28FromDiscord<dom96> Wow. Julia is doing an AMA on the main IAmA subreddit https://reddit.com/r/IAmA/comments/hyva5n/we_are_the_creators_of_the_julia_programming/
17:01:46*pangey quit (Ping timeout: 256 seconds)
17:01:58disrupteksomeunknownuser: sounds like a bug.
17:02:58someunknownusercurrently the behavior suggests that the proc should be named/called waitData (or something similar) instead.
17:03:13*pangey joined #nim
17:03:30Zevv[m]ej disruptek
17:03:45someunknownuserThe bool return values becomes basically useless, since obviously data is available after it waited for it to become available xD
17:04:08Zevv[m]we now have 'cps foo()' where foo is `proc foo(c: MyCont, ...): MyCont` right. CPS is a magic keyword
17:04:23disruptekhai
17:04:26Zevv[m]what if we make cps an implicit variable in cps functions which is just the current cont
17:04:33Zevv[m]then we do `cps.foo()`
17:04:39Zevv[m]and there is less magic.
17:04:52disruptekjesus it almost makes sense.
17:05:32Zevv[m]the good thing is that the cps closure is available in the .cps. proc. But the bad thing is that the cps closure is available in the .cps. proc.
17:05:37disruptekwhy make it implicit, though? we'll just use cps as our locals.
17:06:01Zevv[m]yeah, but the user does not declare 'cps' somewhere, or do we take it a argument #1
17:06:04Zevv[m]in .cps. procs
17:06:17disruptekwe rewrite them.
17:06:27disruptekit solves the problem really elegantly.
17:06:32Zevv[m]yeah but where does the ident "cps" come in, where is it declared?
17:06:34disrupteksee, i knew there was a reason i kept you around.
17:06:37Zevv[m]Write me an example of how it would look
17:06:53Zevv[m]Well, I have acres to sniff, but if you put me outside I just bark
17:07:06*maier joined #nim
17:07:13disruptek`proc after_17860210(locals_17860216: Cont): Cont` turns into `proc after_17860210(cps: Cont): Cont`
17:07:22Zevv[m]yeah, right, but 'cps' is implicit for the user
17:07:32Zevv[m]You don't see where `cps` is declared
17:07:36disruptekcorrect.
17:07:40Zevv[m]right, that's what I mean
17:07:49disruptekyou want to make it explicit?
17:07:56Zevv[m]not sure. What does it add or solve?
17:08:11Zevv[m]The good thing is that the state is available from within your .cps. procs, if you like that kind of thing
17:08:28Zevv[m]but I'm not sure if that's opening pandoras box
17:08:31Zevv[m]'
17:08:37disrupteki agree, it's a little creepy.
17:09:12Zevv[m]But then again. Imagine our Big Best eventqueue, which will eventualle become the default in the stdlib, is a derivable type
17:09:28Zevv[m]you can just make your own "Foo as EventQueue"
17:09:31Zevv[m]put stuff in it
17:09:33Zevv[m]and have it there
17:09:40Zevv[m]it's powerful, but maybe a bit too
17:10:00Zevv[m]All the parent stuff is hidden because not exported, but your stuff is
17:10:41disrupteki mean, it's not a problem. you have that power anyway -- just call `cps myproc()` and you'll get the continuation. just, not in the same scope.
17:10:52Zevv[m]right
17:10:59disruptekonce we give you cps, we don't care what you do with it.
17:11:04Zevv[m]it's Nim, right
17:11:10disruptekpretty sure, yes.
17:11:11Zevv[m]I'll take the red one
17:11:42Zevv[m]I do like explicit over implicit, I think. Problem is that it will not be used in 95% of the cases, probably
17:11:58Zevv[m]only as a thing to hang your `cont.func()` calls on
17:12:05*maier quit (Ping timeout: 240 seconds)
17:12:08disruptekit's easier for people to grok.
17:12:14Zevv[m]and wait, there's more: can you recognize a cps call if its not a fixed string?
17:12:18disruptekor is it? i mean, it's magical.
17:12:32Zevv[m]you need to save the id of arg #1 and match for that
17:14:00*rockcavera quit (Remote host closed the connection)
17:14:35*waleee-cl joined #nim
17:15:51Zevv[m]and probably handle the case where stupid/smart people shadow that, etc
17:16:04Zevv[m]because you're not *really* calling that thing, you can't know because you are untyped
17:16:15Zevv[m]it's just a nnkDotExpr
17:16:24disruptekwell, we'll know if it's shadowed.
17:16:52disruptekbut, yeah, it's tricky. i'm wondering if we're going about this all wrong.
17:17:19Zevv[m]probably.
17:17:20disrupteknow that early return is a thing, maybe we want `return cps.foo()` to be supplied by the user.
17:17:33Zevv[m]argh
17:17:53disruptekwell, it's explicit.
17:17:58Zevv[m]yeah but but
17:18:35Zevv[m]wow btw, what do we do with real 'returns' now, do you handlet them?
17:18:42disruptekof course.
17:18:47Zevv[m]because you shouldn't change return semantics
17:18:53Zevv[m]That'll confuse the hell out of people
17:19:28Zevv[m]bah then better keep it like it is
17:19:33Zevv[m]and find a good keyword for 'cps'
17:19:35*pietroppeter quit (Quit: Connection closed for inactivity)
17:19:48disruptekyou idea is good.
17:19:53disruptekyour idea is good, too.
17:20:10Zevv[m]yeah, but I now start to crawl back
17:20:22Zevv[m]like it is now we make 'cps' a keywordy kind of thing
17:20:34disruptekwe can ban shadowing, which is fine. we can always ban renaming the 1st arg. it's cps, always.
17:20:35Zevv[m]so you can look at code and know for sure that *there* it will go out
17:20:41*ofelas joined #nim
17:20:56Zevv[m]if you go cps.yield(), it doesn't show. if cps is called 'foo' in my proc, there's 'foo.this()' and boom you're out
17:21:10disruptekwe ban renaming.
17:21:23Zevv[m]I can hardle read other peoples code or my own code after two days. but this will be messy
17:21:26disruptekanyway, "you're out" isn't a thing.
17:21:28FromGitter<alehander92> are we in USSR
17:21:28FromGitter<alehander92> now
17:21:40Zevv[m]no, forget all this. It's a baaad idea mkayy
17:21:44*pangey quit (Ping timeout: 260 seconds)
17:21:51Zevv[m]we need to treat it as a keyword
17:22:01Zevv[m]ask leorize to make it stand out for us
17:22:09FromGitter<alehander92> CCP or CPS
17:22:10Zevv[m]because you should read code and know funny stuff is happening
17:22:24disruptekmmm nah
17:22:28FromGitter<alehander92> what is this ban renaming thing
17:22:32Zevv[m]hmmm jah
17:22:35Zevv[m]read up boi
17:22:57disruptekthe reason we don't use continuations in imperative code is that it's too hard to follow.
17:22:59Zevv[m]it's not important anyway, because it was a baaaahd idea
17:23:10FromGitter<alehander92> keywords sound good
17:23:19FromGitter<alehander92> i believe they are a good idea
17:23:23disruptekwhat we're doing is bringing easy style to a hard design.
17:23:26Zevv[m]like, in general
17:23:30Zevv[m]you're not the lisp kind of guy
17:24:02FromGitter<alehander92> disruptek is not a lisp kind of guy
17:24:13Zevv[m]disruptek: yeah, but it's just too special to hide it.
17:24:14disruptekif we do our job right, no one has to know how this shit works.
17:24:18Zevv[m]it is *like* a return
17:24:26Zevv[m]or a `yield` or a `await`
17:24:29FromGitter<alehander92> i was such a guy, but then i realized one can quote non-homoiconic code
17:24:33FromGitter<alehander92> in nim
17:24:46FromGitter<alehander92> did you decide to do monads after all
17:24:59disrupteki'm doing nomads.
17:25:00Zevv[m]ohh wait I see what you mean
17:25:10Zevv[m]you want to go so far as to hide the fact you're scheduled out
17:25:11Zevv[m]at all
17:25:15disrupteki have a sign on the door of my rv that says, "knock if you're horny"
17:25:43FromGitter<alehander92> if i even knock, dont trust the sign
17:25:45Zevv[m]dude, it *was* a good idea
17:25:48Zevv[m]but then we must hide the return
17:26:03Zevv[m]doing magic io, you do 'magicio.recv()'
17:26:05Zevv[m]and you get your result
17:26:14disruptekthat's how it works now.
17:26:14Zevv[m]you don't want to make the 'return magicio.recv()'
17:26:18*arecacea1 quit (Remote host closed the connection)
17:26:19Zevv[m]right
17:26:25FromGitter<alehander92> really sounds like do notation
17:26:28Zevv[m]because return will just return from your innermost function
17:26:31Zevv[m]don't go changing that
17:26:41*arecacea1 joined #nim
17:27:08Zevv[m]well, I learned that with choices I can't choose from, there's a *reason* i can not choose.
17:27:20Zevv[m]Either it doesn't make a difference whatever I choose, or I just have not enough information
17:27:28*endragor quit (Remote host closed the connection)
17:27:34Zevv[m]this is case #2. I'd like to give it a go
17:27:35disruptekit's usually dom96's fault, let's be honest here.
17:27:55*endragor joined #nim
17:28:37Zevv[m]disruptek: leave dom alone and go type that in
17:28:46Zevv[m]make it explicit, and renamable
17:28:54disruptekdid you read any donald norman, ever?
17:29:06Zevv[m]I read a Donald once
17:29:12*sputny joined #nim
17:29:20disruptekeveryone should read `the design of everyday things` at least.
17:29:20Zevv[m]the design of things something
17:29:23Zevv[m]right, that one I read
17:29:44disruptekso one of the ideas is that people need to form a mental model of how the thing works.
17:30:01disruptekbut in our case, it doesn't need to be based upon reality.
17:30:21disruptekwe give them `cps.foo()` to hang their hat on, but it's just a magical device.
17:30:43Zevv[m]that was about people smashing into glass doors, right?
17:30:52Zevv[m]I just remember the parts with blood & violence
17:31:03disruptekthat was the stallone remake.
17:31:17Zevv[m]right, I do agree. Give them `cps.foo()`, but make `cps` whatever you pass
17:31:38Zevv[m]because it differs. If it is an event queue I'll call it `evq`. If it is an iterator I'll call it `it`, and for coroutines I'll call it `co`
17:32:15*endragor quit (Ping timeout: 256 seconds)
17:32:18disruptekokay, that probably does make some sense.
17:32:24disruptekbut we deny shadows?
17:32:38Zevv[m]nope
17:32:48Zevv[m]if you shadow it and call it, it will just be caught by the compiler
17:32:52Zevv[m]you're just calling the wrong thing
17:33:08disruptekyou could shadow it with the same type, though.
17:33:14Zevv[m]for good reasons, probably
17:33:22Zevv[m]it's not differnet then shadowing any var
17:33:24*pangey joined #nim
17:33:28disruptekfair enough.
17:33:32Zevv[m]dude, am I smart or what
17:33:52disrupteklet me get back to you on that.
17:33:56Zevv[m]do
17:34:24Zevv[m]also, I don't want to see the word 'cps' in everyday use of this thing
17:34:40Zevv[m]you implement a coroutine with cps, and from then on you're working with coroutines. Not with cps
17:35:04Zevv[m]also, beacuse I keep typing csp and can't see the difference between the two
17:35:59disruptekmake some packages, then.
17:36:24Zevv[m]no, I mean, when you're using the coroutine thingy, you don't need to know what "cps" is
17:36:34Zevv[m]when you *make* it you do, of course, but not when you *use* it
17:36:39disrupteki know, so publish a coroutine package named whatever.
17:36:46Zevv[m]sure, that's what I mean
17:36:52Zevv[m]but I don't want coroutine users to type "cps" all the time
17:37:06disruptekthen don't make them create their own coroutines.
17:37:11disruptekprovide them a new symbol.
17:37:24Zevv[m]right
17:38:12disruptekthere are a lot of people that want a properly broad iterator package based on cps.
17:38:38*ForumUpdaterBot quit (Remote host closed the connection)
17:38:45*ForumUpdaterBot joined #nim
17:39:05Zevv[m]yeah sure, but you get what I mean
17:39:07disruptekokay, there are 3 people.
17:39:13Zevv[m]they work with 'it', not with 'cps'
17:39:14Yardanico"we can now pass an int and a float variable with devil compiler. Its fine of course, see" lol
17:39:27Zevv[m]one day we will say "there's dozens of us", just like the Nim users
17:41:00Zevv[m]I want 'for' to understand this stuff
17:41:41disrupteki hope we can rewrite it.
17:41:55Zevv[m]no, the other way around. Not this stuff to understand `for`
17:42:03Zevv[m]I want to be able to use `for` to run my iterator
17:42:26disruptekhmm, i don't know how hard that is.
17:42:29Zevv[m]I can already do `var a = 3 .. 7`: http://ix.io/2ssv
17:42:41Zevv[m]can't do that without support from the language, `for` is not reprogrammable
17:42:50Zevv[m]unless you put the whole caller block into a macro call
17:43:32disruptekfor loop macros are a thing.
17:43:37Zevv[m]wait waht
17:43:47YardanicoZevv[m]: yes
17:43:49*endragor joined #nim
17:43:50Zevv[m]dude!
17:43:51Yardanicowe have for loop macros
17:43:52Yardanicoexperimental
17:44:15Zevv[m]\o/
17:44:15Yardanicoonly in devel I think
17:44:23Zevv[m]good enough for me. Let me whip that up
17:44:32Yardanicohttps://nim-lang.github.io/Nim/manual_experimental.html#case-statement-macros-for-loop-macros
17:44:40disruptekhonestly, these are not limitations afaic.
17:44:48disrupteki mean, consider the alternative.
17:44:59Yardanicono one stops you from writing "myfor" though
17:45:11disruptek!repo foreach
17:45:12disbothttps://github.com/disruptek/foreach -- 9foreach: 11A sugary for loop macro with syntax for typechecking loop variables 15 6⭐ 0🍴
17:45:36Zevv[m]yeah, but you cnat do "myfor a in myit:"
17:45:40Yardanicoyes
17:45:47Yardanicoit's valid nim syntax
17:45:52Zevv[m]oh dang
17:45:54Yardanicoso you can make it into real working stuff with macros
17:45:59Zevv[m]you just ignore the "in"
17:46:11disruptekforeach a, b in pairs(foo) as int, string:
17:46:20Zevv[m]let me try the for loop macro
17:46:25YardanicoZevv[m]: https://i.imgur.com/9MKXrwE.png
17:46:48Zevv[m]Yardanico: right, like I say, you ignore the 'in'
17:46:57Zevv[m]but then you have to call it from within a macro, that's not fair
17:47:01Zevv[m]oh no that's not true
17:47:06Zevv[m]right
17:47:50Zevv[m]hmm but for loop macros require something explicit
17:48:02Zevv[m]if my iterator is 'it', i need to make a 'each' and do `for a in each(it)`
17:48:05Zevv[m]I can't make `for a in it:`
17:48:08disruptekanyway, i'm gonna finish 22 and maybe manage to fix 9 at the same time.
17:48:18Zevv[m]nooo gimme my explict cps.call()
17:48:46Zevv[m]oh, or, right fix #22 and maybe #9 at the same time
17:49:27disruptekgive me {.cps: Cont.} which also gives us `cps Cont:`
17:49:48disruptekand i think `cps foo()` out-of-context should be a trampoline, too.
17:50:06Zevv[m]yeah, I played with that, but that won't work because 'cps' is taken
17:50:13Zevv[m]or can you distinguish?
17:50:17disruptekwhy not?
17:50:36disruptekone is a procdef, one is a call, one is a type.
17:51:15Zevv[m]anyway, that will go away when we do `cps.foo()`
17:51:20Zevv[m]there is no free-floating cps anymore
17:51:22Zevv[m]which is good
17:51:27disrupteksure there is.
17:51:37Zevv[m]only the .cps.
17:51:50disruptekthe .cps. is what does cps Cont: and cps foo().
17:52:06Zevv[m]right, only that. But no fake keyword.
17:52:11disruptekbut whatever, i can write it if it's too hard for you. 😘
17:52:21Zevv[m]how is `{.cps: Cont.}` better?
17:52:46disrupteki forget.
17:52:50*dmi0 quit (Remote host closed the connection)
17:52:51Zevv[m]I guess it is. I could only half grasp all this when I wrote it myself
17:52:55Zevv[m]but now you wrote it I lost it
17:53:01*endragor quit (Ping timeout: 264 seconds)
17:53:17*dmi0 joined #nim
17:54:22disruptekit seems less important now, but the idea was that foo() out-of-context would yield useful error messages.
17:54:34Zevv[m]that's something different
17:54:43disrupteknow that we are explicit with input and output, it may not be worth worrying about.
17:54:45Zevv[m]as it should. But if we do cps.foo(), you can not even call it out of context
17:54:48Zevv[m]because there is no out-of-context
17:54:54Zevv[m]right'o
17:55:21disruptekwell, cps.foo() would need to be discarded.
17:55:22Zevv[m]co.resume(), it.produce(), evq.recv()
17:55:53Zevv[m]oh. Yeah, technically it doesn't be cause it is a fake call
17:55:58Zevv[m]but if you look at the signatures, it makes sense
17:56:08Zevv[m]and I still want my rvalue
17:56:16Zevv[m]I want co.resume() to return something
17:56:26Zevv[m]but that's not in the signature of resume()
17:56:30Zevv[m]but wait
17:56:31Zevv[m]there's more
17:56:40Zevv[m]because resume is .cps. we can make that
17:56:45disruptekokay, lemme get to work on this other stuff.
17:56:57Zevv[m]yeah but I'm just getting started
17:56:59disrupteki don't think `let foo := cps.bar()` is too hard.
17:57:11disrupteki just want to do exceptions, too.
17:57:39Zevv[m]if you put the type in the .cps:Thing., you can drop the explicit return type of the proc
17:57:44Zevv[m]and put it on by magic, right
17:58:10Zevv[m]so `proc foo(): Cont {.cps.}` would become `proc foo() {.cps:Cont.}`, is that true?
17:58:29disruptekmaybe we do our casting in the trampoline instead.
17:58:47Zevv[m]because I was hoping we could make something like `proc foo(): int {.cps: Cont.}`
17:59:02Zevv[m]and then do my `let a = it.foo()`, somehow
17:59:17Zevv[m]but indeed, one step at a time
17:59:19disruptekit seems really doable to me.
17:59:23Zevv[m]\o/
17:59:28Zevv[m]Lua coroutines!
17:59:51disruptekwe need an issue for while: for: while: for: break somewhere
17:59:57Zevv[m]what you pass to `resume(...)` goes to `yield`, what you pass to `yield(...)` goes to resume
18:00:20disruptekmaybe we just use the yield keyword instead of return.
18:00:28disruptekit's kinda what we want.
18:00:39Zevv[m]true, you can just hijack it in the .cps. I guess
18:01:04Zevv[m]but then again, do we need it
18:01:31disrupteki think it helps the mental map.
18:01:32Zevv[m]`let msg = evq.recv(fd)` or `let msg = yield evq.recv(fd)`
18:01:37Zevv[m]then use `await` instead
18:01:43disruptekno, we won't use yield there.
18:02:10Zevv[m]So there's a choice to be made
18:02:13disruptekhmm, maybe we should.
18:02:25Zevv[m]will we tell the user what's happening here, make stuff clear and explicit "here you are scheduled out"
18:02:36Zevv[m]or hide it all as in goroutines. You want to recv? You go recv.
18:02:44ForumUpdaterBotNew thread by Serge: Linking neo to openblas.dll ?, see https://forum.nim-lang.org/t/6605
18:03:19disruptekif it's magical and there's a crack in the mirror, the illusion is broken.
18:03:36Zevv[m]right. So that's the choice
18:03:54disruptekyield can be optional, too.
18:03:58Zevv[m]bwaah
18:04:21*outtabwz quit (Quit: Lost terminal)
18:04:34Zevv[m]baby steps
18:05:42Zevv[m]can I ask one more thing and then shut up?
18:06:35Zevv[m]I think we should drop the concept and make an (empty) base type all CPS's derive from, instead of RootObj
18:07:05Zevv[m]it's more clear what you are making there (a CPS thing), and if we ever want to put things in CPS for like debugging etc, we can put it somewhere
18:07:49*oriba quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
18:09:24disruptekeh we have a concept.
18:09:26disruptekit works.
18:09:32Zevv[m]listen to me
18:10:05Araqwhat? CPS needs a base class
18:10:07Zevv[m]The concept does not add anything. All iterators will be a ref object that's inheritable anyway
18:10:26disruptekthe concept adds expectation.
18:10:35disruptekcps doesn't need a base class.
18:10:44disruptekyou supply whatever you want.
18:10:50disruptekwe use it. we love it.
18:10:53disruptekit's elegant.
18:11:02Araqneed to study it
18:11:05Zevv[m]right. But now you or I want to add some -d:cpsDebug logic to the CPS impelmentation, and you want ot be able to store stuff somewhere
18:11:17disruptekand i do.
18:11:19Zevv[m]if we have a base class (which is just empty usually)
18:11:21Zevv[m]we have a place
18:11:26disruptekwitness cpsDebug and cpsTrace.
18:11:35Zevv[m]No, that's for debugging *your particular event queue*
18:11:37Araqlast time I argued successfully it's never gonna work without inheritance (or closures but these use inheritance too)
18:11:38Zevv[m]not for CPS itself
18:11:47Zevv[m]it's gonna work
18:12:02Zevv[m]disruptek: ok, nevermind, it was just a loose idea, it's not important for now
18:12:05disruptekit works without inheritance (but i think inheritance will ultimately make it faster).
18:12:19Zevv[m]if you don't use inheritance, you'll need to cast :)
18:12:19disruptekalso, it currently uses inheritance.
18:12:26Araqah
18:12:47disruptekmore assumptions are always good when we can get them for free.
18:12:54Oddmongeri don't find the != equivalent in nim /o\
18:13:04Oddmongeri find only doc with ==
18:13:11disruptek!= is a template in system.
18:13:21disruptekit's impl as not(a == b)
18:13:51Oddmongerah so != is valid… i was sure it wasn't
18:13:54Oddmongerthank you
18:14:10disruptekthe two things i want to change about cps, that actually matter, are scopes and generics.
18:14:12FromDiscord<Rika> if it isnt then maybe the type has no `==`
18:14:41disruptekgenerics buys us type inference and scopes buys us simplicity and correctness, not to mention speed.
18:14:57disruptekbut anyway, i need to get to work. bbiab
18:15:13*someunknownuser quit (Quit: someunknownuser)
18:15:14AraqOddmonger: also covered in our tutorials
18:16:13disruptekZevv[m]: one last thing... did you actually play with the stack traces? it's pretty cool.
18:16:20Zevv[m]no, how?
18:16:40*tane joined #nim
18:16:48disrupteksend stuff to my evq trampoline and enable --cpsTrace and raise an exception at the end of a bunch of calls.
18:17:05Zevv[m]oh but I never use your trampoline :)
18:17:07Zevv[m]Will take a look!
18:23:42Zevv[m]hm stupid question - is there a way to "manually" run a Nim closure iterator?
18:23:55disrupteksure.
18:24:01Zevv[m]how?
18:24:17disruptekthere's some syntax, it's like python.
18:24:56Zevv[m]oh magical finished()
18:25:06Zevv[m]got it
18:25:19Zevv[m]ah I knew that
18:25:47OddmongerAraq: i'm sure , but didn't find it in the «test» section of tutorial 1
18:26:18Araqtutorials are documents you're supposed to read from top to bottom
18:26:58disruptekholy shit, i been doin' it dumb all this time.
18:27:17Zevv[m]*it*
18:29:09Zevv[m]our iterators are only 15 times slower then native nim closure iterators
18:29:28disruptekno wonder our web-server is so fast.
18:29:50Araqfixed the leak!
18:29:57Araqnow testing for regressions...
18:32:00Zevv[m]Soo, what caused the leak?
18:32:34Araqstupid convoluted logic inside liftdestructors.nim
18:33:29bunghttps://github.com/nim-lang/Nim/issues/6136 this should be close, not reproduciable
18:33:31disbotHash function can't handle leading zeroes ; snippet at 12https://play.nim-lang.org/#ix=2ssM
18:37:45shashlickwhat's this observable stores warning
18:38:16Zevv[m]yeahy what's this observable stores warning
18:38:40disruptekit means your result is mutating despite a possible exception. usually.
18:38:48Zevv[m]shashlick: https://github.com/nim-lang/RFCs/issues/230
18:38:51disbotNim's NRVO is C++'s inplace construction (placement new) ; snippet at 12https://play.nim-lang.org/#ix=2oor
18:39:23Zevv[m]ooh burn: "The message by the compiler in the latest stable release is now Warning: observable stores to 'x', which is even more cryptic than the original message suggested in this RFC. No link to an article is provided." :)
18:39:34*endragor joined #nim
18:39:45disruptekthey knew just how to hurt me.
18:40:18Araqyeah, I know
18:40:26Araqwill improve the warning message
18:40:39Araqcould also disable it again since it never found any bug anywhere
18:40:42Zevv[m]ooh burn: "The message by the compiler in the latest stable release is now Warning: observable stores to 'x', which is even more cryptic than the original message suggested in this RFC. No link to an article is provided." :)
18:40:46Zevv[m]dang sorry
18:40:51Araqbut let's all be paranoid about everything
18:40:57shashlickstill I'm too dumb/lazy to know what to do here
18:41:00disruptekthere was a bug in nimble.
18:41:31Araqdisruptek: hmm maybe
18:41:47Araqnimble relied on the behaviour that we then didn't fix because it caused performance regressions
18:42:08Araqso arguably nimble relied on sticky stuff
18:44:05FromDiscord<dom96> what did Nimble rely on?
18:44:31FromDiscord<Skaruts> is it easy to embed lua with nim? I was looking at this example code, but I can't tell how to adapt to nim, if possible: https://gist.github.com/Vesnica/3672425
18:44:33disruptekmutating a result prior to an exception.
18:44:40disruptekand then consuming the result.
18:44:42FromDiscord<Skaruts> (edit) 'https://gist.github.com/Vesnica/3672425' => '<https://gist.github.com/Vesnica/3672425>'
18:44:55FromDiscord<dom96> ahh yes, I remember that one
18:45:08*endragor quit (Ping timeout: 256 seconds)
18:48:22AraqSkaruts: It's pretty simple, there should be examples in the Nim Lua wrapper
18:49:27FromDiscord<Skaruts> @Araq this one? <https://github.com/jangko/nimLUA>
18:49:40Araqiirc there is more than one
18:49:52Zevv[m]disruptek: were too slow, really too slow
18:50:35Zevv[m]outrun 15 times by closure iterators. I expected 3, maybe 5. but 15
18:50:55FromDiscord<Skaruts> at a glance I only found that one and one fork of it
18:50:59FromDiscord<Rika> 3 times 5 😉
18:51:38AraqZevv[m]: huh? shouldn't it be faster than closure iterators?
18:51:52Zevv[m]nope. with --arc we're 7 times slower still
18:53:41Zevv[m]well, we trampoline one time too many, due to the way the stuff is split for now, so that might be solvable
18:53:59Zevv[m]but of course for each in/out jump we do a fresh continuation alloc
18:54:25Zevv[m]which is kind of sucky
18:54:44Zevv[m]we should be reusing these somehow
18:54:48disrupteksee, i had hoped that with inheritance we could do a realloc and then omit some assignments.
18:55:18Zevv[m]that's not up to us. We just create a new thingy at the end of each split part
18:55:30disruptekno, it's up to us.
18:55:32disruptekwhy is it not?
18:55:42disruptekwe can pass whatever we want.
18:55:55Zevv[m]oh so if your env groes if you go deeper, you realloc and add stuff
18:56:03disruptekof course.
18:56:09Zevv[m]of your env shrinks if you go up, you can even choose not to realloc
18:56:37disruptekso if only control flow changes, we just `result.fn = foo; return`
18:56:38*Jesin quit (Quit: Leaving)
18:56:40disruptekthat's pretty fast.
18:56:46Zevv[m]if you know how deep you can go, you should realloc the whole thing on the first invication
18:56:49disruptekfaster than an alloc. 😉
18:56:53Araqhere is my advice: focus on the performance right now. otherwise you repeat my mistake where you debug a slow ARC implementation, then add optimizations and then debug it all once again
18:57:16disrupteksure thing, boss.
18:57:20disruptekwell anyway, that's the idea of the inheritance.
18:57:36*NimBot joined #nim
18:57:46disruptekwe'll figure out how best to use it eventually.
18:57:51disruptekbut it clearly buys us something.
18:58:03disruptekand remember, this is an object that the user defined. completely.
18:58:19FromDiscord<dom96> what performance are you expecting out of this?
18:58:20disruptekjust think about that, i mean, really.
18:58:22*nikita` quit (Read error: Connection reset by peer)
18:58:30disruptekpretty damned fast.
18:58:33Zevv[m]disruptek: euh wait, you gather the contents of that thing during lifting, right?
18:58:40Zevv[m]it's the locals
18:58:47disruptekright.
18:58:51Zevv[m]so how is that "user defined"
18:59:05disruptekthe user provided the Cont type, wholecloth.
18:59:13disruptekit can be anything they want.
18:59:14Zevv[m]yeah right, but not "the whole thing"
18:59:23Zevv[m]it's that, plus what you put on top of it
18:59:47disrupteki mean, technically, we could add a pointer to the object definition and now the continuation is one piece of memory.
19:00:07Zevv[m]that's an extra dereference?
19:00:11disruptekright.
19:00:13Zevv[m]don't
19:00:16disruptekto wherever the continuation is destined.
19:00:34disruptekwait, it's not an extra dereference.
19:00:42Zevv[m]then I don't understand yet
19:00:56disruptekwell, a continuation right now.
19:00:58disruptekwhat is it?
19:00:59Zevv[m]right now
19:01:02disruptekyes.
19:01:15disrupteklike, simple answer.
19:01:16Zevv[m]it's an object of type X wich has children with extra genes
19:01:24Zevv[m]ref object
19:01:32Zevv[m]and a pointer to a proc
19:01:40disruptekno, it's a ref object that inherits and has a ptr to a fn.
19:01:52Zevv[m]right that's what I mean
19:01:54Zevv[m]said
19:01:55disruptekso it's an object that can be extended, and it points to some code.
19:02:08Zevv[m]right. The env extends it
19:02:11disruptekbut, like, you don't extend this object.
19:02:14Zevv[m]I do
19:02:19disruptekno, you truly do not.
19:02:20Zevv[m]oh
19:02:21disrupteki promise you.
19:02:23Zevv[m]tell me
19:02:31disruptekit's just a concept.
19:02:37disruptekthe concept is the words on the screen.
19:02:42disrupteksame as i've repeated to you.
19:02:46Zevv[m]repeat it once more
19:02:55disruptekit's a ref to an obj that inherits and has a ptr to a piece of code.
19:03:16disrupteka piece of code that knows how to run with nothing more than some data as input.
19:03:23Zevv[m]ok but then again
19:03:24disrupteksome data it may or may not mutate.
19:03:30disruptekadd to.
19:03:35disruptekrewrite.
19:03:43Zevv[m]if you go deeper into the original stack, you inherit and inherit and keep adding stuff to the inherited type
19:03:46Zevv[m]is that right or wrong
19:03:58disruptekyou can strip stack whenever you pass it.
19:04:04Zevv[m]is that right or wrong
19:04:06disruptekyou only pass what you want to use.
19:04:07disruptekthat's good.
19:04:23disruptekobviously, you pass the fn.
19:04:27disruptekso that's 8 bytes.
19:04:28Zevv[m]no go back
19:04:33Zevv[m]if you go deeper into the original stack, you inherit and inherit and keep adding stuff to the inherited type, is that right
19:04:38disruptekno.
19:04:49Zevv[m]so where am I wrong. I mean as it is *now*
19:04:51disruptekwhenever you create a proc, that is when you define the environment.
19:05:04disruptekthe environment that you're working in has whatever you want in it.
19:05:09disruptekany subset of your input.
19:05:23disruptekput anything at all in this env; it's yours to keep.
19:05:32Zevv[m]you totally lost me, sorry
19:05:33disruptekno one will have access to it.
19:05:48disruptekzevv, YOU are `fn`.
19:05:51Zevv[m]back. Talking as it is *now* or talking as you want it to *be*
19:05:57disruptekthis is how it is now.
19:05:59Zevv[m]ok
19:06:14disruptekso you, YOU, are fn.
19:06:20Zevv[m]ok
19:06:20disrupteki give you some input.
19:06:23disrupteka banana
19:06:25Zevv[m]yeah
19:06:26disrupteka coconut.
19:06:28Zevv[m]also
19:06:38disrupteka gallon of rum.
19:06:45Zevv[m]yeah yeah go on
19:07:23disruptekyou give me the name of a friend and a cocktail that i can give to them.
19:07:38Zevv[m]sure
19:07:43disruptekthen we see if i'm getting lucky tonight.
19:07:59disruptekand so on and intercourse.
19:08:03*maier joined #nim
19:08:03disrupteker, so forth.
19:08:46disrupteklet's say i don't use the banana. i give the banana back to you.
19:09:02disrupteklook, i say, don't go to this friend. go to this other friend; she's love the banana.
19:09:20disruptekshe gets the banana, i get the cocktail, you get fucked.
19:09:22disruptekor something.
19:09:27disruptekwho cares, it doesn't matter.
19:09:28Zevv[m]dude
19:09:37disruptekthe point is that you can use it or lose it or pass it.
19:10:15Zevv[m]ok. real example, gimme a sec
19:10:24disruptekmaybe you took the banana and gave someone else your nut.
19:10:33disruptekwhatever peels your banana, dude.
19:10:45disrupteki am not going to judge you on your banana.
19:10:50disrupteki'm more of a coconut man, myself.
19:10:55Zevv[m]real stuff: I have a proc with a few nested scopes, right
19:10:58Zevv[m]outer scope has only int i
19:10:58*Jesin joined #nim
19:11:00disruptekright.
19:11:03Zevv[m]one scope deeper int j comes in
19:11:05*dzamo quit (Quit: dzamo)
19:11:13disruptekintj's, know 'em. love 'em.
19:11:15Zevv[m]halfway first cps call I have env_1, which contains only int i
19:11:23disruptekright.
19:11:28Zevv[m]now we go one deeper, we get env_2, which inherits env_1 and adds int j
19:11:30disrupteki'm right there whitcha, boss.
19:11:30Zevv[m]still true?
19:11:40disruptekyes, yes, yes.
19:11:47Zevv[m]so the deeper you go, the further you inherit, the more you add
19:11:51Araqseriously? bananas and nuts?
19:11:53disruptekyou put the lime in the coconut.
19:11:56Zevv[m]still true?
19:11:57disruptekyou shake it all up.
19:12:01disruptekyes, yes.
19:12:07Araqstop it. use better terms
19:12:15Zevv[m]ok, earlier when I asked that, you said that was wrong
19:12:26Zevv[m]so you add to your inherited environment by inheriting deeper and adding members
19:12:38Zevv[m]you go a few scopes up, and you have another branch of inheriting
19:12:39disruptekyou have i and j. but when you tell me the result, you can tell me as much or as little as you want.
19:12:46disruptekyou can tell me i.
19:12:48disruptekyou can tell me j.
19:12:52Zevv[m]shut up
19:12:52disruptekyou can tell me k.
19:12:54Zevv[m]you go a few scopes up, and you have another branch of inheriting
19:12:59disruptekfine.
19:13:03Zevv[m]so, first call we construct env_1 with only i on it
19:13:09Zevv[m]gets malloced and on the heap
19:13:14disruptekfine.
19:13:17Zevv[m]we go to the first split fn, and pass that thing in
19:13:23disruptekstop.
19:13:25*maier quit (Ping timeout: 264 seconds)
19:13:26Zevv[m]it just throws it away, and constructs a new env_2
19:13:27Zevv[m]ok
19:13:34disruptekwe got to the first split fn.
19:13:37disruptekwhere is that fn?
19:13:44disruptekwhere is the ptr to that proc?
19:13:45Zevv[m]the pointer to it is in the continuation
19:13:52disruptekokay, so it's in "our" memory.
19:13:59disruptekthe memory we know how to find.
19:14:02disruptekright?
19:14:08disruptekwe know the continuation.
19:14:11disruptekit was passed to us.
19:14:16disruptekso we know where the fn is on it.
19:14:17disruptekright?
19:14:19disruptekwith me?
19:14:28disruptekthe fn, of course, is ourselves.
19:14:35disruptekso we can identify ourselves.
19:14:42disruptekand we know, what stuff, in the world is around us.
19:14:44disruptekmemory.
19:14:49disruptekwe know what's in that memory.
19:14:52disruptekit's variables.
19:14:54disruptekwe have the list.
19:14:56Zevv[m]right
19:14:58disruptekit's in our type.
19:15:01Zevv[m]right
19:15:10disruptekin fact, everything we're going to speak of, is in our type.
19:15:19disruptekall symbols that might be interesting to know about.
19:15:27disruptekany name->value sorta thing.
19:15:27Zevv[m]but as we pass the continuation to the next, we create a whole new continuation
19:15:35Zevv[m]that's what happens *now*
19:15:36disruptekbut also anything in global scope that's like that.
19:15:42disruptekyes.
19:15:45disruptekthat happens now.
19:15:47Zevv[m]right
19:15:51Zevv[m]that is what I wanted to say
19:15:51disruptekand what do we put into that object?
19:16:07disruptekdo we put the whole world into it? all the memory we've amassed?
19:16:07Zevv[m]all the stuff that is in scope of the next one to receive this
19:16:19disruptekbut who chooses what that is?
19:16:23Zevv[m]the receiver
19:16:25disruptekhow do you pick?
19:16:29Zevv[m]it was picked for me
19:16:31Zevv[m]I don't know
19:16:43disruptekokay, so someone says to you, here, let's do business.
19:16:51disruptekthey tell you what they want.
19:16:56disruptekyou give them a result.
19:17:04disruptekright?
19:17:07Zevv[m]right
19:17:08disruptekthey tell you.
19:17:34disruptekthey say, "i don't care where you're from, who you are. or what you know."
19:17:41disruptek"i want x, y, z."
19:17:46disruptek"that's all i want. i don't care."
19:17:57Zevv[m]right, so I create another env type and put that stuff in there
19:17:59disruptek"give me x, y, z. and i will give you the world."
19:18:05disruptekright.
19:18:07Zevv[m]but that new env, is new and goes on the heap
19:18:08Zevv[m]another alloc
19:18:15disruptekright, but it could be a realloc.
19:18:25disruptekin fact, aren't there cases where it doesn't need to change?
19:18:33Zevv[m]right, that is where I want to go
19:18:38Zevv[m]but you went on your coconut tour
19:18:40disruptekit's it the case that sometimes you will get a request and just pass it somewhere else?
19:18:45Zevv[m]and also, if you know the deepest you could ever get
19:18:53disruptekit doesn't matter.
19:18:54Zevv[m]you could make 1 thing that you just pass all over, and mutate it
19:19:02disrupteksure, but it doesn't matter.
19:19:03Zevv[m]you alloc once, and everybody only uses what they need
19:19:06Zevv[m]no reallocs
19:19:09Zevv[m]no growing, no shrinking
19:19:11disrupteksure, whatever.
19:19:26Zevv[m]it can still be a hierarchy of different objects, but you can *start with the biggest possible thing
19:19:28Zevv[m]*
19:19:34disruptekif you want to work is a certain sized swimming pool, one way to do that is to get a lot of water in one place at the same time.
19:19:54Zevv[m]dude talk nim, I'm too stupid for that stuff
19:20:10disruptekyou can do whatever you want with this memory.
19:20:22Zevv[m]yeah yeah but as it is *NOW*
19:20:23Zevv[m]it is no good
19:20:30disruptekwhy?
19:20:34Zevv[m]all the frigging reallocs
19:20:35disruptekarc sinks these values for us.
19:20:43disruptekoh, as it is NOW.
19:20:45disruptekyes, yes.
19:20:47disruptekof course.
19:20:47Zevv[m]YEEESSSS
19:20:50disrupteksorry.
19:20:50Zevv[m]LISTEN YOU MORON
19:20:52Zevv[m]I typed *NOW*
19:20:54Zevv[m]right
19:20:55Zevv[m]soooo
19:20:55disrupteksorry.
19:20:57Zevv[m]I love you too
19:20:59PrestigeIs there a way to have a variable be a sort of alias for another var that is a ref object?
19:20:59Zevv[m]need to read the kids
19:21:06Zevv[m]doing quantum mechanics tonight
19:21:08disruptekokay.
19:22:19PrestigeTrying to replicate this behavior: https://github.com/avahe-kellenberger/dwm/blob/master/src/dwm.c#L962 - my Client is a ref object of RootObj
19:24:36disruptekwhy do we even bother with arc?
19:24:49disruptekwhy don't we just manage the memory for you?
19:24:55disruptekwe're doing that anyway.
19:25:09disrupteki mean, we're alloc'ing this stuff.
19:25:11disruptekwe're copying it.
19:25:21disruptekwe know it by name.
19:25:28disruptekwe know what it is.
19:25:32disruptekit's not a guess, we KNOW.
19:26:00leorizePrestige: I'm not sure how this is supposed to work
19:27:01PrestigeI believe that c->mon->clients is being reassigned
19:27:35Prestigeclients is just a Client that has a pointer to the next client
19:28:24PrestigeSo I think tcc is sort of like an alias here, for c->mon->clients
19:29:11leorizeyes
19:30:26PrestigeI'm wondering if this is possible in Nim, where my Client is a ref object
19:31:05leorizeyes
19:32:22leorizeyou just need a `ptr Client` to serve as your alias
19:32:33leorize`std / byaddr` have a pragma to do just that
19:33:21disruptekZevv[m]: i think we can do ideal-alloc with just a single pointer. should be like one line of code.
19:33:38PrestigeThanks, I'll give it a try
19:38:40Zevv[m]'ideal-alloc' meaning the right size so we do not have to realloc any time during the lifetime of the whole chain of continuations?
19:39:11*aurelius joined #nim
19:39:15disrupteknot, like, literally ideal, but based upon name clashes.
19:39:57Zevv[m]ok, so where you want to go: instead of throwing away the continuation with its env, you want to mutate it and pass that on
19:39:59disruptekso, like, it's not about size, it's about allocs.
19:40:01Zevv[m]so we don't realloc, right?
19:40:19Zevv[m]no, "so we dont throw away and allocate a whole new one"
19:40:22disruptekright.
19:40:41Zevv[m]right.
19:40:42disrupteki mean, currently.
19:40:58Zevv[m]but now we *do* make a new one every call
19:41:09disruptekyeah.
19:41:12Zevv[m]ok
19:41:42disruptekhow can we get the static sizes of all this stuff?
19:41:48Zevv[m]so, do we make this thing just a block of memory which we pass along and grow when needed, and just cast it to the type it happens to have during this place in its lifetime?
19:42:08Zevv[m]or do we figure out the whole possible tree of inheritance, and pre-alloc the largest of those
19:42:13Zevv[m]and pass that around, so that any other type would fit in
19:42:44disruptekwe can compute size at runtime, certainly.
19:43:04Zevv[m]if my mental image is right, every var that goes into an env has the same location in the memory block in all possible tree-permutations
19:43:15disruptekso we'll be able to make the assumption at compile-time that we got the size right.
19:43:15Zevv[m]so we never have to move stuff around. The outer scope 'i' will always be at the same offset
19:43:41disruptekthat's fine.
19:43:51disrupteki'm just thinking that it doesn't matter.
19:43:55Zevv[m]The only downside will be that if you stash away a million of these things for later calling, you possible stash away a lot of unused memory
19:43:56*bung quit (Quit: Lost terminal)
19:43:58disruptekif i know how big i am, i can tell you where i end.
19:44:14Zevv[m]but I think araq is right, we should make this work soon
19:44:14disruptekso whatever.
19:44:41*vicfred_ joined #nim
19:45:02disruptekreally, it's just a chunk of memory Cont[N].
19:45:38Zevv[m]right'o
19:45:46disruptekwe setup the vars for you. you can use any string to name them.
19:45:56*vicfred_ quit (Client Quit)
19:46:05*aurelius quit (Ping timeout: 240 seconds)
19:46:14*vicfred_ joined #nim
19:46:43*altarrel quit (Quit: Konversation terminated!)
19:47:28*vicfred quit (Ping timeout: 256 seconds)
19:48:04*MightyJoe joined #nim
19:50:34*cyraxjoe quit (Ping timeout: 265 seconds)
19:50:40Zevv[m]I still don't know what you're saying here, but I think we mean the same thing about the memory block used for continuations
19:51:25*endragor joined #nim
19:51:30Zevv[m]does it make sense to alias locals to directly use the stuff stored in the env, or is nim smart enough to understand we're peeking it from there and poking it back at the end?
19:51:38Zevv[m]otherwise that could be a good optimization as well.
19:51:52Zevv[m]just rewrite `i` to `myenv.i`
19:51:56disrupteki'm thinking that anything stropped.
19:52:11disruptekso it's `i` versus 'i'.
19:52:32disruptekwe just rewrite those. 🤷
19:52:44Zevv[m]eh wait. My original code does "i = 3"
19:52:48Zevv[m]waht do you rerwrite that to
19:52:55disruptekmyenv.i = 3
19:52:59Zevv[m]right
19:53:04Zevv[m]where does the stropping come in
19:53:15disruptekso, i mean if it's stropped.
19:53:24disrupteki = 3 means, local i = 3.
19:53:37disruptek`i` = 3 means myenv.i = 3
19:53:37Zevv[m]ok
19:53:57disruptekit's cute, too.
19:54:09Zevv[m]so, we can keep the inheritance, or make a tons of objects that are tree-wise compatible
19:54:16Zevv[m]which at the C-level is about the same thing
19:54:49disruptekyou make a fair point.
19:54:55*MightyJoe quit (Ping timeout: 265 seconds)
19:55:06*cyraxjoe joined #nim
19:55:52Zevv[m]but to make sure: we have an outer scope with i and j, next scope uses i, j and k so we add one. One deeper j is not used, so it only needs i and k. We still pass the whole thing, but the hole were j was is just not accessed
19:55:56Zevv[m]does that make sense
19:56:10Zevv[m]it's just the same memory block, but we must make sure that layout-wise k is always on the same address
19:56:20disruptekyes, of course.
19:56:33Zevv[m]so if you go to deeper scope, you still need to put in stuff from outer scopes, evne it if it is not used
19:56:55Zevv[m]there's a beauty to this stuff
19:57:03disruptekyes, but remember it's not just about used.
19:57:10disruptekyou have to worry about the clashes, too.
19:57:13Zevv[m]I see these things in my minds eyes, but I couldn't draw a picture of it if I had to
19:57:19Zevv[m]clashes of what
19:57:23Zevv[m]names?
19:57:25disruptekyeah.
19:57:29Zevv[m]yust number them?
19:57:33Zevv[m]i_1, i_2, i_3?
19:57:42Zevv[m]in your 3d part you rewrite `i` to `env.i_3`
19:57:45Zevv[m]or whatever
19:57:53disruptekmaybe.
19:57:54Zevv[m]they all live on the exact same place in the memory block
19:58:04Zevv[m]just with differetn names
19:58:18*endragor quit (Ping timeout: 265 seconds)
19:58:26disruptekbut now you're saying that we'll find the largest chunk that your continuation ever has and make that the size of every continuation.
19:58:52Zevv[m]maybe. It avoids realloc during its life time, but it is overhead you might need to keep stashed away for a longer time
19:59:45Zevv[m]the good thing is that if you have a bunch of the same continuations, we could use some kind of presized memory pool and get 0 fragmentation
20:00:01Zevv[m]In real life, how big is your typical stack frame?
20:00:09disruptekwell, we can certainly do that.
20:00:12Zevv[m]in my C time these were always pretty small, handfull of KB's
20:00:21Zevv[m]but with nim I tend to put much more stuff on the stack, so they might grow
20:00:51Zevv[m]but then again, as soon as your data structures get more complex to store more stuff, you're more likely to use refs and things go to the heap
20:01:12Zevv[m]so in practice I think closure size will exponentially go down pretty fast
20:01:26Zevv[m]most will be handful or tens of bytes, for simple iterators and stuff
20:02:15disruptekheap or not, you have the size of the memory to think about.
20:02:44Zevv[m]we could code it up so the user has a choice, somewhere somehow
20:02:51disruptekyou cannot predetermine what people will do.
20:03:02disruptekwhy they will do the things they do.
20:03:03Zevv[m]either pre-alloc the full size, or grow and/or shrink during its life time
20:03:17disruptekthe terrible, naughty, kinky things they do.
20:03:28Zevv[m]I try to understand the things mratsim does sometimes, and I think he's all for preallocs and pools and all that
20:03:33Zevv[m]you want to go fast, you pay
20:03:36Zevv[m]makes perfect sense
20:03:47disrupteki know.
20:03:53disrupteknothing is more expensive than memory.
20:04:03Zevv[m]so a continuation will be as large as the original funcions worst case stack size
20:04:19disruptekbut i'm not comfortable with that.
20:04:26Zevv[m]then you need to realloc in flight
20:04:28disruptekwhy do you want to give that up?
20:04:31Zevv[m]but that'll cost performance
20:04:36disruptekhol' up.
20:04:39disruptekwho gets to choose?
20:04:46disruptekwhy can't i say when i pay that penalty?
20:04:47Zevv[m]the implementer of the thing built on CPS
20:04:58Zevv[m]or the end user of the thing
20:05:04disruptekit's it the same to say that you can always go smaller?
20:05:12disruptekit's that safer?
20:05:20Zevv[m]don't understnd the question
20:05:26Zevv[m]"huh"
20:05:33disruptekyou can pass memory the same size or smaller.
20:05:54Zevv[m]lost you again - who passes to who
20:06:16disruptekyou, the cont.fn can return memory the same size, or smaller.
20:06:27Zevv[m]right
20:06:36Zevv[m]or larger
20:06:49Zevv[m]so either we start out at max size
20:06:56Zevv[m]or we do reallocs on every pass
20:07:03Zevv[m]that's a compile time choice in your macro
20:07:09Zevv[m]just inject a realloc or not
20:07:33disruptekhmm, i dunno.
20:07:45Zevv[m]¿problem?
20:07:58disrupteki dunno if i want that to be compile-time.
20:08:02Araqit makes me mad
20:08:10disrupteki mean, look at araq.
20:08:13Araq5000 allocations because of 'of RootObj'
20:08:25disruptekthat's a lot.
20:08:29Araqso strange, valgrind says everything is not corrupted
20:08:43disruptekwhat was the actual problem?
20:17:36Zevv[m]disruptek: what do you propose then
20:17:57Zevv[m]so either you have the max size prealoced or keep it, or you realloc shrink/grow while traveling
20:18:18disrupteki think when you add to an env, you set your parent's "ideal" to yourself. clearly.
20:18:26*MightyJoe joined #nim
20:18:40disruptekthere's no way to delete from envs, so it seems pretty correct.
20:18:52disruptekit just recurses.
20:19:14Zevv[m]you can't delete from envs, but when you get down the end of the call chain, where the original fucntion would bubble up scopes, you could lose the tail
20:19:15FromDiscord<Clyybber> whats crakcin
20:19:28Zevv[m]shrinking back to 0 as you ascend back to the surface
20:19:47Zevv[m]Clybber: we're way to slow and need to get rid of the environment allocs for every pass
20:19:47disruptekbubble up scopes?
20:19:56Zevv[m]wrong wording
20:20:07Zevv[m]a proc has a bunch of nested scops. Ifs, blocks whiles
20:20:13Zevv[m]if you are deep, you have a large stack = large environment
20:20:13FromDiscord<Clyybber> Zevv: Hmm, there is a PR for putting them on the stack
20:20:26disruptekyeah?
20:20:29Zevv[m]if you get out of one of these nested scopes, you lose a bit of your steack, smaller env
20:20:30FromDiscord<Clyybber> oh, eh
20:20:46Zevv[m]so the continaiton env can shrink sometimes
20:21:02disruptekhow do i lose a bit of my env?
20:21:08*cyraxjoe quit (Ping timeout: 256 seconds)
20:21:13Zevv[m]the tail
20:21:27Zevv[m]it's as big as the stack would be if you didn't chop up the proc
20:21:31Zevv[m]stacks grow and shrink all the time
20:21:37disruptekthese don't.
20:21:56Zevv[m]you nest into an if and declare a var, you env grows. You get out of the if block, that var is no longer in scope, your stack shrinks.
20:22:03Zevv[m]So any calls happening after that have a smaller env
20:22:49disruptekno, when i setup the continuation, i map every growth to point every prior env to myself.
20:23:14disruptekie during the process where i register locals.
20:23:24FromDiscord<Clyybber> Araq: Hmm why does the inheritance cause allocs?
20:23:28*oriba joined #nim
20:23:29FromDiscord<Clyybber> Maybe because of the RTTI?
20:23:29FromGitter<alehander92> Araq so can't you diff
20:23:34*vicfred_ quit (Quit: Leaving)
20:23:46FromGitter<alehander92> the alloc callsites
20:23:48Araqfound it
20:23:55Zevv[m]tell it
20:23:56*audiofile joined #nim
20:24:02disruptekyeah, jeeze.
20:24:04*vicfred joined #nim
20:24:04Araqwhen we use inheritance the cycle collector assumes there can be cycles
20:24:17FromDiscord<Clyybber> And that causes leaks/
20:24:19FromDiscord<Clyybber> ?
20:24:19Araqand that causes init/deinit calls for its internal data structure
20:24:27FromDiscord<Clyybber> or are you chasing leaks?
20:24:30Araqit doesn't leak, but it allocates more
20:24:34FromDiscord<Clyybber> ah ok
20:24:39Araqthe leaks are fixed in my other PR
20:24:46FromDiscord<Clyybber> oh nice, gotta check it out
20:25:02Araqso now I know. only the cursor inference left and then I can focus on bootstrapping
20:25:12Araq4 days left
20:25:20disrupteklol
20:25:27disruptekyou can do it, dude.
20:26:13Araqhmm I might want to optimize this though
20:26:17disruptekmaybe if we try hard we can keep from filing more arc bugs between then and now.
20:28:43FromDiscord<dom96> Araq: don't burn yourself out. Now that you know the cause it would be a good time to stop and rest until tomorrow 🙂
20:29:25FromDiscord<Clyybber> nah, arc fixing is a drug
20:29:32FromDiscord<Clyybber> a drug with benefits
20:29:34FromGitter<alehander92> and drug addiction is bad
20:29:46Zevv[m]all drugs have benefits
20:29:53FromGitter<alehander92> say no to drugs clybber
20:29:55FromGitter<alehander92> choose life
20:30:01FromDiscord<Clyybber> a drug without disadvantages
20:30:25FromDiscord<Clyybber> drug: no
20:30:38FromDiscord<Clyybber> there I said it
20:30:49FromDiscord<Clyybber> even pinged the douche
20:31:05FromGitter<alehander92> choose refining optimization
20:32:09FromDiscord<Clyybber> Araq: Is there already a proc to compare idents discarding the gensym part?
20:32:53FromDiscord<Clyybber> I think equalParams needs that
20:33:54shashlickall calls in the stdlib to tables.add need to be cleaned up - stdlib is grumbling about itself
20:37:57disruptekwow, this would give me my `while: else:` feature for free.
20:38:35Zevv[m]what would
20:39:52FromDiscord<Clyybber> oh no
20:39:55disruptekthe fact that break is not flow-through control flow.
20:40:39FromDiscord<Clyybber> inb4 while: else: gets built into cps
20:41:52FromDiscord<KingDarBoja> Ar4q must be happy after seeing how Python 3.10 is going to implement Pattern matching (because he was right)
20:41:58FromDiscord<KingDarBoja> 🤔
20:42:13FromDiscord<Clyybber> Araq: Should we actually gensym params of procs that are {.inject.} ?
20:42:28disruptekoh
20:42:42disruptekthat would be awesome.
20:43:44FromDiscord<Clyybber> what would?
20:45:52*hoijui quit (Ping timeout: 260 seconds)
20:46:03*rockcavera joined #nim
20:47:52*tane quit (Quit: Leaving)
20:48:55disruptekwell, you get more than break.
20:49:36disruptekyou get continue, no-start, and post-work exit, right?
20:49:48AraqKingDarBoja: I don't care what Python does, it's a silly scripting language
20:50:24AraqClyybber: ask me again tomorrow, cannot think right now, it's late
20:50:35FromDiscord<Clyybber> ok, haha
20:54:03FromDiscord<Clyybber> gn8
20:54:09disruptekcps lives in the corners of your while loops.
20:54:15disruptekit comes for you. it comes.
20:54:38FromGitter<alehander92> no please
20:54:51FromGitter<alehander92> gentrification
20:55:00disruptekjust a tiny programming-language virus. i swear it'll be tiny.
20:55:05FromGitter<alehander92> we've had enough of this
20:55:19disrupteknim lives matter.
20:56:04FromGitter<alehander92> your life matters
20:58:08*endragor joined #nim
21:02:06*lritter joined #nim
21:02:36Zevv[m]yay, finally I have goto's in Nim: https://github.com/disruptek/cps/blob/master/stash/goto.nim
21:05:04Zevv[m]this is all so silly
21:05:06*narimiran quit (Ping timeout: 256 seconds)
21:07:25*endragor quit (Ping timeout: 264 seconds)
21:08:56*maier joined #nim
21:10:45FromDiscord<Clyybber> thats ugh
21:10:52FromDiscord<Clyybber> fucking amazing haha
21:11:43Zevv[m]I know I should be able to build a try/catch/throw with this, but I can't
21:13:45*maier quit (Ping timeout: 240 seconds)
21:19:05*dulsi_ joined #nim
21:19:40*sputny quit (Remote host closed the connection)
21:20:57*apahl quit (Ping timeout: 272 seconds)
21:21:12*dmi0 quit (Quit: Leaving)
21:21:23*apahl joined #nim
21:21:55*dulsi quit (Ping timeout: 265 seconds)
21:22:45*Trustable joined #nim
21:25:13Zevv[m]disruptek: you here still
21:26:27FromDiscord<Avatarfighter> disruptek is lost in the for loops
21:26:40Araqtry and catch is easy, Zevv[m]
21:26:54Zevv[m]yeah, it's easy but it doesn't fit our current infra
21:26:56Araqsee how --exceptions:goto do it
21:26:59Zevv[m]I need state to carry stuff over closures
21:27:03Zevv[m]it's just an implementation thing
21:27:06disruptekit does fit.
21:27:16Zevv[m]it fits, but I can't store my state anywhere right now
21:27:17disruptekit kills two birds with one stone, actually.
21:27:37Zevv[m]I want to store something in my Cont that carries over to all successive conts
21:27:45disruptekgo ahead.
21:27:46Zevv[m]a ref to something
21:27:54Zevv[m]yeah but not sure how to nicely pass it in initially
21:27:54disruptekyeah, it's called e.
21:28:05disruptekthe same way you pass anything.
21:28:45disruptekwe gensym "fn" and "e".
21:29:02Zevv[m]oh right
21:29:03disrupteki don't feel bad about this.
21:29:08Zevv[m]i didn't know
21:29:12disruptekthrow result in there, too.
21:29:22Zevv[m]dude your documentation is *so* bad
21:29:34disrupteki'm trying to write some now.
21:29:54Zevv[m]e is not in your concept
21:30:09disruptekno, neither is result.
21:31:41Zevv[m]where do I new() my e?
21:31:54disruptekwe can probably put `punch` in pretty trivially.
21:32:14disruptekprettier nimions new it for you.
21:32:31disruptekor not at all.
21:32:37disruptekwho's to say?
21:32:42FromDiscord<Clyybber> Araq: Kind of related, wdyt about making the gensym hash part of an ident consistent per template?
21:33:31Araqwhat does that mean
21:33:59disruptekit's caught from below.
21:34:01FromDiscord<Clyybber> It means that i and i in the same template will be gensymmed to the same
21:34:47FromDiscord<Clyybber> i`gensymSAME
21:35:59Zevv[m]disruptek: you're speaking in riddles
21:36:01Zevv[m]with your 'e'
21:36:06FromDiscord<Clyybber> This would allow us to get rid of the symbol searching we do
21:36:50FromDiscord<Clyybber> to make `when ...: var a else: var a\necho a` work
21:37:43*dulsi_ is now known as dulsi
21:37:44FromDiscord<Clyybber> and would make gensymmed forward decls work too without adding a mode that ignores gensym param name differences to searchForProc
21:38:31Araqlisten to me
21:40:28Araqtouch the gensym implementation as little as possible it took me at least 3 iterations to get into its current, semi-working state
21:41:26Zevv[m]Aller guten Dinge sind drei
21:48:48*solitudesf quit (Ping timeout: 256 seconds)
21:49:48*Vladar quit (Quit: Leaving)
21:52:20*endragor joined #nim
21:52:54Zevv[m]disruptek: https://github.com/disruptek/cps/blob/master/stash/trycatch.nim
21:53:12Zevv[m]tell me where I should store 'err', 'msg' and 'where'.
21:56:58*endragor quit (Ping timeout: 246 seconds)
22:04:25*endragor joined #nim
22:12:13*endragor quit (Ping timeout: 264 seconds)
22:13:23Zevv[m]#20 is in a PR, I'm off to Zzz
22:13:36disruptekg'night old man.
22:15:49FromGitter<bung87> `result = prefix & result` araq how this can without copy ?
22:17:07FromGitter<bung87> and when assign a char still a copy ? i dont know how to optimize string manipulation
22:20:25Araqwell you start by scanning the prefix
22:20:36Araqwhile you do that you can already append to result
22:20:49Araqand then there is no need for 'result = prefix & result'
22:21:16Araqthe slice into 's' can be avoided with a simple prefixLen integer variable (you almost have it inside 'idx' but its scope is off)
22:21:26Araqand that's about it I think
22:24:40FromGitter<bung87> let me think of it
22:34:24FromGitter<bung87> then `result = newString(L)` no need ? I just do all .add char ?
22:37:48Araqyou can use result = newStringOfCap(L) and .add chars
22:39:35*audiofile quit (Quit: Default Quit Message)
22:40:33FromGitter<bung87> L depends on partsLen, I cant declare it then add prefix char to it
22:41:56FromGitter<bung87> in the first loop
22:45:01FromGitter<bung87> I've modified follow your suggestion, except the end line
22:45:57AraqL is only an estimate
22:46:08Araqit doesn't have to be exact
22:50:00Araqoh the cursor bug looks easy to do tomorrow
22:50:27Araqbut it'll make the optimization less effective
22:55:03FromGitter<bung87> ok I got it
22:57:30FromGitter<bung87> i have to change to countup easier for understanding when use .add
23:01:41Araqbung87: btw, exceptional work with your PRs, please continue
23:02:12Araqgood night
23:03:22FromGitter<bung87> Thanks ! I done the work, only result string now.
23:04:21FromGitter<bung87> always get benefit from code reviews
23:06:33*krux02_ joined #nim
23:09:23*krux02 quit (Ping timeout: 260 seconds)
23:09:47*maier joined #nim
23:15:13*maier quit (Ping timeout: 264 seconds)
23:15:59*aurelius joined #nim
23:20:58*aurelius quit (Ping timeout: 246 seconds)
23:34:17*endragor joined #nim
23:36:42Yardanicook so there's still some async leak left, but it's much smaller
23:36:59Yardanicofrom a nim compiler 1 month ago, after stress-testing asynchttpserver with wrk, the RAM usage was 1.5gb
23:37:03Yardaniconow it's 100mb
23:37:12Yardanicothat's for ~400-500k requests
23:41:37*vicfred quit (Quit: Leaving)
23:48:09Yardanicoseems like it leaks in processBasicCallbacks
23:48:45*oddp quit (Ping timeout: 240 seconds)
23:50:30Yardanicooh it has some shallowCopy in there
23:57:17Yardanicofor ~80k requests in debug mode "(allocCount: 6908857, deallocCount: 6558581)"
23:58:54FromDiscord<Clyybber> niice
23:59:05Yardanicoyeah it's still much less than before
23:59:12Yardanico~100mb leak for asynchttpserver for ~400k requests
23:59:13disbotno footnotes for `100mb`. 🙁
23:59:22disruptekmight create some real competition here.