<< 18-01-2020 >>

00:00:09*Hideki_ quit (Ping timeout: 268 seconds)
00:00:32Araqnot yet, i'm currently not fixing somebody else's codebase
00:00:33rayman22201valgrind says it doesn't leak
00:00:45disruptekrayman22201: i agree it looks pretty inescapable.
00:00:45Araqused -d:useMalloc?
00:00:50rayman22201yup
00:01:11disrupteklemme try
00:01:19Araqmaybe it's still accessible via the gDispatcher
00:01:40Araqand I dunno if valgrind reports stuff in globals
00:02:20Araqor maybe there is yet another arc bug so that it forgot to update some refcount
00:02:32rayman22201It does, because I get "possible leaks" from the gDispatcher
00:02:38rayman22201which I'm ignoring :-P
00:02:48disruptekyep, says no leak.
00:03:09disruptekonly two allocs.
00:03:12AraqI would trust my nose.
00:03:31Araqthe cycle jumps into your face, something else is going on
00:03:39*krux02__ joined #nim
00:03:46disruptekorc has nothing to say about it.
00:03:54rayman22201well, that's part of my problem. I don't see the cycle
00:04:04rayman22201I thought I saw the cycle, and now I don't trust myself
00:04:21Araq.closure --> resFut
00:04:35AraqresFut --> callback seq --> .closure
00:04:36Araqno?
00:05:03disruptekyep.
00:06:27rayman22201so why doesn't valgrind or orc detect it?
00:06:45disruptekit doesn't even work.
00:06:49Araqcheck getOccupiedMem()
00:06:52rayman22201it works for me
00:07:04Araqrun it in a loop and see getOccupiedMem's numbers
00:07:25AraqI found that the most reliable way to look for leaks by far
00:07:27rayman22201I wonder if it's because I short circuit it by completing the Future immediately
00:07:30*krux02_ quit (Ping timeout: 265 seconds)
00:07:38Araqthat's possible, sure
00:07:43Araqanyhow
00:07:43rayman22201that's horrible. we need better tools :-P
00:08:00rayman22201ok go to sleep. gn Araq. thanks
00:08:14Araqit's excellent, most of my tests use it
00:08:24Araqlet mem = getOccupiedMem()
00:08:27AraqcrazyStuff()
00:08:35Araqassert getOccupiedMem() == mem
00:08:47disruptekyeah, there's a nice debugging template in golden for this.
00:08:54disruptekspec.nim
00:09:17disruptekactually, iirc it's not that nice. it just collects all the calls i could find.
00:09:27Araq var resFut {.cursor.} = newFuture[string]("asyncProc")
00:09:35Araqshould work out
00:09:42Araqthen the captures don't harm
00:09:57Araqand we return it anyway, no need to refcount it
00:10:54Araqbut same here, have to sleep. good night
00:11:00disruptekpeace
00:11:37disruptekthat solves the problem here, but it relies on the programmer to break the cycle.
00:12:21rayman22201https://play.nim-lang.org/#ix=27GU
00:12:25rayman22201this crashes
00:12:37rayman22201so it's the `callback=` proc after all
00:12:40disruptekthis isn't an .async. proc.
00:12:50disruptekthis asyncProc() you gave me.
00:12:55disruptekis defective.
00:13:31rayman22201lol. I'm building Futures by hand to explore the mechanism
00:13:46disrupteki want my money back.
00:13:51rayman22201I'm not going to use the macro to see what part of the macro is broken.
00:14:06rayman22201100000000 schmecles. here you go
00:14:12disrupteksshh there are people in the back that didn't hear you.
00:14:52disruptekanyway, programmers gonna write stupid code. i have no plans to stop.
00:15:36disruptekwe have it solve this properly.
00:15:40disruptekto
00:17:01rayman22201I don't think this is improper
00:17:04rayman22201you build this into the macro
00:17:04disruptekfirst i gotta eat the rest of this box of thin mints.
00:18:13rayman22201fascinating. Making it .cursor. limits the leak to 72 bytes
00:18:34disruptekso the only futures they use are ours?
00:19:05nisstyreSomething odd is going on with my program. I'm expecting to get "19.5" but I get "6.25" https://play.nim-lang.org/#ix=27GV
00:19:17nisstyreI've verified the algorithm is giving the correct output, so it must be some floating point issue
00:22:33nisstyreoh
00:22:35nisstyrenevermind
00:23:12nisstyrederp
00:23:19rayman22201I bet it's the closure here that's leaking: https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncfutures.nim#L279
00:23:33rayman22201as usual, araq is probably right :-P
00:23:34nisstyreI'm not popping items off the stack
00:25:50rayman22201but IDK what araq is talking about. removing that closure is a can of worms
00:26:12rayman22201it makes callSoon not work.
00:26:24rayman22201callSoon then needs the Future object somehow
00:28:31rayman22201I get it now
00:28:42rayman22201both what araq was saying and what I was saying is true
00:28:44rayman22201ugghhh
00:28:48rayman22201It's two things
00:28:51rayman22201both creating cycles
00:29:58rayman22201so check this out: https://play.nim-lang.org/#ix=27GZ
00:30:00rayman22201that is leak free
00:31:43disrupteki get it.
00:31:56disrupteki just really wonder if this is safe.
00:32:21disrupteki can't really see how we can prevent people from using the cursor.
00:33:41rayman22201actually nope. I took out the cursor. still no leak
00:33:48rayman22201I also did the getOccupiedmem thing
00:33:53rayman22201still no leak
00:33:54rayman22201so wat
00:35:03rayman22201https://play.nim-lang.org/#ix=27H0
00:35:09disruptekhmm, you're right.
00:35:10rayman22201no leak
00:35:14rayman22201bu
00:35:20disruptekwhat else do you have in your branch?
00:35:38rayman22201but this leaks: https://play.nim-lang.org/#ix=27H1
00:35:46rayman22201nothing
00:36:45disruptekokay, this leaks, but not recursing doesn't?
00:37:02rayman22201right, the point is not the recursion, but the self reference capture
00:37:16rayman22201actually it does recurse once
00:37:17disruptekyeah, so we need another half-way point.
00:37:34rayman22201this is weird. getOccupiedMem says no leaks, but valgrind says yes leaks
00:38:11disrupteki guess that makes sense, right?
00:40:15rayman22201how?
00:41:01disruptekclosureRef doesn't need to refcount it.
00:41:31rayman22201I took out the .cursor, so it should still refcount
00:44:42disrupteki got no leaks in orc.
00:45:00rayman22201well yeah, orc can do cycles :-P
00:45:09disrupteki just have too much output.
00:45:31rayman22201comment out the echos
00:46:41*brainproxy quit (Quit: WeeChat 2.7)
00:47:15disruptekyeah, i have no leaks in arc.
00:47:31disruptekjust recursing with a cursor.
00:47:46disruptekbut it still feels like a huge ask to me.
00:47:54rayman22201I'm confused
00:48:14disruptekit feels like a lot to ask of the dfa or of the programmer.
00:48:20disruptekor of the macro, even.
00:48:34rayman22201but my example doesn't have a cursor
00:48:36rayman22201I took it out
00:48:44disruptekyeah, i changed it.
00:48:58rayman22201I can't read your mind. please share
00:49:10disruptekvar window {.cursor.}: typeof(closureRef)
00:49:55disruptekso the way we have a weak ref is to make a new ref, weak, and use that instead.
00:50:46FromGitter<aboisvert> compiling code with `--gc:arc`, I'm getting: ⏎ ⏎ /home/boisvert/.choosenim/toolchains/nim-#devel/lib/system/threads.nim(104, 28) template/generic instantiation of `add` from here ⏎ /home/boisvert/.choosenim/toolchains/nim-#devel/lib/system/seqs_v2.nim(117, 21) Error: system module needs: nimDestroyAndDispose [https://gitter.im/nim-lang/Nim?at=5e2256655b81ab262e450320]
00:51:05*fys quit (Remote host closed the connection)
00:51:29disruptekdoes that make sense?
00:51:46FromGitter<aboisvert> does this point to some sort of missing destructor for one of my types, or is this because --gc:arc is not yet ready for my code?
00:52:08rayman22201I see. fascinating
00:52:14disruptekit looks like a choosenim problem.
00:52:32disruptekbut, i cannot read pastes on gitter.
00:52:51disruptekthere was a new choosenim released recently.
00:54:10*tane quit (Quit: Leaving)
00:54:13disruptekso, i'd update choosenim first. then if you still have the problem, please paste the output where we can read it.
00:55:52FromGitter<aboisvert> got it, i'll try that, thanks!
00:57:02*lritter quit (Quit: Leaving)
00:59:04rayman22201I'm trying to plugin cursor annotations to the macro output, and I'm still leaking
00:59:16rayman22201this confuses me even more
00:59:51voltistThis error is a great moment in my life: "Error: unhandled exception: key not found: intestine [KeyError]"
00:59:52disruptekhttp://ix.io/27H4/nim
01:00:06disruptekintestines really are key.
01:00:14disruptekdon't let no one tell you different.
01:00:27FromGitter<aboisvert> updated choosenim, same error. also compiled nim from source and used latest `devel` branch, same thing.
01:01:19rayman22201disruptek, yeah I'm with you there. But when I try to go to the next step. plugging it back into the async macro output, it doesn't work
01:01:30disruptekwhat does it say?
01:02:09rayman22201https://www.irccloud.com/pastebin/ikVaPDQU/
01:02:28disruptekwell, shit, ray.
01:02:32disruptekthat's hardly nothing.
01:02:52disruptekyou know how many gigs of memory my machine has?
01:03:16FromDiscord<exelotl> are pattern matching templates a stable feature?
01:03:28FromDiscord<exelotl> I can't see them in the manual anywhere
01:03:31disrupteklike what?
01:03:57rayman22201https://play.nim-lang.org/#ix=27H5
01:04:07rayman22201am I missing a cursor?
01:04:14rayman22201lol, get moar RAM naow!!!
01:04:21FromDiscord<exelotl> in this video
01:04:21FromDiscord<exelotl> https://cdn.discordapp.com/attachments/371759389889003532/667897019490369546/unknown.png
01:04:48disruptekit's, like, impossible to view this image for me.
01:04:54rayman22201term rewriting macros are experimental
01:04:55disrupteki dunno why discord is so mean.
01:04:58rayman22201that's what that is
01:05:23rayman22201it's not really "pattern matching" anyway
01:05:35disruptekit's like scope.
01:06:08rayman22201https://nim-lang.org/docs/manual_experimental.html#term-rewriting-macros
01:06:38FromDiscord<exelotl> ahh so that's where I've seen it before
01:07:25rayman22201disruptek: also note, the getOccupiedmem diff shows 0 lol
01:07:40disruptekmemory comes, memory goes.
01:07:55*JustASlacker quit (Ping timeout: 265 seconds)
01:07:57rayman22201you just can't trust your memory these days :-P
01:08:04disrupteki really can't.
01:09:11disruptekwhat were you expecting?
01:09:37disrupteksorry, i just finally looked at the code.
01:10:02rayman22201I took what we learned from that simple example, and tried to apply it to the real thing
01:10:10rayman22201i.e. add cursor in all the right places
01:10:20rayman22201I failed to get the right places :-P
01:10:33disruptekright.
01:10:34rayman22201I got friends in low places?
01:10:44*icebattle quit (Ping timeout: 258 seconds)
01:11:31rayman22201what am I missing here? there is some cursor annotation I'm missing
01:12:08disruptekso we need to call the callbacks with a ref to the closure if they're gonna use it for anything.
01:12:26disruptekso we give them a {.cursor.}.
01:13:08rayman22201you can see me doing that with "closureWindow"
01:13:54disruptekoh i see. now i think it's the callback= call.
01:14:04rayman22201and just for grins, I made the ref to the Future a cursor
01:14:20disruptekyeah, that's fine.
01:14:29rayman22201but callback= happens in the simple example too
01:14:32rayman22201no leaks there
01:14:42disruptekoh, maybe you did it right. sorry, let me look again.
01:14:44rayman22201how is this closure different?
01:15:53disruptekso one other thing is that we need to point every reference to the closure at the window.
01:15:53rayman22201once we fix this, I will try to tell you why I think adding cursor to the macro is good enough :-P
01:16:10rayman22201I thought I did that too
01:16:15rayman22201but maybe I missed one?
01:16:19disruptekwell you can't threaten me with a good time like that.
01:16:41rayman22201lol
01:16:59disrupteki don't see recursion here.
01:18:12disruptekthe callback should be getting closureWindow as an argument.
01:18:17disruptek2nd arg.
01:18:38disrupteknext_gensym400019 is the first arg; that's the future, baby.
01:18:41disruptekTHE FUTURE.
01:20:27disruptekcursor to the macro.
01:21:30rayman22201GREAT SCOTT! We need 1.21 gigawattz
01:21:41*luis_ quit (Quit: luis_)
01:21:49disruptekis that right?
01:21:52disruptekthat doesn't sound right.
01:22:30rayman22201fun fact. making the closure iterator use the cursor to the promise makes it "leak more clean", as in valgrind has less output.
01:22:46rayman22201but still 8mb of leakage
01:23:29disruptekthere are few things finer than making valgrinds thinner.
01:23:48disruptekbut why do you leak?
01:24:05disruptekc'mon i want a victory here.
01:24:24rayman22201I know I know. I feel sooo close
01:25:39disruptekremember this crash bug? https://play.nim-lang.org/#ix=27H9
01:30:41rayman22201lol. I do now
01:32:20disruptek~return is in prior versions of nim, a reliable method of dumping the compiler's memory to disk.
01:32:21disbotreturn: 11in prior versions of nim, a reliable method of dumping the compiler's memory to disk.
01:42:22rayman22201hahaha
01:42:40rayman22201ok. I have to take off. I am at a loss at this point
01:43:24*Hideki_ joined #nim
01:47:11disruptekalright, have a good one.
01:48:27*Hideki_ quit (Ping timeout: 272 seconds)
01:50:22rayman22201it's something with closure iterators
01:50:25rayman22201lol. I lied
01:51:14rayman22201I think .cursor on closure iterators might be broken?
01:51:49disruptekwell, the powers that He are certain that iterators are fine.
01:52:56disruptek~araq is πŸ‘‘ the powers that He πŸ‘‘
01:52:57disbotaraq: 11πŸ‘‘ the powers that He πŸ‘‘
01:57:59rayman22201ok, check this out: https://play.nim-lang.org/#ix=27Hd
01:58:06rayman22201minimum repro
01:58:14rayman22201it leaks
02:00:19rayman22201I think it has something to do with the fact that assignment for iterators is overloaded to give you the "iterator instance"
02:00:45rayman22201and that is the thing I want a cursor of
02:00:55rayman22201but because it's implicit magic, I can't do that
02:01:02disruptekah, that makes sense.
02:01:07rayman22201or tldr .cursor. doesn't work on iterators
02:01:14rayman22201and it kind of needs to
02:01:18disruptekbut i'm surprised it just overlooks the cursor.
02:01:23disrupteki mean, the pragma.
02:01:35disruptekit makes me think maybe that magic is less likely.
02:01:42rayman22201well, that's my hand wavy guess
02:01:56rayman22201I don't actually know what is going on here
02:02:00disruptekyeah, i get it.
02:02:35rayman22201ok. I have to go for real now. But I think this is good progress. Something to show araq when he wakes up anyway :-)
02:02:36rayman22201gn
02:02:41disruptekcya
02:03:07disruptekasync is leak-free in the lab but not production, basically.
02:03:48rayman22201lol. yup.
02:11:28*smitop quit (Quit: Connection closed for inactivity)
02:21:23*matti quit (Ping timeout: 265 seconds)
02:22:30*matti joined #nim
02:35:33*Hideki_ joined #nim
02:51:58*Hideki_ quit (Remote host closed the connection)
02:52:45*Hideki_ joined #nim
02:57:18*Hideki_ quit (Ping timeout: 258 seconds)
03:18:49*dddddd quit (Remote host closed the connection)
03:33:04*Hideki_ joined #nim
03:44:55voltistI had a runaway intestine problem https://imgur.com/a/VjgkYkN
03:45:28disruptekthose are the worst.
03:45:50voltistQuite
03:46:20voltistAlso, I'm quite dissapointed by the lack of good graphing libraries for Nim
03:46:36voltistThe best I found works using the browser
03:46:46disruptekplotly?
03:47:07voltistYeah
03:47:14disruptekyeah, i wish we had a nice svg grapher.
03:47:40voltistIt hasn't got a great API either
03:48:05voltistPython's matplotlib is simple but powerful, and its great
03:48:52*seni quit (Quit: Leaving)
03:50:10disrupteksomeone smart will give us something amazing.
03:50:29voltistHopefully
03:50:43disrupteki leave cookies out every night.
03:51:30voltistFor now I just have to investigate runaway intestine problems with web-based graphs
03:51:56disrupteknimetry is a thing i've used.
03:51:59disruptek!repo nimetry
03:52:00disbothttps://github.com/refaqtor/nimetry -- 9nimetry: 11Plotting in Nim 15 0⭐ 1🍴
03:52:01*Hideki_ quit (Ping timeout: 268 seconds)
03:52:42voltistHuh, I'll check it out
03:53:18Yardanicodisbot: and you didn't even star it!11
03:53:50Yardanicoi mean disruptek, sorry
03:53:52disruptekwhat a jerk.
03:53:54*logand` joined #nim
03:54:10disrupteki think because i pulled it out of golden.
03:55:36*muffindrake quit (Ping timeout: 252 seconds)
03:56:49FromDiscord<mfiano> Hello again
03:57:47disruptekwb mfiano
03:57:53*muffindrake joined #nim
03:58:06FromDiscord<mfiano> I'm still weighing on whether I want to use Nim for new (rare) projects of mine, or scrap what for the most part amounts to my life's work and rewrite it in Nim.
03:58:11*logand quit (Ping timeout: 268 seconds)
03:59:49disrupteki think almost all code is too valuable to delete.
04:00:11disruptekit's one thing to rewrite it, but it's madness to remove/cripple it.
04:01:00FromDiscord<mfiano> This is true, especially since it isn't very possible in many other languages, to this extent anyway, and it's very mature and almost usable at this point. But, it's all I hardly ever work on, and I'm desperately trying to find ways to integrate Nim into my everyday work.
04:01:49disruptekshould be able to mix it into your existing stuff.
04:02:06disruptekit's probably worth doing well for both communities.
04:03:38FromDiscord<mfiano> My existing thing is a game engine comparable to Unity, written in CL, with full support for interactive development. Recompile a texture definition DSL to point to a new image on disk with new texture parameters and see it update instantly in game. Change a material definition to see the shader program and uniforms changed instantly. Change an individual shader function and see the entire program and its dependencies rebuilt instantly, etc
04:03:48FromDiscord<mfiano> It has taken my more than 10 years already...
04:03:53FromDiscord<mfiano> It has taken me more than 10 years already...
04:04:32disruptekhave you played with hot code reloading yet?
04:06:01FromDiscord<mfiano> Yes, and I think anyone familiar enough with it can admit it has a few limitations, and for me they dissuade me from relying on it at all still.
04:06:20disruptekwhat are the issues with it?
04:07:52FromDiscord<mfiano> I'd have to open up my notes to answer that, but I noticed they coincided with some videos I watched about reloading things too early to crash everything
04:08:37disrupteki dunno anything about it, but i'm ruminating on trying a repl.
04:11:30FromDiscord<mfiano> I'm actually no longer wishing to find a language offering the level of interactivity of Common Lisp, because I've been looking for years and nothing comes close, in an effort to actually start using something that isn't CL πŸ™‚
04:12:12disrupteki can understand that.
04:13:35FromDiscord<mfiano> What dissuades me more, is I kinda feel like I should know C before I start using Nim (at least for the type of real-time code I would be writing), and I am accustomed to working in a managed language. Yes, I know Nim has quite a few different GC strategies (or none at all), but in reading a lot of Nim code and listening to others in the community, I feel I ought to be familiar with manual memory management and other C-isms at least somewhat
04:14:09disruptekeh i don't think it's so useful.
04:15:19FromDiscord<mfiano> Like I still can't grasp references and ownership I hear so much about these lower level languages.
04:16:07disruptekit's not really required to understand in order to be productive, though.
04:17:49FromDiscord<mfiano> I bought Nim in Action and found a lot of the projects to be hard to understand, particularly because I'm not very familiar with parallelism abstractions like async/await and promises/futures, among other reasons.
04:18:26FromDiscord<mfiano> So at this point I'm wondering what a real good first step would be
04:18:45shashlickStart with porting something simple over
04:18:56disruptekbuild something you need.
04:18:56shashlickLess than 50 lines worth
04:19:26FromDiscord<mfiano> I don't really need anything. I program as a hobby, and mostly the same game engine for a decade now :/
04:19:45disruptekah i can't help but to write stuff.
04:21:58shashlickam now trying to port px from Python to Nim since I'll never maintain it otherwise
04:23:24FromDiscord<mfiano> Yeah...I will. What I don't know yet. I will say I have studied in great depth several dozen languages, new and old, over the last few years, and Nim is the only one that I can relate to. Gotta hand it to Araq and contributors once more for that.
04:24:20disruptekhard to look at other languages the same way.
04:24:29shashlickhow about you share small snippets and we can help you port something
04:24:34shashlickget a feel for stuff
04:27:54FromDiscord<mfiano> Most of my code is heavily macro based to defer evaluation for DSLs and whatnot. I'm not sure I could provide such a contained example so readily
04:29:03disrupteksounds like you're in a tough situation.
04:29:25FromDiscord<mfiano> But how about for starters, pointing me to a library, if one exists, that allows writing GLSL in a Nim DSL, such that I can hot-reload a single shader function to force the recompilation of all shader programs making use of this function...or offering advise on how to do that in Nim.
04:29:45disruptekkrux02 is the expert in this.
04:29:47FromDiscord<mfiano> But how about for starters, pointing me to a library, if one exists, that allows writing GLSL in a Nim DSL, such that I can hot-reload a single shader function to force the recompilation of all shader programs making use of this function transitively...or offering advise on how to do that in Nim.
04:29:57disruptekhe has a glsl compiler in nim macros.
04:30:25disruptekactually, i think he has a youtube video demonstrating how to port to it.
04:30:43FromDiscord<mfiano> I'd be interested in that video if you can find it πŸ™‚
04:31:26disruptekhttps://invidio.us/embed/mcMr142BxtI
04:32:36FromDiscord<mfiano> I guess I would start by writing y own linear algebra library, even though I'm sure one exists. Lots of challenges await writing one that is correct, performant, and with a nice API. It took me years to iterate on the one I use for my game engine anyway.
04:32:42FromDiscord<mfiano> I guess I would start by writing my own linear algebra library, even though I'm sure one exists. Lots of challenges await writing one that is correct, performant, and with a nice API. It took me years to iterate on the one I use for my game engine anyway.
04:35:21*rockcavera quit (Remote host closed the connection)
05:04:38FromDiscord<mfiano> disruptek, while that video was pretty neat, it doesn't do what I was talking about. There is no-reuse of GLSL functions between different shader programs. The entire stage is stored in a constant as a raw string, and just included in this very simple DSL.
05:04:42*jwm224 quit (Quit: WeeChat 2.8-dev)
05:28:09*ptdel quit (Remote host closed the connection)
05:42:11*martinium joined #nim
06:38:03FromDiscord<Rika> hello
06:44:15*narimiran joined #nim
06:56:34Zevvleorize[m]: what was the cause of your 0x555555559ab2 bug the other day?
06:56:44*marmotini_ joined #nim
07:00:51*marmotini_ quit (Ping timeout: 240 seconds)
07:07:13shashlickgosh async is a nightmare
07:07:40shashlicki need to call an async proc in a callback which isn't async
07:08:39Zevvshashlick: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
07:10:11shashlicktl;dr, will read later πŸ˜„
07:10:32shashlickif i cannot call my async proc, i have to read all this data into memory instead of writing it thru
07:10:41*marmotini_ joined #nim
07:11:38*marmotini_ quit (Remote host closed the connection)
07:11:54*marmotini_ joined #nim
07:15:16Zevvwell, you can call it
07:15:18Zevvbut you can't wait for it
07:15:26FromDiscord<Rika> async can be waited for
07:15:33FromDiscord<Rika> with `waitFor`
07:15:47FromDiscord<Rika> but it's gonna be treated like a sync function
07:15:53Zevvyeah sure, but it blocks the rest of the callback stuff that is no async :)
07:17:27shashlickya but it doesn't work correctly
07:17:36shashlickthe return value is interpreted incorrectly by the caller
07:17:58shashlickFuture[cint] return value
07:18:37shashlickif i remove Future[cint] {.async.} and comment out the proc, return value works fine
07:19:46*martinium quit (Quit: Textual IRC Client: www.textualapp.com)
07:20:46FromDiscord<Rika> ?
07:21:16shashlickthat's nice, AsyncSocket has isClosed, but Socket does not
07:23:14FromDiscord<Rika> yeah there's a lot of stuff nim's types have when async but dont when sync
07:23:20FromDiscord<Rika> not sure why
07:23:32FromDiscord<Rika> some make sense though
07:24:25FromDiscord<Rika> Zevv, `I promise the future is better`
07:24:28FromDiscord<Rika> lmao the article
07:24:50shashlickwow the net and asyncnet are totally different APIs, that's really not good
07:26:24*solitudesf joined #nim
07:32:27FromDiscord<Rika> hmm, rfc proposal of unifying the async and sync library APIs?
07:38:26*nsf joined #nim
07:40:42FromGitter<gogolxdong> could not load: avutil-(|55|56|57).dll , have avutil.dll under the same directory.
07:40:59*NimBot joined #nim
07:41:10shashlickit is looking for avutil-xx.dll
07:41:37Yardanico@gogolxdong are you sure the architectures of the DLL and binary match?
07:41:41Yardanicothey should both be 32-bit or 64-bit
07:42:42FromGitter<gogolxdong> which does nim need? or depends on cpu arch?
07:49:35*marmotini_ quit (Remote host closed the connection)
07:59:56*marmotini_ joined #nim
08:00:00*gmpreussner quit (Quit: kthxbye)
08:03:00skrylar[m]i'm not sure why you would explicitly need nim macros to compile shaders? really just any old preprocessor would do. especially since you can just {.gulp.} or staticexec the results at build time anyhow...
08:04:50*marmotini_ quit (Ping timeout: 240 seconds)
08:04:56*gmpreussner joined #nim
08:06:21*marmotini_ joined #nim
08:08:25Zevvcan anyone with compiler knowledge tell my how this can work? http://ix.io/27HP
08:09:09Zevvoh dang nevermind, too soon again
08:12:17*gmpreussner quit (Ping timeout: 265 seconds)
08:13:06Araqgogolxdong: avutil-(|55|56|57).dll
08:13:10Araqshould be
08:13:21Araqavutil(|-55|-56|-57).dll
08:21:16*go|dfish quit (Ping timeout: 265 seconds)
08:23:07*go|dfish joined #nim
08:26:23*Trustable joined #nim
08:29:04*marmotini_ quit (Remote host closed the connection)
08:32:53*filcuc joined #nim
08:36:07FromGitter<gogolxdong> yes, I found that and it's also a 32 bit dll. :)
09:16:25*tane_ joined #nim
09:18:39FromGitter<dawkot> is there a good reason to not add multiple values to the same table key?
09:19:32*tane_ left #nim (#nim)
09:20:09*tane joined #nim
09:20:24*JustASlacker joined #nim
09:29:50*filcuc quit (Ping timeout: 258 seconds)
09:32:51*JustASlacker quit (Ping timeout: 240 seconds)
09:35:02Zevvwell that was funny
09:35:05Zevvsometimes alloc is alloc
09:35:08Zevvand sometimes alloc is alloc0
09:35:14Zevvthat makes for nice surprises
09:36:30Zevvand that took me longer then I dare to admit
09:41:20zedeushttps://github.com/microsoft/verona
09:41:46zedeus@mratsim seen this?
09:45:40*JustASlacker joined #nim
09:55:52FromDiscord<Recruit_main_70007> What’s the name of the vectors library??
10:03:09FromDiscord<Rika> what vectors library??
10:03:14FromDiscord<Rika> @Recruit_main_70007 what do you mean
10:03:23*ng0_ joined #nim
10:03:46FromDiscord<Recruit_main_70007> there was one, but i dont remember
10:03:51FromDiscord<Rika> nimglm?
10:03:56FromDiscord<Recruit_main_70007> i think
10:03:59FromDiscord<Recruit_main_70007> thx
10:04:02Zevvarraymancer?
10:04:57Zevvnah
10:05:52*ng0 quit (Ping timeout: 265 seconds)
10:32:31*Hideki_ joined #nim
10:33:13dom96hello hello
10:37:32dom96disruptek, just because choosenim is in the path of an error doesn't mean it's to blame :P
10:37:34*sagax quit (Ping timeout: 265 seconds)
10:39:44*ng0_ is now known as ng0
10:41:18*dddddd joined #nim
10:41:45narimiranhey dom96, did you see yesterday's pings about nim forum being noticeably slow(er) lately?
10:42:46dom96narimiran, nope, link?
10:42:56narimiranhttps://forum.nim-lang.org/ :D :D
10:43:25narimiranit was in the offtopic channel, IIRC
10:44:04dom96Don't see it in there
10:44:04narimiranlong story short: several people (me included) noticed that the forum has been slow in the last 10 days or so
10:44:59dom96Cool, it's been running for almost 3 months non-stop now
10:45:43dom96It leaks itself into either slowness or a crash :D https://gist.github.com/dom96/8293bacf49026023f8213ae5a5f4144d
10:46:05dom96Anyway, I restarted it
10:46:09dom96Maybe that will help
10:47:06narimiranok, i'll let you know if i'll still notice the slowdowns
10:47:43narimirancurrently it feels much faster, btw
10:48:01narimiranoh yeah, big difference
10:50:30*letto quit (Quit: Konversation terminated!)
10:50:35dom96great :)
10:53:53*filcuc joined #nim
10:53:55*Trustable quit (Remote host closed the connection)
10:59:35*filcuc quit (Read error: Connection reset by peer)
10:59:49*filcuc joined #nim
11:04:11*voltist quit (Remote host closed the connection)
11:09:51*filcuc quit (Quit: Konversation terminated!)
11:10:09*filcuc joined #nim
11:12:23*letto joined #nim
11:12:42*sagax joined #nim
11:13:09*nsf quit (Quit: WeeChat 2.7)
11:15:01*filcuc quit (Client Quit)
11:15:13*filcuc joined #nim
11:20:11*filcuc quit (Quit: Konversation terminated!)
11:20:24*filcuc joined #nim
11:21:27*Hideki_ quit (Remote host closed the connection)
11:21:45*Hideki_ joined #nim
11:27:03FromGitter<mratsim> @zedeus thanks for Verona, looks very interesting
11:29:14*tane quit (Quit: Leaving)
11:29:15*filcuc quit (Ping timeout: 240 seconds)
11:36:02*letto quit (Read error: Connection reset by peer)
11:38:09*Hideki_ quit (Remote host closed the connection)
11:39:28*Hideki_ joined #nim
11:43:59*Hideki_ quit (Ping timeout: 265 seconds)
11:48:22Zevvwoot, down to 2324 bytes
11:54:10dom96Zevv, what's that?
11:56:39shashlickgosh struggling to get selectRead working
11:56:48shashlickanyone written a select loop with SocketHandle before?
11:57:07Zevvdom96: getting the minimal hello world down for deep embedded systems
11:57:10dom96shashlick, sure
11:57:18Zevvdom96: throwing out thrash
11:57:45dom96Zevv, have you seen https://hookrace.net/blog/nim-binary-size/ ?
11:58:15shashlickdom96: I am trying to bridge a net.Socket with a libcurl socket handle
11:58:27shashlickI am getting correct file handle values for both
11:58:44dom96shashlick, why are you trying to do this? :)
11:58:50Zevvdom96: sure, but this is *with* usable stdlib using --gc:arc
11:59:06shashlicktrying to create a an http proxy with libcurl as the backend
11:59:10shashlickto do the auth and what not
11:59:27dom96Zevv, I see. You should write an article with your experiences :)
11:59:40Zevvnah, I'm just PRing the stuff
11:59:50dom96shashlick, why is httpclient not enough?
12:00:09shashlickcause i want libcurl to handle NTLM auth
12:00:15shashlickof an upstream proxy
12:00:31shashlicki already have written px in python which works well enough but am trying Nim + libcurl
12:01:04shashlickso please help me bridge the two sockets so that an SSL CONNECT can be bridged
12:01:49dom96Okay, what's your code look like?
12:03:19shashlickhttp://ix.io/27Iq/nim
12:03:24shashlickline 85 onwards
12:03:53shashlicki have the curl handle which is talking to an upstream proxy as ssocketH and csocketH is the client connected to my http server
12:04:59shashlickby that point, the client is ready to initiate an SSL handshake with the end site going through my proxy as well as the upstream proxy
12:06:12dom96I would suggest giving the selectors module a try
12:06:29shashlicki tried that first and that didn't seem intuitive
12:06:32shashlickplus no docs
12:07:20shashlickthe weird thing is that selectRead tells me that the upstream proxy is ready to read from (readFds does not contain ssocketH) but at this point, the client should be sending data
12:07:38shashlickI end up trying to read on line 105 and it fails with -1
12:07:49shashlicksz = -1
12:08:17shashlickhere's the curl client talking to my http server - http://ix.io/27Ir
12:08:20dom96That is weird, but I doubt this API is used much
12:08:25dom96It's possible it's broken
12:08:29dom96Tbh I think we should deprecate it
12:08:56dom96Selectors is pretty straightforward, just create a new selector, register your FDs on it, then call select
12:09:22shashlickok but do I need to just register Read events or Write as well?
12:09:26*Hideki_ joined #nim
12:09:35dom96Then you'll get precisely which FDs are readable/writeable without having to deal with selectRead's weird logic of "if it's not in the list then it's readable" which gets confusing easily
12:09:37shashlickcause this is bidirectional
12:09:48dom96Do you want to know when the socket is writeable?
12:10:09dom96note that you will get write events instantly if you're not writing a lot into the socket
12:10:34shashlickokay I see - so I register both sockets for both events
12:10:41shashlicklet me try that and see what i get
12:10:58shashlickshouldn't have chucked my older code
12:11:22dom96At that point you might even be better off using async await, https://nim-lang.org/docs/asyncnet.html#newAsyncSocket%2CAsyncFD%2CDomain%2CSockType%2CProtocol
12:11:53shashlickheh, that's where I started but I cannot run an async proc to write back to the client in curl's callback which isn't async
12:12:10dom96Why not?
12:12:22shashlickfor some reason, the return value gets garbled
12:12:31shashlickFuture[cint] where it is the number of bytes written
12:12:43FromDiscord<Recruit_main_70007> how can i make a try connect function?
12:12:44FromDiscord<Recruit_main_70007>
12:12:44FromDiscord<Recruit_main_70007> aka, try to connect my socket, regardless of errors, and exit the function once it has connected
12:12:57shashlickanyway, this is working now in principal, i just want to verify that connect works, if not this is all moot
12:13:00dom96shashlick, sounds like you were closer to a solution with that approach
12:13:27shashlickwell, now HTTP works, i couldn't get that working how I wanted with async
12:13:34shashlickso i'm using threads for now
12:14:29dom96I tend to steer away from threads if I can help it, more often than not they make things far harder to debug than they should be.
12:15:54shashlicki found the async stack traces impossible to figure out
12:16:14shashlickanway, do you have a selectors sample i can look at?
12:17:05dom96httpbeast is the only one I have: https://github.com/dom96/httpbeast/blob/master/src/httpbeast.nim#L268
12:17:09FromDiscord<Rika> @Recruit_main_70007 you just need a while loop and a try except with an empty except statement
12:17:39FromDiscord<Recruit_main_70007> ```proc try_connect*(self: Bot, add: string = "localhost", port: Port) =
12:17:39FromDiscord<Recruit_main_70007> while true:
12:17:39FromDiscord<Recruit_main_70007> try:
12:17:39FromDiscord<Recruit_main_70007> self.rootsocket.connect(add, port)
12:17:42FromDiscord<Recruit_main_70007> echo("Bot: ", self.name, " connected to server on address: localhost, on port: ", port)
12:17:42FromDiscord<Recruit_main_70007> except:
12:17:44FromDiscord<Recruit_main_70007> discard``` like this?
12:17:51dom96please don't paste code into Discord, use a pastebin
12:18:05FromDiscord<Recruit_main_70007> sorry
12:18:21FromDiscord<Rika> yeah that's pretty much all you need
12:18:41FromDiscord<Rika> feels like you're making a discord/irc bot
12:18:48FromDiscord<Rika> or a chat bot in general
12:18:53*JustASlacker quit (Ping timeout: 258 seconds)
12:18:57FromDiscord<Recruit_main_70007> Rocket league one
12:23:05*krux02 joined #nim
12:27:19*Hideki_ quit (Remote host closed the connection)
12:28:03*Hideki_ joined #nim
12:32:55*Hideki_ quit (Ping timeout: 268 seconds)
12:33:27*Hideki_ joined #nim
12:34:43*Hideki_ quit (Remote host closed the connection)
12:37:14*Hideki_ joined #nim
12:46:08*Trustable joined #nim
12:51:20shashlickdom96: that helped, it is working now but the TLS data sent is being rejected
12:51:40shashlickmust be cause i'm treating it as string or something
12:57:08*JustASlacker joined #nim
13:04:50FromGitter<kaushalmodi> @timotheecour Why was nimdoc.css renamed to nimdoc.out.css? https://nim-lang.github.io/Nim/nimdoc.out.css
13:21:18*Hideki_ quit (Remote host closed the connection)
13:22:09*Hideki_ joined #nim
13:26:43*Hideki_ quit (Ping timeout: 260 seconds)
13:30:51*tane joined #nim
13:34:02FromGitter<nothratal> hello together
13:36:40FromGitter<nothratal> is anyone aware of any possibilities building android apps using nim? Through ndk maybe...
13:36:42FromGitter<kaushalmodi> I am stumped with this error: https://github.com/nim-lang/Nim/issues/13191
13:36:44disbotβž₯ Running nim doc give OSError [devel regression] ; snippet at 12https://play.nim-lang.org/#ix=27IK
13:37:34FromGitter<kaushalmodi> I wish that OSError "Error: unhandled exception: No such file or directory [OSError]" gave more info as to which exact file or directory was not found
13:40:03FromGitter<kaushalmodi> I've build nim devel as usual using the same build script.. so wondering how the build could have gone wrong. Assuming my build is fine, it's even more surprising that the Nim CI passed.
13:40:16dom96nothratal: its been done, look around the forum
13:45:15*rockcavera joined #nim
13:46:55*Vladar joined #nim
13:57:57*Hideki_ joined #nim
14:08:03*Ven`` joined #nim
14:09:41*drewr joined #nim
14:13:05disruptekso i have hand-written async leak-free but we cannot seem to get the macro to produce the same result.
14:13:24disruptekdom96: maybe you want to take a look?
14:13:52dom96sure
14:14:45*Trustable quit (Remote host closed the connection)
14:15:21disruptekhere's a repro: https://play.nim-lang.org/#ix=27IY
14:16:35dom96do you have the original async proc as well?
14:17:18disruptekhttps://play.nim-lang.org/#ix=27J1
14:19:37*dddddd quit (Ping timeout: 265 seconds)
14:19:47*Hideki_ quit (Ping timeout: 268 seconds)
14:19:57*Ven`` quit (Read error: No route to host)
14:20:18*akitoshi joined #nim
14:20:26*Ven`` joined #nim
14:21:29dom96disruptek, how do you test whether the leak exists or not?
14:21:44disrupteki use valgrind
14:23:54disruptekwith various machinations, i can get it down to just one leak, but luckily for us, 1 != 0.
14:24:16*dddddd joined #nim
14:24:38dom96Here is the valgrind results for both examples: https://gist.github.com/dom96/62dd60239d84d63cf3ce861172ef47d3
14:24:57dom96not sure which metrics to look at, but both seem very similar
14:25:28disruptekhmm, that's useful because my results are different on linux.
14:27:05disruptekyou're using -d:useMalloc?
14:27:56dom96just --gc:arc
14:28:08dom96maybe I should be using something else?
14:29:09disruptekyou should use -d:useMalloc.
14:29:28dom96just -d:useMalloc? or with --gc:arc?
14:29:40disruptekwith arc
14:29:55disruptekwe're trying to find leaks in arc; the default gc is fine.
14:30:03*ikan-keli_2 quit (Ping timeout: 240 seconds)
14:30:11disruptekso we'll either compare two pieces of code or two gcs.
14:30:26disruptekgc:orc should be leak-free on the leaky code you have.
14:30:41disruptekit's just arc we're trying to fix.
14:30:43dom96why is -d:useMalloc necessary?
14:30:51dom96anyway, it shows the leak now
14:31:25disruptekit simplifies the allocs according to the gc logic without any optimizations.
14:32:18disruptekcoffee, brb
14:33:53Zevvdisruptek: good job dude
14:35:48ZevvI just found an interesting problem with the useMalloc allocShared family, `allocShared` and `allocShared0` have some magic header for keeping track of the allocation size, but `reallocShared` just did a C realloc. *boom*
14:36:33dom96That sounds like a big problem
14:37:08Zevv*if* someone would use useMalloc together with threads
14:38:17ZevvI've been digging through the undergrowth over the last few days, and what confuses me most is the pleora of possible paths depending on gc and memory options
14:39:07dom96yeah, there is no way all these combinations are tested even a little
14:39:10Zevvoption A does import X, but option B might do 'include Y' where something is when'ed out depending on defined(this) or something == "something"
14:39:30ZevvI guess its the price you pay for portability, but stuff can really need some polishing
14:41:48*jwm224 joined #nim
14:51:10*ikan-keli_ joined #nim
14:52:28disruptekZevv: ray did the hard part of reducing the problem.
14:53:29ZevvI missed the discussion, does this require async API changes or something like that?
14:55:39disrupteknah.
14:56:32Zevvso what's the status on async+arc now?
14:56:58disruptekhonestly?
14:57:09disrupteki think my solution is a hack that doesn't solve the problem.
14:57:26Zevvnwah
14:57:33disruptekbut i also think we need to prove that we need a separate weakasgn before we add it.
14:57:43*xet7_ joined #nim
14:57:48Zevvno clue what that is about.
14:58:02disruptekcopies that don't +rc.
14:58:07Zevvright
14:58:30*ptdel joined #nim
15:00:07disrupteki guess what i'm saying is that i think i fixed a contrived test but that real code won't work correctly.
15:00:21disruptekbut, we don't know yet.
15:01:07*krux02 quit (Remote host closed the connection)
15:01:30Zevvand you wouldn't want to add that unless absolutely necessery
15:01:43lqdev[m]is there a way of passing an object between macro calls? eg. one macro generates an nnkCall that calls another macro, and that macro accepts some compile-time objects with NimNodes
15:01:48Zevvyou should make an impementation that zaps you every time you type weakasgn()
15:01:51lqdev[m]:s/objects/object/
15:01:54disrupteklol
15:02:14disrupteklqdev: macros can call compile-time procs that aren't macros.
15:02:29disruptekit's hard to distance what you wrote from what i wrote.
15:02:42lqdev[m]disruptek: not possible in my case.
15:03:11disrupteki think you understand this better than i do.
15:03:20lqdev[m]see this for example: https://github.com/liquid600pgm/euwren/blob/master/src/euwren.nim#L1010
15:03:46lqdev[m]it'd be pretty easy if not for the NimNodes
15:04:07lqdev[m]that I want to store in an object
15:04:34disrupteki think you want to separate out the impl from the macro and then you can reach it easily from both pieces of code.
15:05:30disrupteki just don't want to add an escape hatch because i don't want anyone to use it.
15:06:51*xet7 quit (Quit: Leaving)
15:07:44lqdev[m]I wish I could do that. unfortunately, I need to have another helper macro call because I need to run another semantic pass on it
15:07:59lqdev[m]so not really possible to keep it in just one macro
15:08:54Zevvlqdev[m]: can you store it in a global {.compileTime.} var?
15:10:11*filcuc joined #nim
15:10:44ZevvI do something similar in npeg: https://github.com/zevv/npeg/blob/master/src/npeg/grammar.nim#L12
15:10:51lqdev[m]Zevv: probably, but I wanted to have it in an object to avoid using global compileTime vars :)
15:11:04Zevvyeah, but you can't pass it around over macro's
15:11:14Zevvyou can only pass around Nim AST
15:12:47*nsf joined #nim
15:13:10*Hideki_ joined #nim
15:14:32*filcuc quit (Client Quit)
15:15:44*ng0_ joined #nim
15:16:09*ng0_ is now known as n0
15:18:35*filcuc joined #nim
15:18:40*ng0 quit (Ping timeout: 258 seconds)
15:18:57*n0 is now known as ng0_
15:19:21*ng0_ is now known as ng0
15:23:57*pbb_ quit (Remote host closed the connection)
15:25:13*pbb joined #nim
15:29:12Zevvbwah got it all working but now I broke something on 32 bit only :/
15:29:51*filcuc quit (Quit: Konversation terminated!)
15:32:24*filcuc joined #nim
15:32:59*filcuc quit (Remote host closed the connection)
15:33:07*pbb quit (Quit: No Ping reply in 180 seconds.)
15:38:35*Hideki_ quit (Remote host closed the connection)
15:39:39*Hideki_ joined #nim
15:40:18*Hideki_ quit (Remote host closed the connection)
15:40:31*Hideki_ joined #nim
15:40:42dom96disruptek, yeah, based on that code it seems like it was gutted far too much to be useable in the async macro
15:40:52dom96I tried applying just the {.cursor.} pragmas but the leak is still there
15:41:25*filcuc joined #nim
15:41:29disruptekwell, the first one can't work because we need futures to outlive the procs that create them.
15:41:49*Hideki_ quit (Remote host closed the connection)
15:42:01disruptekbut we might be able to get away with the weak one.
15:42:15dom96which is "the first one"?
15:42:57*Tyresc joined #nim
15:42:59disruptek`var resFut = newFuture...`
15:43:02*Hideki_ joined #nim
15:43:49dom96ahh, you're referring to the {.cursor.} annotations
15:44:10disruptekright, i was replying to your comment.
15:44:18dom96do we have any docs on these pragmas?
15:45:04disruptekmaybe, but it's simple: cursor is a read-only view.
15:45:44Zevvar_q, are you available?
15:46:47dom96that's not well enforced by the compiler then
15:46:59dom96since I've marked something with that pragma and it's clearly mutated
15:48:01disruptekno, i mean you're not supposed to rely upon it as you might a normal ref.
15:49:44dom96I'm not sure what that means
15:50:00*Hideki_ quit (Ping timeout: 265 seconds)
15:50:16disruptekit cannot be sunk.
15:50:31dom96This seems to have some details https://github.com/nim-lang/RFCs/issues/177
15:50:32disbotβž₯ Unify Nim's GC/memory management options ; snippet at 12https://play.nim-lang.org/#ix=24Ua
15:51:29disruptekyes, that's accurate afaik
15:51:45disruptekthat's why i call it `weak`.
15:51:52dom96it looks like {.cursor.} does nothing in the noleak sample
15:51:56dom96I removed them and there is still no leak
15:52:48dom96This sample has been too far stripped down, the closure iterator isn't there at all
15:53:27disruptekright, so this is the problem.
15:54:00disruptekwe can't figure out how to produce a weak/cursor on the iterator.
15:54:25disruptekthat's where you come in. πŸ˜‰
15:54:37*pbb joined #nim
15:55:35dom96My guess is: there is no compiler support for this :P
15:57:13disruptekright, it's possible.
15:57:55disruptekthe code compiles but it doesn't yield the expected behavior.
16:00:55*JustASlacker quit (Ping timeout: 265 seconds)
16:01:01*Hideki_ joined #nim
16:03:44disrupteki think i got it.
16:04:52disruptekwe do async work using the cursors but we actually yield the rc'd pointers.
16:05:52disrupteki really don't have to work on this right now, but here's an example of what i mean:
16:05:56disruptekhttps://play.nim-lang.org/#ix=27JC
16:06:03disruptek^ don't have time to work on this
16:06:50disruptekmore succintly: https://play.nim-lang.org/#ix=27JD
16:07:41dom96is it a requirement to keep re-creating each variable with {.closure.}?
16:07:56dom96er, *{.cursor.}
16:08:02dom96i.e. can't you just mark `future` with {.cursor.}?
16:08:06*Vladar quit (Quit: Leaving)
16:08:22disruptekno, we need the future to outlive the proc.
16:09:54*JustASlacker joined #nim
16:10:48*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:11:50*Hideki_ quit (Ping timeout: 268 seconds)
16:11:58disruptekof course, i still don't know if this will be correct. but it's still leak-free at least.
16:12:20dom96https://gist.github.com/dom96/bd14faf86a426d9365a95ff49e74e74a
16:12:25dom96I tried it like this
16:12:26dom96still leaks
16:13:17*jwm224 quit (Ping timeout: 260 seconds)
16:13:21disrupteknext.callback line has to point to the weak closureref.
16:15:22*jwm224 joined #nim
16:15:37dom96huh? `closureRef` is already weak
16:17:33disruptekyou're right.
16:18:04disruptekdon't make it a let, maybe a cursor on a let isn't weak (because why should it be?)
16:18:39disruptekproc asyncnimproc... = ...
16:18:54disruptekclosureref = asyncnimproc...
16:19:12dom96changed `asyncProcNimAsyncContinue_404016` to be `var`
16:19:14dom96still leak
16:19:20dom96I'll let you try more if you wish
16:19:23dom96I need to get some work done
16:19:41disruptekyeah, me too.
16:20:39*narimiran quit (Ping timeout: 268 seconds)
16:25:35*JustASlacker quit (Ping timeout: 268 seconds)
16:29:56*akitoshi quit (Quit: Connection closed for inactivity)
16:32:17*narimiran joined #nim
16:38:37*JustASlacker joined #nim
16:43:05*Ven`` joined #nim
16:54:50*filcuc quit (Ping timeout: 240 seconds)
16:57:59dom96Just found this picture: FOSDEM 2018 https://i.imgur.com/jlSnHog.jpg. Can you guess who's who? :P
16:58:33narimirani recognise 3 of 6
17:02:40dom96Which people are those? :)
17:03:14ZevvI think i've seen the middle guy on the left in a picture somewhere. And the rightmost dude seems fimiliar
17:03:17narimiranyou, M. next to you, and A. on the right
17:04:33dom96Cool. Does that mean I can write I'm famous on my resume? :P
17:04:42Zevvc'mon, you wrote a *book*
17:06:01dom96In my experience, programming books don't bring much fame, especially ones written about a (for now at least) niche language.
17:06:28Zevvyou should have become a rock star then I guess :)
17:07:54dom96You guys coming to FOSDEM then? :)
17:08:42Zevvdisruptek, you've been staring at arc for some time. I have a bug ending with a SIGSEGV in nimDestroyAndDispose because of funny pointers getting derefenrenced, but *only* on 32 bits. Clean valgrind run on 64 bits though. If you have any hunches, let me know
17:08:59disruptekgimme a repro.
17:09:02Zevvdom96: I will. I planned for a flash visit on sunday only, but I changed my mind and booked a room an tickets
17:10:28Zevvdisruptek: sweet. https://github.com/zevv/Nim/tree/zevv-allocwork is the branch, https://github.com/nim-lang/Nim/pull/13190#issuecomment-575912348 is the reproduction
17:10:30disbotβž₯ Cleanup, remove lib/system/allocators.nim. seqs_v2 and strs_v2 now uses allocShared0.
17:10:31dom96Zevv, cool, I'll be coming with my girlfriend so I it's unlikely I'll be around full-time for both days, but definitely will be there for the Nim talks.
17:10:56Zevvdom96: and one beer, at least!
17:12:45Zevvdisruptek: I'm not sure if I have caused the bug, or merely caused it to surface. It gets triggerd by a test that was once added to fix a similar segfault. The branch is a cleanup of some convoluted allocators and simplifies by always using plain allocs for strs_v2 and seqs_v2 for -d:useMalloc. The funny thing is that this crash does not even occur with -d:useMalloc
17:12:49*Hideki_ joined #nim
17:13:26ZevvI'll do some dining and wining now, well deserved. If you get a chance to take a peek, much obliged
17:13:57disruptekkk, i will look.
17:14:14disruptekbut the fact that it doesn't occur with -d:useMalloc is telling.
17:28:41*letto joined #nim
17:31:43*JustASlacker quit (Ping timeout: 260 seconds)
17:36:03*Hideki_ quit (Ping timeout: 240 seconds)
17:37:07*natrys joined #nim
17:44:28*JustASlacker joined #nim
17:47:05Zevvtelling what?
17:48:45*Pixeli joined #nim
17:50:09*Pixeli quit (Client Quit)
17:50:22*Pixeli joined #nim
17:57:03*solitudesf quit (Remote host closed the connection)
17:57:21*solitudesf joined #nim
18:08:20Zevvoh refs_v2 was also where you were poking around right
18:22:08*narimiran quit (Ping timeout: 268 seconds)
18:22:27*abm joined #nim
18:23:37*nsf quit (Quit: WeeChat 2.7)
18:25:02FromDiscord<Clyybber> Zevv: found you in a link https://www.youtube.com/watch?v=zevvyp9esIY :p
18:26:08Zevvwut?
18:26:22FromDiscord<Clyybber> look at the link πŸ™‚
18:26:39Zevvsuper flu - selee
18:26:49FromDiscord<Clyybber> the link, as in the URL
18:26:54Zevvoooh :)
18:27:40Zevvhow do you even *notice* something like that
18:27:45Zevvthat's just like, random noise
18:28:03FromDiscord<Clyybber> I'm always on the lookout not to get rickrolled
18:28:32FromDiscord<Rika> what gui library would yall recommend
18:28:44*abm quit (Ping timeout: 268 seconds)
18:28:44FromDiscord<Clyybber> imgui
18:29:02FromDiscord<Clyybber> or do you mean native?
18:29:27Zevvnative is dead
18:29:33FromDiscord<Rika> what do you mean by native
18:29:42FromDiscord<Rika> ah
18:29:56FromDiscord<Rika> native's pretty dead yeah but its "easier" at the start
18:30:23FromDiscord<exelotl> Personally I've got my eyes on https://github.com/treeform/fidget
18:31:58*abm joined #nim
18:32:00FromDiscord<Rika> i do too
18:33:51FromDiscord<Clyybber> yeah, it looks amazing
18:35:22*narimiran joined #nim
18:36:14Zevvdisruptek: minimized the trigger to http://ix.io/27Kn
18:36:36FromDiscord<Rika> imgui looks game-esque
18:36:51FromDiscord<Clyybber> yeah, its mainly for games
18:36:57FromDiscord<Rika> im not making a game ;;
18:37:18FromDiscord<Clyybber> then I'd say fidget too πŸ™‚
18:39:14FromDiscord<exelotl> I tried nigui and it's ok, but kinda missing a lot of stuff. I like iup a lot though
18:40:20FromDiscord<exelotl> Don't hear people talking about it much
18:40:26FromDiscord<Rika> iup?
18:40:42FromDiscord<Rika> i'm mainly looking for a lib that can work on windows and linux at lease
18:40:47FromDiscord<Rika> least
18:42:22Araqiup's major issue is the lack of OSX support
18:45:03FromDiscord<exelotl> Same for nigui I think (unless using gtk on osx is really OK)
18:45:47shashlickanyone has experience debugging TLS?
18:45:50FromDiscord<exelotl> My experience using gimp on my work MacBook has been rather painful though
18:47:07Zevvshashlick: some, but it's no fun
18:47:41shashlickokay so I'm working on an http proxy server that is setting up a CONNECT tunnel
18:48:07shashlickand am sending the remote server the TLS hello from the client but the server just disconnects
18:48:41shashlickactually, i'm struggling with how to recv data from a socket without knowing the length
18:48:58shashlickif I set my buffer too big, the recv hangs
18:49:05Zevvasync?
18:49:34shashlickno regular sockets cause I couldn't use async in the callbacks
18:49:37Araqgtk on osx is really *not* ok IME
18:50:23disruptekso glad i don't need to be a part of that anymore. no disrespect.
18:50:28shashlickbasically I'm reimplementing http://github.com/genotrance/px in Nim but using libcurl to do all the heavy lifting on the remote side
18:50:54FromDiscord<Recruit_main_70007> Shashlik, send a header with the message, and then recv that header number of data
18:51:05Zevvshashlick: for regular sockets, blocking is the expected thing
18:51:16disrupteki think philosophically, i'll be happier in life as a windows-denier.
18:51:37shashlickI started with asyncHttpServer but it didn't go too far
18:51:48Zevvand SSL is nasty under the hood, since a TLS recv/read might require any combination of socket writes or reads
18:51:58shashlickanyway, this is at the point when the connect tunnel is setup so i'm in the select loop just moving data back and forth
18:52:06shashlickand there's no way to know how much each socket will be sending
18:52:09shashlickblind mitm
18:52:25Zevvbut you're doing the event loop stuff yourself now?
18:53:08Zevvbecause that is not trivial with tls. If your socket is indicated as writable, that might indicate that you can do a TLS read, etc
18:53:33ZevvOpenSSL has this api for telling you if it wants to read or write on its socket, that is all abstacted away in asyncnet
18:53:54dom96yep, and it was a massive pain to fix all the major bugs it had
18:54:11ZevvI did that two times for other languages, and it is a pain indeed
18:54:47shashlickas far as I'm concerned, there is no SSL in my code
18:54:55shashlickthe transaction is between the client and end server
18:55:01shashlicki'm just a dumb tunnel talking plain http
18:55:12shashlickcreated a repo - https://github.com/genotrance/px2/blob/master/curl.nim#L109 - that's where the select loop starts
18:55:44shashlickand by this point, it's not even http, it's just bridging the data
18:56:01Zevvyou're doing curl multi in your own event loop?
18:56:14Zevvbecause curl also has this mechanism, it has a callback for you to tell you which fd's to watch for what events
18:56:28FromDiscord<Recruit_main_70007> You should, in the server, get the length of the message, send that first and then the message, in the client, receive a low amount of data, probably 2 bytes, a first time, then receive a second time that number you have received, then you have a full message
18:56:36shashlickeffectively, but it is this way because i need to bridge the end client socket which has nothing to do with curl
18:56:40FromDiscord<Recruit_main_70007> Hold up, I might have a pastebin
18:57:08shashlickif i could include that fd in curl multi, then life will be easier yes
18:57:42shashlickRecruit_main_70007: like I said, this is all encrypted data between client and server, being a proxy I cannot make any sense o fit
18:58:41shashlickI have a similar event loop in the original python version but recv(4096) does not hang
18:58:42shashlickhttps://github.com/genotrance/px/blob/master/px.py#L900
19:00:15Zevvdom96 knows a lot about the implementation, maybe you can set the underlying socket to nonblocking and hope that the layers above that handle that properly
19:01:21shashlickI got over the select loop thanks to his input and httpbeast code
19:01:27shashlickeven that wasn't working in the first place
19:01:51FromDiscord<Rika> hello i am back
19:02:00FromDiscord<Rika> iup/nigui not having osx support is fine for me
19:02:06FromDiscord<Rika> i'm not targeting osx
19:02:13FromDiscord<Rika> ill look into them
19:03:06shashlickokay that isn't my problem right now - neither fd is ready for read after the connect
19:03:31shashlicklet me debug further 😐
19:04:30FromDiscord<Recruit_main_70007> I had this problem, but I was being sent a header... Idk, receive data 1 character at a time, and have a try each time you receive data, there is an option to make your socket wait for data for only some time, and then in except, break the loop
19:04:58Zevvshashlick: good luck, the pain is real
19:05:00lqdev[m]is there a way of specifying test dependencies in nimble?
19:05:10FromDiscord<Recruit_main_70007> *Some time before raising an error*
19:05:14shashlickat least this isn't dealing with async stack traces
19:05:19shashlickthose are almost useless
19:05:27shashlicklqdev: not yet
19:05:35shashlickthanks Recruit, will do
19:06:21lqdev[m]dang it. I have a glm Vec[N, T] specific error I need to check for in euwren's test suite, but then I'd have to add it to the regular deps for everything to work fine
19:09:26*Cthalupa quit (Ping timeout: 258 seconds)
19:11:28disrupteklqdev[m]: no, there's no concept of development dependencies.
19:11:42disruptek!search nimph development dependencies
19:12:39disruptekdisbot: awake?
19:12:39disbotyep. 😊
19:17:03*solitudesf- joined #nim
19:18:38*solitudesf quit (Ping timeout: 258 seconds)
19:19:55ZevvAraq: you got a minute? I could use some hints
19:22:15FromDiscord<Rika> is the iup wrapper maintained?
19:23:40ZevvI get an arc crash that only manifests on i386 and goes away with -d:useMalloc.
19:24:13ZevvThe problem is that the bug is in my own Nim branch. It is the only test case that breaks, and I'm not sure if I caused the bug or that it just happens to popup now
19:25:09*Ven`` quit (Ping timeout: 258 seconds)
19:26:02*Ven`` joined #nim
19:33:18*Hideki_ joined #nim
19:36:50*xet7_ quit (Quit: Leaving)
19:37:19*xet7 joined #nim
19:37:59*Hideki_ quit (Ping timeout: 268 seconds)
19:39:56lqdev[m]how do I check if a sym is `typedesc`? not asking for `typeDesc[T]` or any of that crap, just for *literal* `typedesc`. `sym.typeKind == ntyTypeDesc` won't work because it'll also catch `typeDesc[T]`, `sym == bindSym"typedesc"` also doesn't work for some reason
19:41:23lqdev[m]`sym == sym.getTypeInst` seems to work, though I'm afraid it might break at some point
19:41:50lqdev[m]taking that last statement back, no it doesn't work
19:43:36lqdev[m]right now my only idea would be to check if `sym.repr == "typedesc"`, but it's probably horrible af
19:49:22*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:53:30FromDiscord<Clyybber> why do you not want to catch typedesc[T] too?
19:54:17FromDiscord<exelotl> is there a way to mark a variable as write-only?
19:54:18*kungtotte quit (Read error: Connection reset by peer)
19:54:31FromDiscord<Rika> exelotl what do you mean
19:55:16FromDiscord<exelotl> you can do `foo = 10`, but not `let a = foo` or `echo foo`
19:55:22*kungtotte joined #nim
19:55:35FromDiscord<Rika> w-why
19:55:46FromDiscord<exelotl> hehehe
19:55:51FromDiscord<Rika> i legitimately fail to see the reasons to do so
19:56:45Yardanicouhh, how can I debug an OOM crash? :D
19:56:57Yardanicovalgrind?
19:58:40FromDiscord<exelotl> it's a "variable" imported from C, to access a memory-mapped IO register on the GBA
19:58:55FromDiscord<exelotl> `#define REG_BG0HOFS *(vu16*)(REG_BASE+0x0010) // Bg0 horizontal scroll`
19:59:23FromDiscord<Clyybber> so if its a register why disallow reading from it?
19:59:31FromDiscord<exelotl> afaik the hardware enforces that it's write only
19:59:43FromDiscord<Clyybber> oh
19:59:59FromDiscord<Rika> make it a function then
20:00:46Yardanicoor an object with a function so you can have dot access without () :P
20:01:15FromDiscord<mfiano> Is vmath the go-to library for game linear algebra?
20:01:26FromDiscord<Rika> or a hacky macro
20:01:54FromDiscord<Clyybber> @mfiano never heard of it
20:01:56Yardanico[Heap] string: #2365; bytes: 58943474881
20:01:57Yardanicojesus
20:01:57FromDiscord<Clyybber> !repo vmath
20:01:58disbothttps://github.com/nim-lang/Nim/issues/2365 -- 5Can't access argument in proc from stmt passed in to a template ; snippet at 12https://play.nim-lang.org/#ix=27LM
20:01:59disbothttps://github.com/treeform/vmath -- 9vmath: 11Math vector library for graphical things. 15 3⭐ 0🍴
20:02:11FromDiscord<exelotl> I've used vmath and it's good, I like it
20:02:43FromDiscord<Clyybber> @mfiano hehe, if its made by treeform I guess so
20:02:48FromDiscord<mfiano> I'm particularly looking for something with support for both quaternions and dual quaternions. Looks like I'll have to reinvent the wheel here
20:02:49FromDiscord<exelotl> "glm" seems to be more popular though
20:03:18FromDiscord<exelotl> but I prefer vmath because there's less magic going on under the hood
20:03:45FromDiscord<exelotl> I can read the source without having to enter galaxy brain mode
20:09:09*luis_ joined #nim
20:10:55*Ven`` joined #nim
20:15:25*JustASlacker quit (Ping timeout: 268 seconds)
20:18:26*luis_ quit (Remote host closed the connection)
20:19:13*luis_ joined #nim
20:19:14*Pixeli quit (Read error: Connection reset by peer)
20:19:18Yardanicouhh
20:19:29Yardanico"items" should be okay for iterating over an enum, right?
20:19:41Yardanicoseems like it's broken for enums with holes
20:20:30Yardanicohttps://play.nim-lang.org/#ix=27LT that code executes forever on runtime
20:21:00Yardanicoah I see why, probably coz there are too many values to iterate over
20:23:40disruptekforever is a pretty long runtime.
20:23:46Yardanicowell I didn't run it forever
20:23:50Yardanicosadly I don't have such possibilities
20:24:25disrupteki almost ran something for forever.
20:25:00FromDiscord<mfiano> Can someone explain ref types to me as a newbie?
20:25:23Yardanico"ref object" is a managed (by GC) pointer to an object
20:25:26FromDiscord<mfiano> i see `Ref object of foo` and `Ref foo` a lot. No clue what's going on
20:25:41Yardanicoso you can pass it between procedures and modify, and modifications will be available everywhere
20:25:57Yardanicoif you have "object", you'd have to use "var YourType" in prodecures to pass your object as a reference
20:26:03Yardanicoto be able to modify it from other procedures
20:26:11*nsf joined #nim
20:26:14disruptekalso, a ref is a managed pointer that points to heap memory.
20:26:25Yardanicohttps://forum.nim-lang.org/t/1207 has some info about that
20:27:12FromDiscord<mfiano> If I was writing a math library with say a vec3 type and I wanted to write 2 procs for each operation, one that allocates a new result, and one that mutates an existing vec3, how would i do that?
20:28:25Yardanicowell, vectors are usually "object" I guess, so you will need to define procs to modify vectors inplace as proc modify(myvec: var vec3) = stuff
20:28:40Yardanicoand new result as proc modify(myvec: vec3): vec3 = stuff
20:30:02FromDiscord<mfiano> Ah so i dont use a ref type, ok
20:34:16FromDiscord<mfiano> Does Nim have arity overloading?
20:34:26FromDiscord<mfiano> Or would I need 2 names for those 2 ops?
20:34:29Yardanicowhat's that?
20:34:40FromDiscord<mfiano> Same function, different number of arguments
20:34:43Yardanicoyes, you can
20:34:46FromDiscord<mfiano> Same function name, different number of arguments
20:35:54*luis_ quit (Quit: luis_)
20:36:40FromDiscord<Rika> ah man why is the hardest part of setting up a project thinking of the name of the project
20:36:50FromDiscord<Rika> i need a name then i can start with programming
20:37:58solitudesf-https://nim-lang.org/docs/tut1.html
20:38:03*solitudesf- quit (Quit: Leaving)
20:38:19*solitudesf joined #nim
20:38:51solitudesf~tutorial is intro to sacred manuscripts: https://nim-lang.org/docs/tut1.html
20:38:52disbottutorial: 11intro to sacred manuscripts: https://nim-lang.org/docs/tut1.html
20:43:29FromDiscord<mfiano> Can someone explain to me where the precision error is coming from here, since I'm not accumulating anything? https://gist.github.com/mfiano/3c724bf2aab2e75e5dd1118f6391b044
20:43:41Yardanicothat's how floats are represented in hardware
20:43:49Yardanicohttps://0.30000000000000004.com/
20:47:00*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:47:48Zevvwell, well, that is one *nasty* bug
20:47:55FromDiscord<mfiano> Odd. I can't reproduce that in any other language
20:48:04FromDiscord<mfiano> Only when accumulating values
20:48:07Yardanico@mfiano are you sure?
20:48:18Yardanicomaybe your language just converts the string representation to a shorter value
20:48:20Zevvlow level realloc allocates 16 bytes blocks when you alloc smaller, and when reallocing bigger it does not memzero the remaining bytes up to 16
20:48:30FromDiscord<mfiano> Yes. In Common Lisp, Python, and a couple others I just tried. 4.2 is self-referential
20:48:52Yardanicoand btw, "f32" is useless
20:48:57Yardanicoit's mapped to float64 in nim anyway :)
20:49:27FromDiscord<mfiano> Scientific: 4.2e+0, Decoded: 1.0 * 0.525 * 2^3, Digits: 24, Precision: 24
20:49:37disruptekZevv: is that true?
20:49:58Zevvdisruptek: https://play.nim-lang.org/#ix=27LZ
20:49:59disrupteklooking forward to looking at your code.
20:50:04FromDiscord<mfiano> How can I ensure 32 bit floats then?
20:50:12Zevvlet me annotate that and sen da new link, one moment
20:50:25Yardanico@mfiano why would you need to though?
20:50:27disrupteki can read it
20:50:30Yardanicoshort answer - just don't :P
20:50:42disruptekso this is very interesting.
20:51:06FromDiscord<mfiano> Because when passed as a uniform to GLSL it should be 32 bit. Khronos points out the double precision floats are a real performance trap on the GPU
20:51:32Zevvdisruptek: https://play.nim-lang.org/#ix=27M1
20:51:36ZevvThis was pretty nasty
20:52:35Yardanico@mfiano well, i don't really do graphical programming in nim, but I think that it's not really an issue, although I can't really answer
20:53:00FromDiscord<mfiano> IT most certainly is in the type of work I do. doubles are slow for the work I do on the GPU
20:53:03FromDiscord<mfiano> It most certainly is in the type of work I do. doubles are slow for the work I do on the GPU
20:53:14Yardanicobtw, your messages are sent yet again when you edit your message ;)
20:53:15krux02__Zevv, does 'realloc' really zero the memory, because I doubt it does.
20:53:28FromDiscord<mfiano> and casting every shader operation because the inputs are doubles is probably slower
20:54:49krux02__As far as I know, NVIDIA Gpus are artificially slowed down on double precision, because they can charge extra money for that.
20:55:36FromDiscord<mfiano> > GL_DOUBLE​: A 64-bit double-precision floating-point value. Never use this. It's technically legal, but almost certainly a performance trap. Equivalent to GLdouble.
20:55:46FromDiscord<mfiano> That's a quote from Khronos
20:56:02Yardanicowell, as I said, people have been making games in nim, even 3D ones, and I think they all solved it somehow
20:57:00FromDiscord<mfiano> Heh, even half floats are common for some buffer types
20:58:26Yardanicoyou can ask on the forum, more people visit it over the days than watch the real time chat :)
21:00:04FromDiscord<Zachary Carter> I use 32 bit floating point values in Nim all the time
21:00:24FromDiscord<Zachary Carter> specifically when writing code for graphics programming
21:00:49FromDiscord<Zachary Carter> and not doubles
21:01:09FromDiscord<Zachary Carter> so I'm not sure what you're referring to Yardanico
21:01:21Yardanicowell, even from system.nim
21:01:22Yardanico"# 'float64' is now an alias to 'float'; this solves many problems"
21:01:32Yardanicohmm wait xd
21:01:35FromDiscord<Zachary Carter> yeah
21:01:36FromDiscord<mfiano> Umm
21:01:39FromDiscord<Clyybber> yes, but float32 is still 32 bit
21:01:42FromDiscord<Zachary Carter> that's if you' dont specify `float32`
21:01:43Yardanicooh
21:01:46FromDiscord<Zachary Carter> float32 is definitely 32 bits
21:01:54FromDiscord<Clyybber> only in the VM we use float64 for everything
21:02:00FromDiscord<mfiano> whew πŸ˜…
21:02:12Yardanicothen I misread that line as "float32 is float" or something like that
21:02:14Yardanicosorry :)
21:02:20solitudesf@mfiano thats just how its presented on output, you can just look at the memory
21:12:06*narimiran quit (Ping timeout: 258 seconds)
21:14:54*Ven`` joined #nim
21:14:59FromDiscord<Zachary Carter> https://play.nim-lang.org/#ix=27Ma
21:15:11FromDiscord<Zachary Carter> anyone know why I'm getting: `/usercode/in.nim(38, 1) Error: cannot instantiate: 'path[Spaceship, tuple[x, y: int], float]'`
21:15:12FromDiscord<Zachary Carter> ?
21:23:49*abm quit (Quit: Leaving)
21:25:26*filcuc joined #nim
21:25:43*jjido joined #nim
21:26:41*natrys quit (Quit: natrys)
21:28:31FromDiscord<DeltaPHC> Don't know the answer there, but are `concept`s considered stable enough to use? They're considered an experimental feature at the moment
21:30:50dom96I still personally avoid them and would recommend for others to do the same. We are still likely to get some new syntax/semantics for them AFAIK
21:35:10FromDiscord<DeltaPHC> They *look* really useful, just that the syntax looks a tad obtuse. Maybe that's just me
21:37:48*Jesin quit (Quit: Leaving)
21:43:38FromGitter<nothratal> good evening
21:44:01*Jesin joined #nim
21:45:57FromDiscord<Avatarfighter> Hello everyone !
21:46:04FromGitter<nothratal> is there a way to tell the compiler to search the whole source file for procs and not starting at the line number of the occurrence? Do you get what I mean?
21:46:23Yardanicosounds like you need a forward declaration or enable reodering?
21:46:25Yardanico*reordering
21:46:56Yardanicotry with {.reorder: on.} at the top of the file
21:47:23Yardanicoif it still errors, you'll need to make a forward declaration (basically only the signature of the procedure without it's definition, so the compiler will know that such procedure exists)
21:48:45FromGitter<nothratal> @Yardanico Thank you! That's exactly what I meant
21:48:59FromGitter<nothratal> reorder...didn't think of this word
21:49:22Yardanicowell, it won't work if you have a recursive dependency (first proc depends on second proc, and second proc depends on the first proc)
21:49:28Yardanicoin that case you'll need forward declarations anyway
21:49:36FromGitter<nothratal> by the way, compiler tells me it's deprecated, please use: ⏎ ```{.experimental: "codeReordering".}```
21:49:42FromGitter<nothratal> but does the same
21:49:43Yardanicowell yeah, do that :)
21:49:49Yardanicoit's an experimental feature after all
21:50:05FromGitter<nothratal> @Yardanico good to know! Still learning a lot.
21:50:47FromDiscord<Avatarfighter> Is there a way to allow a proc to potentially return different types based on the input ?
21:51:10Yardanicoyes, it's basically same as generic types, lemme show you
21:51:41Yardanicoalthough be aware that the code which checks which type should be used as return value should be compile-time
21:52:06Yardanicoyou can't return "string" if your proc receives "hello" at runtime, and "int" if it receives "5"
21:52:25Yardanicosince nim is not dynamically typed :)
21:52:30FromDiscord<Avatarfighter> yeah πŸ™‚
21:52:37FromDiscord<Avatarfighter> I guess I'm trying to do the impossible atm
21:52:42*jholland__ quit (Quit: Connection closed for inactivity)
21:52:46Yardanicowhat are you trying to do though?
21:54:13FromDiscord<Avatarfighter> I was trying to grab the value of a key from a Table but the value of the key is a type that could have an int/string/Table/seq and I wanted to return the type that the value of the key is holding. I hope that makes sense lol
21:54:19FromDiscord<Avatarfighter> I'll send code if it doesnt
21:54:37Yardanicopls send it as a paste though, not in discord, because it'll look ugly in IRC otherwise :)
21:54:49FromDiscord<Avatarfighter> Yeah of course πŸ™‚
21:55:11Yardanico@Avatarfighter for your task you might be able to use object variants
21:55:20FromDiscord<Rika> tables can only hold one type as value though
21:55:27Yardanicoyes, so you can use object variants
21:57:01FromDiscord<Avatarfighter> variants?
21:57:06FromDiscord<Avatarfighter> Never heard of those lol
21:57:13Yardanicohttps://nim-lang.org/docs/manual.html#types-object-variants
21:57:19Yardanicoi'll try to make an example with tables now
21:57:24FromDiscord<Avatarfighter> here is what my code looks like in case you're interested, I removed parts
21:57:25FromDiscord<Avatarfighter> https://dsh.re/13690
21:57:43FromDiscord<Avatarfighter> Ohh I'm using Variants lmao
21:57:47Yardanicoyes you are xD
21:57:50FromDiscord<mfiano> So about that gist, if someone can explain to me what is going on. Particularly, why a f32 is being printed with the precision of a double float, and only when it's in a type?
21:57:52FromDiscord<Rika> https://play.nim-lang.org/#ix=27Mv something like this
21:58:02FromDiscord<Rika> oh
21:58:03Yardanicowell, I see what you mean, you can't do that sadly
21:58:04FromDiscord<Rika> i am late
21:58:13Yardanicoyou might have to pass that object into your other objects
21:58:41FromDiscord<Avatarfighter> Yeah I assumed I couldn't but that's fine πŸ˜› I was just looking to optimize my code by like two characters
21:58:54Yardanicoalso btw, a small enhacement
21:59:19Yardanicoah nvm, it won't work here anyway, but just in case, for your future code
21:59:38Yardanicohttps://play.nim-lang.org/#ix=27My
21:59:57Yardanicoif all branches in "case" return value of the same type (and that case covers all possible branches), you can do this
22:00:01Yardanicoassign it to a variable
22:00:12FromDiscord<Avatarfighter> oh whaaaat
22:00:25FromDiscord<Avatarfighter> I didn't even realize you could do that
22:00:29Yardanicoand if one of your branches throws an error, it'll still work, because the compiler knows that after exception there's no chance of survival :P
22:00:35FromDiscord<Avatarfighter> wow
22:00:42FromDiscord<Avatarfighter> That's really cool
22:00:45FromDiscord<Avatarfighter> The more you know πŸ˜›
22:01:01Yardanicohttps://nim-lang.org/docs/manual.html#statements-and-expressions-case-expression
22:01:07Yardanicoits all documented in the manual :)
22:01:21FromDiscord<Rika> i should sleep
22:01:26FromDiscord<mfiano> I just don't understand how I can have 2 printed representations of the same number, with one of them using the precision of the wrong float type: https://play.nim-lang.org/#ix=27Mz
22:01:43FromDiscord<Avatarfighter> Oh uh I definitely haven't actually read the manual, I've been learning via the search index lol
22:01:55FromDiscord<Rika> you should read the manua
22:02:02Yardanicoyou'll find a looot of features in the manual
22:02:05FromDiscord<Avatarfighter> I probably should lol
22:02:47FromDiscord<Rika> @mfiano https://play.nim-lang.org/#ix=27MA look at this
22:03:24FromDiscord<Rika> aka: it's probably the compiler noticing that you're echoing a literal, so it's just straight up not using a float
22:03:32FromDiscord<Rika> or something so
22:04:37*filcuc quit (Ping timeout: 258 seconds)
22:05:25*nsf quit (Quit: WeeChat 2.7)
22:05:38*SenasOzys joined #nim
22:08:24*filcuc joined #nim
22:24:23*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:32:47*jjido joined #nim
22:40:04*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:40:31FromDiscord<mfiano> How would I make a type that defines positional argument constructors instead of varargs?
22:41:57FromDiscord<Clyybber> WDYM?
22:43:16FromDiscord<mfiano> Well in my above play link, is it possible to prevent Vec2(x: 1, y: 2), and have a constructor such as Vec2(1, 2)?
22:43:28disruptekproc run(foo: Bar; bif: Zap): Results = ...
22:43:48FromDiscord<mfiano> I want to prevent the type from generating such a constructor
22:44:05disruptekno, you can make a factory function and keep the type private, though.
22:44:13FromDiscord<mfiano> I see. thanks
22:44:41disrupteki could be wrong about that, but i don't think so.
22:46:06*tane quit (Quit: Leaving)
22:46:19FromDiscord<mratsim> proc initVec2(x, y: int): Vec2 = result.x = x; result.y = y
22:46:31FromDiscord<Clyybber> @mratsim Hey, btw whats the reason not to use UFCS in weave?
22:46:39FromDiscord<Clyybber> I'm referring to the last commit/PR
22:46:51disruptekprobably template.
22:46:56FromDiscord<mratsim> because UFCS is broken in templates
22:47:14FromDiscord<Clyybber> oh, is there an open issue?
22:47:22FromDiscord<mratsim> @Vindaar managed to trigger some undeclared identifier bug
22:47:24disruptekit is known.
22:47:30FromDiscord<mratsim> it is known
22:47:31disruptekit's in the manual.
22:47:37FromDiscord<Clyybber> ah, right
22:48:00*marmotini_ joined #nim
22:48:34FromDiscord<mratsim> btw I think Weave is pretty much feature complete now
22:49:11FromDiscord<mratsim> well apart from distributed computing and distributing work to GPUs
22:49:18disrupteknice.
22:49:56disruptektime to write something amazing that brings together all this stuff.
22:49:58FromGitter<zetashift> that's really great to hear
22:50:46FromDiscord<mratsim> a ML compiler backed by Weave πŸ˜‰
22:51:29disruptekit would definitely turn some serious heads.
22:52:40*marmotini_ quit (Ping timeout: 268 seconds)
22:52:57FromDiscord<mfiano> Man I love Nim so far. It's just so concise and does what I want in little code without bending over backwards
22:54:18*filcuc quit (Ping timeout: 260 seconds)
22:55:16disruptekcan't wait to see what macros you cook up.
22:56:10*SenasOzys quit (Read error: Connection reset by peer)
22:56:23FromDiscord<mfiano> Is there a naming convention for a proc that mutates one of its arguments?
22:56:38disruptekm/something/
22:57:13disruptekactually, that returns a var, usually.
22:58:06ptdelanybody know of any docs or anything around generating random string? for some reason my proc results in the same string each time it's called in rosencrantz :)
22:58:08FromDiscord<mfiano> Ah a prefix won't do here. I can see lots of ambiguities arising and careful api design. I would prefer a suffix
22:59:16disrupteki dunno, but there's a section in the manual about naming conventions.
22:59:17FromDiscord<mratsim> @ptdel are you perhaps calling randomize(seed) before each random function call?
22:59:51FromDiscord<mratsim> no convention @mfiano
22:59:53ptdel@mratsim I have randomize() being called inside the proc, but i'm not sure how to go about making a new seed for it each time
23:00:35FromDiscord<mratsim> I use mfoo when I have both an in-place and an out-of-place unary function
23:00:45FromDiscord<mratsim> the std/algorithm use -ed
23:00:52FromDiscord<mratsim> shuffle shuffled, reverse reversed
23:01:07FromDiscord<mratsim> shuffle is the in-place, shuffled is the out-of-place
23:01:19FromDiscord<mratsim> for non-unary there is no convention though
23:01:46FromDiscord<mfiano> Currently I have a function with nullary, unary, and binary sigs to allocate a fresh vec2 object, but i also want to have versions that modify a vector in place.
23:02:07FromDiscord<mratsim> you can reuse the name if you want
23:02:19FromDiscord<mratsim> Nim accepts overloads of var and non var
23:02:23disruptekchange(foo), changed(foo)
23:02:31FromDiscord<mfiano> I'm not sure how i'd do that without introducing an ambiguity.
23:02:46disruptekwell, one is var and one is not.
23:02:48FromDiscord<mfiano> https://gist.github.com/mfiano/3c724bf2aab2e75e5dd1118f6391b044
23:02:51disruptekit's not really ambiguous.
23:02:57dom96ptdel: call `randomize` only once
23:03:23FromDiscord<mratsim> proc `[]`(myCollection: MyCollection, i: int) is different vrom proc `[]`(myCollection var MyCollection, i: int)
23:03:32FromDiscord<mfiano> So for the first one, for example, I'd like a proc that zeroes out an existing vector, so it'd be unary too. not sure what the sig would look like
23:03:38FromDiscord<mratsim> one is only called on var parameters and the other on let parameters
23:03:59ptdelI think I need to figure out why the value i randomly generate persists between requests in rosencrantz that might be my real problem
23:04:00FromDiscord<mratsim> for zeroing a stack type just call reset()
23:04:14ptdelwhen i generate random values in other contexts it seems to make new values each time
23:04:24FromDiscord<mratsim> and the out-of-place "zeroes"
23:04:37FromDiscord<mratsim> or "zeros", never sure of the plural
23:04:55FromDiscord<mfiano> and likewise for the second one, it should take a vector and a single number that mutates both of the input vector places with that number
23:04:59FromDiscord<mfiano> etc
23:05:16FromDiscord<mratsim> otherwise in numerical computing the convention is setZero for in-place and zeros for out-of-place
23:06:07FromDiscord<mratsim> and for mutating a vector proc `[]=`(vec: var Vec2, val: int)
23:07:51FromDiscord<mfiano> what is []= ?
23:08:04ptdelsolved my problem thanks for the pointers :)
23:08:58FromDiscord<Clyybber> @mfiano Its invoked when you do `a[...] = ...`
23:11:05FromDiscord<mfiano> I'm not sure what that is yet
23:11:16FromDiscord<mfiano> I'll read the manual again
23:11:18disruptekit's a chef.
23:11:22FromDiscord<Clyybber> array indexing
23:11:26disruptek[]=
23:11:39FromDiscord<Clyybber> disruptek: lol
23:13:06*arecaceae quit (Remote host closed the connection)
23:13:24*arecaceae joined #nim
23:15:10FromDiscord<mfiano> Can you provide an example of that proc?
23:15:32*solitudesf quit (Ping timeout: 258 seconds)
23:15:32*Ven`` quit (Read error: Connection reset by peer)
23:15:37disruptekyou can see them in the tables module.
23:15:48disruptektoo many chefs, if you ask me.
23:16:06disrupteki hate to see pot spoiled.
23:19:28FromDiscord<mfiano> i guess i would like a named proc anyway, to have a consistent interface for mutating any number of members
23:19:38FromDiscord<mfiano> so looking for the proper way to do that
23:24:15FromDiscord<mratsim> @mfiano: https://github.com/numforge/laser/blob/master/benchmarks/loop_iteration/tensor.nim#L70-L72
23:24:30*krux02__ quit (Remote host closed the connection)
23:24:52FromDiscord<mratsim> this allows the notation myTensor[index] = value
23:25:03FromDiscord<mratsim> i.e. overloading array indexing
23:25:29FromDiscord<mratsim> and you can overload multidimensional arrays to have myMatrix[i, j] = value
23:26:40FromDiscord<mfiano> But what if I want to change just the 0th and 2nd index with a consistent interface as everything else, without leaking the array implementation details?
23:28:01FromDiscord<mratsim> either people call []= twice or you provide a proc called for example indexMut
23:29:08FromDiscord<mratsim> proc indexMut[N: static int, T](v: Vec2[T], indexes: array[N, int], values: array[N, T]) =
23:29:31FromDiscord<mfiano> Yeah I'm not quite to the point of parameterized types yet. I literally just wrote my first lines of Nim
23:29:32FromDiscord<mratsim> and it's called v.indexMut([0, 2], [val0, val2])
23:29:41*FromGitter quit (Read error: Connection reset by peer)
23:29:59*FromGitter joined #nim
23:30:10FromDiscord<mratsim> my first lines of Nim where writing vec and matrix types 3 years ago πŸ˜‰
23:30:37FromDiscord<mfiano> I'm not very familiar with the type system yet. Coming from a language without parametric types πŸ™‚
23:30:49FromDiscord<mratsim> I was not a dev before
23:31:15FromDiscord<mratsim> I did dabble in Haskell and Rust before but it was mostly curiosity
23:31:23FromDiscord<mratsim> (not counting bash and Python)
23:31:54FromDiscord<mfiano> I see. Just about 20 years of Lisp for me
23:32:33FromDiscord<mratsim> proTip, if you start writing macro, you can display the AST in lisp mode with lispRepr
23:32:43FromDiscord<mfiano> Cool
23:33:01FromDiscord<mratsim> but don't start too fast :p
23:34:01FromDiscord<mfiano> Yeah I'm not going to be doing macros any time soon. Starting how I learned Lisp, with my own math library, which I don't expect to be very macro heavy if at all
23:34:32*lritter joined #nim
23:40:07FromDiscord<mfiano> If I use a parameterized type to define an N-length vector, how would I write different procs dependent on the length?
23:42:14FromDiscord<mratsim> proc foo[N: static int; T](v: vec[N, T])
23:42:25FromDiscord<mratsim> or proc foo(v: Vec)
23:42:40FromDiscord<mratsim> and access N and T via v.N and v.T
23:42:46*FromGitter quit (Read error: Connection reset by peer)
23:42:55FromDiscord<mratsim> (this assusmes that they are called N and T in the type definition)
23:43:05*FromGitter joined #nim
23:43:12FromDiscord<mratsim> i.e. type Vec[N: static int; T] = object
23:43:18FromDiscord<mfiano> I see. Is there a convention for type parameter names?
23:43:57FromDiscord<mratsim> T for types, N for integers
23:44:11FromDiscord<mratsim> T, U, V if you need more
23:44:21FromDiscord<mratsim> and M, N if you need more integers
23:44:59FromDiscord<mratsim> I suggest you have a look in the old unicredit linalg repo, that's basically where I learned to use static and generics: https://github.com/unicredit/linear-algebra/blob/master/linalg/private/types.nim
23:45:11FromDiscord<mratsim> well that + opening 50+ bugs 3 years ago
23:45:41FromDiscord<mfiano> Thanks will do
23:47:31FromDiscord<mratsim> also if you want some code reviews don't hesitate to share a link of your repo in the forum, potentially you can open issues in your own tracker for things you are stuck with
23:48:14FromDiscord<mratsim> there are plenty of people that are using Nim for math/science/graphics writing their own matrix/vector libraries
23:48:45FromDiscord<mfiano> Thanks a lot
23:48:47FromDiscord<mratsim> going to sleep, see you
23:48:51FromDiscord<mfiano> Night
23:51:29FromDiscord<mratsim> btw, if you are only using Vec2, Vec3 and quaternions you can create proc like these: https://github.com/treeform/vmath#proc-xyz-2
23:51:41FromDiscord<mratsim> xy=, xz=, yz=
23:52:16FromDiscord<mratsim> and they can be used with myVec.xy = (valx, valy)
23:53:18FromDiscord<mfiano> I can't figure out how to construct your types
23:53:25FromDiscord<mfiano> I got some more manual reading to do it seems
23:53:33FromDiscord<mratsim> exact syntax is proc `xy=`(v: var Vec3, tup: tuple[x, y: float32])
23:54:13FromDiscord<mratsim> you need backquote due to the equal
23:55:11FromDiscord<mratsim> In the manual it's the setter syntax: https://nim-lang.org/docs/manual.html#procedures-properties
23:56:46FromDiscord<mfiano> I see.