<< 11-01-2021 >>

00:01:22giacoexelotl, thanks. I need support for blobs
00:02:01FromDiscord<exelotl> there's also gatabase which claims to be an ORM but I couldn't find where the objects come into it... Seems more like a DSL with connection pooling
00:02:24giacoso far the only db interface I've found that natively support blobs is: https://gulpf.github.io/tiny_sqlite/tiny_sqlite.html
00:02:30giacobut that's not an ORM
00:03:02FromDiscord<exelotl> I think as far as ORMs go Norm is the only one I'd consider using currently, but yeah I guess it doesn't have what you're looking for :(
00:04:42*krux02 quit (Remote host closed the connection)
00:05:43giacoI wonder if I should convert my seq[byte] to string, store it and back. I have no idea if the overhead is negligible or not. What do you think?
00:06:13*u0_a216 quit (Ping timeout: 246 seconds)
00:08:03*u0_a216 joined #nim
00:08:26FromDiscord<ElegantBeef> I mean they're identical storage
00:08:55FromDiscord<ElegantBeef> `cast[string](yourByte)` is all oyu need to do, though i dont know why you would since the written value is identical
00:13:24FromDiscord<exelotl> Would sqlite accept that? Or would you have to encode it as base64?
00:14:54*u0_a216 quit (Ping timeout: 256 seconds)
00:15:33FromDiscord<ElegantBeef> I'd tell you if i knew anything about databases
00:19:19*u0_a216 joined #nim
00:25:45*u0_a216 quit (Ping timeout: 240 seconds)
00:27:47*u0_a216 joined #nim
00:35:01*u0_a216 quit (Ping timeout: 264 seconds)
00:36:23*u0_a216 joined #nim
00:42:32*sagax quit (Quit: Konversation terminated!)
00:45:21*u0_a216 quit (Ping timeout: 256 seconds)
01:00:00*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:01:07*njoseph joined #nim
01:06:02disruptekthere's no significant overhead.
01:11:49saemtoday i learned about `comm`, that's a fun command.
01:11:54leorizegiaco: if you use sqlite then there's ormin too
01:11:57leorize!repo ormin
01:11:58disbothttps://github.com/Araq/ormin -- 9ormin: 11Ormin -- An ORM for Nim. 15 129⭐ 17🍴
01:15:05*Tanger joined #nim
01:20:26disruptekparallel is a fun command.
01:25:10*lritter quit (Ping timeout: 256 seconds)
01:36:04saemthat too
01:36:31saemcomm is currently helping me find where the heck this enum is being wrapped in a `tyTypeDesc`
01:36:47saemhint: I have no clue still
01:37:38saemcrap... so close yet so far.
01:39:16*beatmox quit (Ping timeout: 258 seconds)
01:39:45*qwertfisch quit (Ping timeout: 240 seconds)
01:40:08*vicfred quit (Quit: Leaving)
01:44:48*keyle joined #nim
01:45:50FromDiscord<Anonymous Poet> this might either be a dumb question or impossible: can i run an asynchttpserver and a socket that connects to the server (as a client) from the same nim file? im trying to write a test and it is eluding me
01:49:34*keyle quit (Ping timeout: 260 seconds)
01:49:46disruptekyes.
01:50:04saemOh I "figured it out" and sadly it doesn't tell me if that's really the right thing to do and whether I should be unpacking it or is there something more significant that's off.
01:50:20saemReally wish those internal API/lifetimes were more clear. :/
01:50:21disruptekwhat are you trying to do?
01:50:29saemSo pure enums don't show up in suggest
01:50:39saemI got that working, go me -- at least for a test case.
01:51:05saemLet me throw up a branch so it's easier to see.
01:51:29FromDiscord<Anonymous Poet> im trying to write tests for my asynchttpserver pr
01:51:40FromDiscord<Anonymous Poet> ive got two separate files right now that do everything i need
01:51:44FromDiscord<Anonymous Poet> i just ... need to combine them
01:52:23FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2LBV
01:52:29disruptekthere are existing async tests that do this; i used one to debug async/arc long ago.
01:52:41disruptekbut async and i don't get along anymore.
01:52:55FromDiscord<Anonymous Poet> i looked at `tasynchttpserver.nim` and its not helpful because its based on the server returning a response
01:53:04FromDiscord<Anonymous Poet> where what i want is to test the decoding of the request
01:53:07disruptekwhat a strange concept.
01:53:13FromDiscord<Anonymous Poet> although its totally possible that i missed some tests
01:53:22disruptekthat the response indicate the decoding result.
01:53:30disrupteker, /have/ the response ...
01:53:43FromDiscord<Anonymous Poet> i mean, i could ... but that seems more convoluted?
01:53:57disruptekwho cares?
01:54:08FromDiscord<Anonymous Poet> people who like readable code 😭
01:54:26disruptekit doesn't work otherwise at the moment, correct?
01:54:31FromDiscord<Anonymous Poet> i guess ill try that again and maybe itll be less offesnive
01:54:34FromDiscord<Anonymous Poet> ... yes
01:54:35disrupteki would rather have a working test and than unworking test.
01:54:40FromDiscord<Anonymous Poet> i agree with that
01:55:04disruptekmy opinion is worthless, but if you link the PR i will thumb it.
01:55:26FromDiscord<Anonymous Poet> ah, right, i remembered the other reason why i didnt do that before
01:55:31FromDiscord<Anonymous Poet> im trying to write from a plain socket
01:55:43FromDiscord<Anonymous Poet> all of the tests use the nim httpclient to get the response back
01:55:57disruptekcps tests are green, except for the purple ones that aren't.
01:56:12FromDiscord<Anonymous Poet> this is the pr, it got merged already, but theres a small issue https://github.com/nim-lang/Nim/pull/16636/files
01:56:13disbotAdd support for Transfer-Encoding: chunked
01:56:17disruptekpoet: well, that don't won't hunt. and i think you know that.
01:56:38FromDiscord<Anonymous Poet> sorry, what do you mean?
01:56:58disruptekyou can't mix async and sync and expect it to work.
01:57:11disrupteks/don't/dog/
01:57:13FromDiscord<Anonymous Poet> yeah, ofc
01:57:24disrupteki guess i'm a little more horny than usual.
01:57:31disrupteks/horny/tired/
01:57:49FromDiscord<Anonymous Poet> close ...
01:57:52disruptekif it's merged, what's the problem?
01:57:56FromDiscord<Anonymous Poet> what if i fork the process?
01:58:02disrupteksure.
01:58:07FromDiscord<Anonymous Poet> oh, the problem is theres a somewhat-but-not-entirely subtle bug
01:58:17disrupteki think you mean creating a thread.
01:58:22FromDiscord<Anonymous Poet> this line `request.body = request.body & chunk` should be `request.body = request.body & chunk[0..<bytesToRead]`
01:58:39disruptekso create a new PR.
01:58:40FromDiscord<Anonymous Poet> otherwise theres extra newlines between all the chunks
01:58:49FromDiscord<Anonymous Poet> right, i will, but i want to add tests to the new pr too
01:59:35FromDiscord<Anonymous Poet> i meant process because i dont know how nim handles async behind the scenes, so having a separate process seems better (more isolation) but thread is preferable if that works
01:59:55disrupteka thread will work, but good lucky getting dom to accept it.
02:00:04disrupteks/lucky/laid/
02:00:07disrupteks/laid/luck/
02:00:11disrupteki dunno what my problem is.
02:00:14disruptekwell, i do.
02:00:18FromDiscord<Anonymous Poet> hmm, should i come back later? lmao
02:03:03FromDiscord<Anonymous Poet> alternatively, since i have the full request text, do you know if theres a way to feed it straight into the `processRequest` function?
02:03:54disrupteki doubt it. dom doesn't like to make it easy for people to hack his shit until it works.
02:04:27disrupteksaem: well?
02:04:59saemThis is the change: https://github.com/nim-lang/Nim/compare/devel...saem:saem-nimsuggest-pure-enum-completion-82?expand=1
02:05:21saemI'm pretty sure the other code is a dead path, but I don't know.
02:05:32saemAnd the unwrapping seems suspect.
02:05:40saemBut it makes completion do the thing.
02:05:51disruptekso remind me what the problem is.
02:07:01saemCurrently if you try to nimsuggest after `LogType.deb`, it just barfs all possible suggestions (fallback path).
02:07:38saemThe `typ` that shows up there is not the enum itself, but a `tyTypeDesc`, which is wrapping the enum.
02:08:24disruptekso normally you might use something like `skipTypes` which can unwrap types with optional constraints.
02:09:12saemD'oh, I should have read the code for that, didn't realize that's what it meant.
02:09:36disrupteki'm not really reading the context here, but you might find it useful for this sort of thing.
02:09:54disrupteki hate this sort of logic; it's hard to enhance.
02:10:45disruptekoh, yeah, there are skipTypes demos all over this file. 😁
02:10:52saemI agree, but it's all intuition right now. Feels like a bunch of things should be more flags, than state wrappers.
02:11:19disruptekyes, i would rather more of the compiler was query-based.
02:11:22saemThen have funcs for answer questions which absorb the complex pattern matches.
02:11:33disrupteki think it works much better for a future immutable ast that's /fast/.
02:12:07saemIC basically necessitates that?
02:12:11disruptekthis is part of how i want carnac to work in the compiler... we won't just cache the ast, but we will cache the queries against it and their responses.
02:12:25disruptekand carnac automates all of this entirely.
02:12:57disruptekic /should/ necessitate this, but it doesn't yet; not really.
02:13:37disruptekbut i should probably shutup about it. i am no longer intimately familiar with ic, as araq has done a lot of work since i moved on.
02:15:25saemOK, thanks for the pointers... now I gotta see what I should do with this skip types business
02:15:55FromDiscord<ElegantBeef> Jump rope
02:16:40disruptekmaybe nothing; it might be irrelevant. but you're not even reaching your code because typ is nil in the logic.
02:19:30saemIt isn't, well at some point it's not because I do hit my code -- I hit a breakpoint in the debugger
02:23:15saemah, so carnac is for memoizing things -- just read the README
02:27:18*beatmox joined #nim
02:28:40FromDiscord<Anonymous Poet> well wtf
02:28:46*qwertfisch joined #nim
02:29:05disruptekyeah, carnac is a simple demo that's actually kinda useful.
02:29:16FromDiscord<Anonymous Poet> i guess theres been a lot of stuff fixed ... i tried compiling my test code after setting `--lib` and my socket thing just works
02:29:21FromDiscord<Anonymous Poet> i mean, yay, but wtf
02:29:21disruptekor, it would be, if the compiler worked.
02:29:53disruptekit's almost like your test works when the lib includes your code.
02:30:46FromDiscord<Anonymous Poet> nope, jk, doesnt work
02:30:50FromDiscord<Anonymous Poet> not sure why it worked that one time
02:31:07FromDiscord<Anonymous Poet> i knew it was too suspicious to just work like that
02:33:16FromDiscord<Anonymous Poet> hm .... i got it to work again ... maybe? further investigation is clearly required
02:35:07FromDiscord<Anonymous Poet> ok, actually, i think i may have an explanation ... as long as after i send the message on the socket, i add a `waitFor asyncSleep(X)` there'll be a context switch so the server can process the request
02:35:26FromDiscord<Anonymous Poet> I think this is acceptable for tests, right?
02:43:39*keyle joined #nim
02:49:05*bacterio quit (Ping timeout: 240 seconds)
02:51:44*bacterio joined #nim
03:00:06*opal joined #nim
03:06:56disruptekyes.
03:07:14disruptekthere are easier ways to do it, though, i'm sure.
03:08:10*saem Welp, hopefully this is some bit of progress for nimsuggest (🐌 )
03:08:16saemhttps://github.com/nim-lang/Nim/pull/16676/files
03:08:17disbotfixed nim-lang/nimsuggest#82 pure enum field sug
03:10:56*bacterio quit (Ping timeout: 240 seconds)
03:12:19*u0_a216 joined #nim
03:13:50*abm quit (Quit: Leaving)
03:16:09*u0_a216 quit (Read error: Connection reset by peer)
03:19:19*u0_a216 joined #nim
03:20:34saemThis feels like steering a cargo ship with popsicle stick. 🤔
03:22:47FromDiscord<﷽๖̶̶̶ζ͜͡In> революция
03:22:49FromDiscord<﷽๖̶̶̶ζ͜͡In> революция
03:22:51FromDiscord<﷽๖̶̶̶ζ͜͡In> революция↵революция↵революция
03:22:52FromDiscord<﷽๖̶̶̶ζ͜͡In> революция
03:22:53FromDiscord<﷽๖̶̶̶ζ͜͡In> революция↵революция↵революция
03:22:57disrupteknoted.
03:23:53disruptekError: 'method' is only allowed at top level
03:24:03*muffindrake quit (Ping timeout: 260 seconds)
03:24:13disruptekso... how can i emit more than a single method definition from a macro?
03:24:40*bacterio joined #nim
03:25:40*muffindrake joined #nim
03:26:02disruptekempty room syndrome.
03:34:49*u0_a216 quit (Ping timeout: 246 seconds)
03:39:13FromDiscord<Avatarfighter> no bro
03:39:14FromDiscord<ElegantBeef> godot-nim uses multiple methods inside a DSL
03:39:16FromDiscord<Avatarfighter> no one knows
03:39:36FromDiscord<ElegantBeef> Although i think it doesnt emit the methods as much as modify them
03:43:20saemI've seen an example of that in jsonschema by pmunch
03:52:44disruptekhmm, thanks for the ptr.
03:53:48disrupteknnkMethodDef does not appear in the jsonschema repo.
03:57:48saemWhoops, I also thought they weren't really all that different from procs when it comes to building them up
03:57:50disruptekoh i'm dumb. my testes prevent it from reaching top level.
03:58:00disruptekmaybe it's possible after all.
03:58:17disruptekjust, y'know, impossible to compose. 🤣
03:58:26saemWait... LoL, I might have written/reworked nimsuggest test code that does.
03:58:31saemLoL
03:58:54*u0_a216 joined #nim
03:59:35disruptekyep, i'm stupid.
04:00:27disrupteki think i can do it, i just can't test it. 🤪
04:05:16*u0_a216 quit (Ping timeout: 246 seconds)
04:06:51FromDiscord<Anonymous Poet> quick question, where is the file for the megatest output? my pr is failing CI with `FAIL: megatest output different!`
04:09:59saemtmegatest?
04:11:02FromDiscord<Anonymous Poet> i couldnt find a file with that name, it seems to be a testament setting?
04:11:43saemoh, looks like a category of tests
04:11:52FromDiscord<Anonymous Poet> yeah
04:12:41FromDiscord<flywind> you should not `echo "ok"`
04:13:35FromDiscord<flywind> `megatest` will join multiple tests into a big file which makes CI faster
04:13:58FromDiscord<Anonymous Poet> ah, ok. I was following what `tasynchttpserver.nim` did
04:13:59FromDiscord<flywind> If you search `failure`, you could find the diff.
04:14:17FromDiscord<Anonymous Poet> i imagine i should get rid of the other echos too
04:14:40FromDiscord<Anonymous Poet> one question though, what do you mean by this? `Please reuse string buffer or something similar.`
04:14:42FromDiscord<flywind> yeah, you could get rid of them
04:14:44FromDiscord<flywind> https://github.com/nim-lang/Nim/blob/bb12d4362e12d7f0d95e9b16e0b50ce9213d5fe9/tests/stdlib/tasynchttpserver.nim#L4
04:15:40*u0_a216 joined #nim
04:16:04FromDiscord<flywind> I mean don't allocate new memory for string like `request.body = request.body & chunk[0 ..< bytesToRead]`
04:16:11FromDiscord<flywind> see also https://nim-lang.github.io/Nim/testament.html
04:16:21FromDiscord<Anonymous Poet> i think ill stick to making one logical change at a time, wrt tasynchttperserver.nim
04:16:38FromDiscord<Anonymous Poet> ah, gotcha
04:16:40*narimiran joined #nim
04:17:32FromDiscord<Anonymous Poet> is using `request.body.add` more memory efficient than what im doing? in most languages strings are immutable buffers of fixed size, so youd need to realloc and copy either way, no?
04:17:47disruptekyes.
04:18:06FromDiscord<flywind> string is mutable in Nim.
04:18:07disruptekour strings are not immutable buffers.
04:18:28FromDiscord<Anonymous Poet> 😮
04:18:46FromDiscord<Anonymous Poet> is it amortized growth like c++ vectors?
04:19:05disruptekwell, i don't know c++, but it's amortized growth.
04:20:12FromDiscord<Anonymous Poet> on exceeding bounds, itll double the alloc space; same with shrinking (ie. changes occur by a factor of 2 of max capacity)
04:21:45disrupteki think realloc optimization was improved for strings recently, too.
04:21:57disruptekunder arc, i mean.
04:22:05disrupteki wasn't really paying close attention.
04:24:54FromDiscord<Anonymous Poet> oh, cool
04:25:53*u0_a216 quit (Ping timeout: 265 seconds)
04:31:32leorizeconcepts match under one context, switch to another and it stops matching...
04:34:20leorizeI'm giving up on concepts until it actually works
04:34:34disruptekis this the new impl?
04:35:08leorizeno, still the old one
04:35:12leorizeAraq hasn't merged the new one yet
04:35:28disruptekright, well the old one is pretty hard to use successfully.
04:37:48leorizelooks like my Any* type won't be `Any` for real anytime soon
04:38:48disruptekaraq threatened to merge the new impl; he would probably put them in for ya.
04:52:24*adnan338 joined #nim
04:52:32*adnan338 quit (Client Quit)
04:52:42*adnan338 joined #nim
04:57:20*waleee-cl quit (Quit: Connection closed for inactivity)
05:00:41leorizedepends on whether his new impl actually work :P
05:01:18disrupteki thought i was the only one who was tired of alpha-testing the compiler.
05:06:24leorizethe compiler has the great attribute of working until I write software with it
05:09:31FromDiscord<Anonymous Poet> does nim have a concept of namespaces, other than modules?
05:09:36disruptekno.
05:09:59FromDiscord<Rika> i believe if it did, UFCS would be useless.
05:10:03FromDiscord<ElegantBeef> Yep
05:10:15FromDiscord<Anonymous Poet> oh, funnily enough its because of UFCS that im asking
05:10:32FromDiscord<ElegantBeef> `thingy.namespace::procedure` is a viable way of keeping it but it's hideous
05:11:03FromDiscord<Rika> and it can prolly be confusing
05:11:24FromDiscord<ElegantBeef> Namespaces arent overly needed since you can control import/export
05:11:25FromDiscord<Anonymous Poet> what if there was a `{. namespaces: "std, my_proj" .}` pragma
05:11:30disruptekthrow some emojis in there.
05:11:33FromDiscord<Anonymous Poet> thats a fair point
05:11:49FromDiscord<Anonymous Poet> (edit) "`{." => "`{.push"
05:11:50FromDiscord<ElegantBeef> Opengl here?
05:12:01disruptekwho said opengl here?
05:12:03FromDiscord<Rika> i still dont see the need for namespaces
05:12:14disruptekrika: we're talking about opengl here.
05:12:26FromDiscord<ElegantBeef> It just replicates `import module/[a, b, c]; export a, b, c
05:12:26FromDiscord<Rika> lol
05:12:28FromDiscord<ElegantBeef> (edit) "c" => "c`"
05:12:47FromDiscord<Rika> im hella confused now
05:12:57FromDiscord<Anonymous Poet> i think were still on namespaces
05:13:01FromDiscord<ElegantBeef> Saem, Disruptek, and I have an on going joke
05:13:19FromDiscord<ElegantBeef> So half is unrelated said joke, and other half is namespaces
05:13:37FromDiscord<ElegantBeef> Search opengl here and you'll find the origins
05:13:51disruptekwhat about opengl here?
05:13:55FromDiscord<Rika> oh so its an obscure joke
05:13:57FromDiscord<Rika> got it
05:13:59saemit's here, isn't it?
05:14:02saemopengl
05:14:09disruptekyes, opengl? it's here.
05:14:10FromDiscord<ElegantBeef> Yea it's there ^
05:14:27FromDiscord<ElegantBeef> Anyway namespaces
05:14:49FromDiscord<ElegantBeef> !repo constructor
05:14:50disbothttps://github.com/beef331/constructor -- 9constructor: 11Nim macros to aid in object construction including event programming, and constructors. 15 4⭐ 0🍴 7& 2 more...
05:14:59FromDiscord<ElegantBeef> That does something that replicates namespaces
05:15:19FromDiscord<Rika> when will nim have a better convention for initialize procs other than "put the type name on the proc name".....
05:15:20FromDiscord<ElegantBeef> you can `import constructor` or `import constructor/construct` for specifiy modules
05:15:22*adnan338 quit (Quit: adnan338)
05:15:53disruptekyou can init Foo or new Foo or Foo(). what more do you want?
05:16:35FromDiscord<Anonymous Poet> i guess its interesting that ive used a lot of python recently and i havent felt the need for namespaces there, but its strange to me to write c++ without them
05:16:46disruptekwell,
05:16:49leorizeluckily you're not writing c++
05:16:50FromDiscord<Rika> well this aint python nor c++
05:16:50disruptek~ninp
05:16:51disbotninp: 11nim is not python!!
05:16:51FromDiscord<ElegantBeef> Well good thing you arent writting C++ 😄
05:16:57FromDiscord<Anonymous Poet> rip me
05:17:26FromDiscord<ElegantBeef> Your code might use C++ as an IR, but you clearly are not writing C++ as it isnt traaash
05:17:28FromDiscord<Anonymous Poet> maybe its just a matter of there being just enough control over imports/exports
05:17:44disruptekdon't be such a baby.
05:17:51FromDiscord<Anonymous Poet> hm?
05:17:53disruptekthis isn't a real problem; it's fud.
05:18:22FromDiscord<Rika> disruptek's a bit abrasive, forgive him xd
05:18:23FromDiscord<Anonymous Poet> i mean, even in python i use explicit imports `from foo import Foo`
05:18:32FromDiscord<ElegantBeef> Sure, but python also doesnt explictly type
05:18:34FromDiscord<Rika> you can do that as well in nim
05:18:51disruptekif you `from foo import Foo` then Foo is unqualified, just as it is in nim.
05:18:51FromDiscord<ElegantBeef> type based overloading isnt a thing when types arent annotated
05:19:00*adnan338 joined #nim
05:19:01*adnan338 quit (Remote host closed the connection)
05:19:16FromDiscord<Anonymous Poet> right, but i dont introduce other symbols into the scope (unexpectedly)
05:19:17*adnan338 joined #nim
05:19:24disruptekneither do we.
05:19:25FromDiscord<Rika> it doesnt matter if you do so
05:19:30FromDiscord<Rika> nim has overloading, python does not
05:19:33FromDiscord<Anonymous Poet> and youve always got `from foo_a import foo as FooA`
05:19:37FromDiscord<ElegantBeef> You import a module, it's knowingly
05:19:44FromDiscord<ElegantBeef> That's just noise
05:19:46disruptekyou have that in nim, too, chucklehead.
05:19:49leorize~imports
05:19:50disbotno footnotes for `imports`. 🙁
05:19:52leorize~import
05:19:53disbotno footnotes for `import`. 🙁
05:19:55FromDiscord<Rika> lol
05:19:56FromDiscord<Anonymous Poet> rip
05:19:57disruptek~chuckleheads
05:19:57disbotno footnotes for `chuckleheads`. 🙁
05:20:02disruptekhmm.
05:20:03leorizeright, gotta find that post narimiran wrote
05:20:12FromDiscord<Rika> smh disruptek not putting me in that tag smh
05:20:19disruptek~rika
05:20:19disbotRika: 11a footnote
05:20:24disrupteklol
05:20:30narimiran~imports is https://narimiran.github.io/2019/07/01/nim-import.html
05:20:30FromDiscord<flywind> https://narimiran.github.io/2019/07/01/nim-import.html
05:20:31disbotimports: 11https://narimiran.github.io/2019/07/01/nim-import.html
05:20:43FromDiscord<Rika> poet read this 😛
05:20:44narimiran~import is https://narimiran.github.io/2019/07/01/nim-import.html
05:20:44disbotimport: 11https://narimiran.github.io/2019/07/01/nim-import.html
05:21:29disruptek~simprot is https://narimiran.github.io/2019/07/01/nim-import.html
05:21:29disbotsimprot: 11https://narimiran.github.io/2019/07/01/nim-import.html
05:21:51narimiranare we playing anagram game?
05:22:17FromDiscord<Rika> simp rot
05:22:51narimirantropism, pro-mist
05:23:38FromDiscord<Rika> protism
05:23:59FromDiscord<Anonymous Poet> that was a nice read
05:24:05FromDiscord<Rika> mropist
05:24:06FromDiscord<Anonymous Poet> didnt know about `except` in imports
05:25:03FromDiscord<Anonymous Poet> the common use case for namespaces in c++, at least as far as what I often hear parroted around, is that you can be 100% sure that there wont be any accidental clashes of function names between your code and any libraries
05:25:17FromDiscord<Anonymous Poet> how does nim address this?
05:25:33FromDiscord<Rika> itll prolly error when you try compiling it
05:25:46FromDiscord<Rika> ambiguous call or smth error
05:25:51FromDiscord<ElegantBeef> Nope
05:26:00FromDiscord<Rika> hm really?
05:26:02FromDiscord<ElegantBeef> Two functions with the same name and parameter types can exist
05:26:08FromDiscord<Anonymous Poet> if it guarantees an error thats ok, im scared of it not doing that
05:26:10FromDiscord<ElegantBeef> Aslong as the parameter names differ it's valid
05:26:15FromDiscord<Anonymous Poet> but using it silently
05:26:22FromDiscord<Rika> OH function name
05:26:25FromDiscord<Rika> i thought funcitons
05:26:30FromDiscord<ElegantBeef> It'll say ambigous call
05:26:45FromDiscord<Rika> yeah if names clash its not ambiguous, nim has overloading
05:26:54FromDiscord<Anonymous Poet> right, so does c++
05:27:16FromDiscord<Rika> nim will only error out if function name + signature is ambiguous
05:27:22FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2LCo
05:27:41leorizewell you avoid those stuff like the plague in C++ because C++ people have no idea what the hell is a module
05:27:54FromDiscord<ElegantBeef> C++ 20 has modules 😄
05:27:56FromDiscord<Anonymous Poet> lets say, for the sake of argument, im writing my own socket implementation
05:27:59FromDiscord<Rika> > 20
05:28:05FromDiscord<Rika> no fucker is using c++20
05:28:08FromDiscord<ElegantBeef> I was joking
05:28:28FromDiscord<ElegantBeef> Dont think compilers even support C++ modules yet
05:28:33FromDiscord<Rika> i keep on forgetting everything you say is a joke
05:28:36FromDiscord<teaturtle> ru sure?
05:28:47*u0_a216 joined #nim
05:29:30FromDiscord<Anonymous Poet> so i have my own socket implementation, with an object called `Socket`, but it has maybe different semantics or properties than nim's built-in `Socket`. Someone else writes a socket library that use's nim's built in sockets. A third person consumes both my library, and the other one. What happens?
05:29:41FromDiscord<Anonymous Poet> id expect a compiler error about ambiguous names/types/etc
05:29:46leorizeyes
05:29:46FromDiscord<Rika> error since both sockets are ambiguous
05:29:58leorizein Nim each module is a "namespace"
05:30:01FromDiscord<Anonymous Poet> but say that for whatever reason that third person really needed to use both libraries, and couldnt fork them
05:30:04FromDiscord<Anonymous Poet> what should they do?
05:30:09FromDiscord<Rika> they can qualify it
05:30:31FromDiscord<Rika> nim's qualification is possible even when import is unqualified by default
05:30:32leorizenativesockets.Socket vs net.Socket
05:30:33FromDiscord<ElegantBeef> `module.procName` is a valid discriminator
05:30:37narimiran@Anonymous Poet first you say "that was a nice read", and then you ask questions that were answered in the post you allegedly read
05:30:37FromDiscord<Rika> you dont need to force it to enable it
05:30:38leorizeit's already a thing in the stdlib btw
05:31:03FromDiscord<Rika> me thinks they skimmed
05:31:22FromDiscord<Anonymous Poet> i swear i read through the whole thing, no skimming
05:31:30FromDiscord<Anonymous Poet> maybe im just tired/thinking in c++ mindset
05:31:34*adnan338 quit (Quit: adnan338)
05:31:43FromDiscord<Rika> maybe its uh
05:31:58FromDiscord<Rika> you're thinking of the same concept but what you read isnt "recognizable" as that concep
05:31:59FromDiscord<Rika> t
05:32:05FromDiscord<Rika> so you dont click them together
05:32:10FromDiscord<Anonymous Poet> but so, if you fully qualify all uses of at least one of the sockets, then you can import both modules plainly?
05:32:19saemmaybe it's maybelline
05:32:26FromDiscord<Rika> no i dont think so
05:32:26leorize@Poet you need to qualify both
05:32:30FromDiscord<Rika> you need to qualify both
05:32:31FromDiscord<Rika> yes
05:32:36FromDiscord<ElegantBeef> You can import both and only qualify where you need to either way
05:32:37leorizeor you import one of them with `except Socket`
05:32:56FromDiscord<ElegantBeef> Or you can selectively import, or you can qualify one import
05:33:19leorizeI'm dealing with this in a library of mine that's reimplementing parts of the stdlib, and it works well afaict
05:33:35FromDiscord<Anonymous Poet> i cant think of any obvious ways to misuse it
05:34:12leorizeeach Nim module is its own namespace
05:34:26FromDiscord<Anonymous Poet> say theres a custom type `Foo` ... is there any way to finangle the compiler such that you can end up with a `Foo` object without having imported the module where its defined? at least implicitly?
05:35:04leorizeyes, you use macro to generate imports to the module that have `Foo`
05:35:17leorizeoh wait you would still be making explicit imports then
05:35:21FromDiscord<Anonymous Poet> but the `Foo` type would still be in scope
05:35:24FromDiscord<ElegantBeef> No you cannot
05:35:29FromDiscord<Anonymous Poet> maybe a good concrete example is `options`
05:35:33leorizeas in symbol escaping then no, Nim don't have that
05:35:41leorizewell we do have `export`
05:35:44FromDiscord<Rika> what about `options`?
05:36:13*u0_a216 quit (Ping timeout: 264 seconds)
05:36:24FromDiscord<Rika> theres a compiler flag to import modules into the file youre compiling as well i believe
05:36:39FromDiscord<ElegantBeef> yes there are `import` and `include` compile flags
05:36:41FromDiscord<Rika> but then thats you putting that there, not the library creator
05:36:51FromDiscord<Rika> so its not implicit
05:36:52FromDiscord<ElegantBeef> But it's still not implicit
05:36:55FromDiscord<ElegantBeef> Damn it
05:36:59FromDiscord<Rika> beef dum dum
05:37:02FromDiscord<Rika> :PPPP
05:37:15leorizewell if the library creator put `export` in their library they can introduce symbols from another library into your namespace
05:37:35FromDiscord<Anonymous Poet> so, say I have module `A` that works with options, and module `B` that works on top of module `A`. We'll assume that module `B` compiles. Now say I'm writing module `C`, which directly imports module `B` but not module `A`. Is it possible for a symbol from `A` to be (accidentally) used in `C` if it is not exported by `B`?
05:37:37FromDiscord<ElegantBeef> I still say that's explicit
05:37:38leorizea prime example of this `system`, which imports and exports `system/io`
05:37:41FromDiscord<Rika> yeah but thats still kinda explicit innit
05:37:50FromDiscord<Rika> its even put on the docs
05:37:54FromDiscord<Rika> so id say its explicit
05:38:02leorize@Poet no, that can't happen
05:38:02FromDiscord<Anonymous Poet> (edit) "`A` that works with options," => "`A`,"
05:38:06FromDiscord<ElegantBeef> No module B has to export
05:38:09FromDiscord<Rika> accidentally? no
05:38:13FromDiscord<ElegantBeef> If B doesnt export something you do not get it in C
05:38:13FromDiscord<Rika> intentionally? yes
05:38:33FromDiscord<ElegantBeef> `` and `export` are powerful
05:38:36FromDiscord<Anonymous Poet> so `C` needs to either import `A`, or `B` needs to export the relevant symbol from `A`
05:38:40FromDiscord<Rika> yes
05:39:47FromDiscord<Anonymous Poet> then, if there's a collision, that means that either `B` must be exporting the symbol, in which case when you import `B` you can control the name of the symbol in the scope of `C`, OR, `B` does not export the symbol, so `C` needs to import it explicitly from `A`, in which case you can control the name of the symbol in the scope of `C`
05:39:54FromDiscord<Anonymous Poet> and theres no other cases, right?
05:40:26FromDiscord<Rika> maybe an include would be fucky
05:40:41leorizeinclude is, uh, `include`
05:40:45leorizeit's in the name :P
05:40:52FromDiscord<Rika> include sounds exactly like how C's include works
05:41:11leorize@Poet yes, that would be the case
05:41:39FromDiscord<Anonymous Poet> TIL about nim's include
05:41:54FromDiscord<Anonymous Poet> gotcha, then if that covers all of the cases, i can see why theres a strong argument for no namespaces
05:42:07leorizeyou can `import B except A` too iirc, which would avoid A symbols from getting to your namespace even if B is exporting it
05:42:10FromDiscord<Anonymous Poet> you basically cant shoot yourself in the foot
05:42:28FromDiscord<Anonymous Poet> excellent, i strongly believe in idiot-proof design
05:42:45disrupteki don't.
05:42:55disruptekor, rather, i strongly believe in idiots.
05:43:12*u0_a216 joined #nim
05:43:20FromDiscord<Anonymous Poet> do you believe that the power of idiots is always stronger than the power of design?
05:43:24FromDiscord<Rika> i cant believe disruptek believes in me
05:43:37FromDiscord<ElegantBeef> You can attempt to make something idiot proof but then the universe will make a smarter idiot
05:43:39disrupteki say your name, so it must be true.
05:43:57disrupteki'm surrounded by 70,000,000 idiots.
05:44:01FromDiscord<Rika> or an idiot so dumb an underflow happens
05:44:04disruptekit's hard not to believe in them.
05:44:38FromDiscord<iWonderAboutTuatara> can I bring an entire txt file into a multiline string?
05:44:43disruptekyes.
05:44:47FromDiscord<Anonymous Poet> yes
05:44:55FromDiscord<Rika> if you mean copy paste contents into one yeah why not
05:44:56FromDiscord<Anonymous Poet> `staticRead("myfile.txt")`
05:44:58FromDiscord<iWonderAboutTuatara> probably should have asked how
05:45:00FromDiscord<iWonderAboutTuatara> oh thanks
05:45:18FromDiscord<Anonymous Poet> this loads it all at compile time btw
05:45:29FromDiscord<Anonymous Poet> i assume thats what you wanted
05:46:05FromDiscord<iWonderAboutTuatara> also, can I walk through every file in a directory?
05:46:12FromDiscord<Rika> yeah
05:46:15leorizesee os.walkDir
05:46:19FromDiscord<Rika> procs for that is in os
05:46:20FromDiscord<Rika> fuck
05:46:25FromDiscord<Rika> damn it leorize
05:46:26FromDiscord<iWonderAboutTuatara> oh walkdir
05:46:27FromDiscord<iWonderAboutTuatara> thanks
05:47:21FromDiscord<Anonymous Poet> hey disruptek, does the irc bridge include discord reaction emojis?
05:47:39disrupteki have no idea.
05:48:03FromDiscord<Anonymous Poet> i just gave your "i have no idea." message a heart - can you see it?
05:48:09disrupteknope.
05:48:35FromDiscord<Anonymous Poet> cool, now we just have to figure out how to communicate only in emojis, and we can ask dumb questions without being roasted 😄
05:48:45disruptekunlikely.
05:48:55FromDiscord<Anonymous Poet> which part(s)?
05:48:57FromDiscord<ElegantBeef> It also doesnt send the reply system
05:49:12FromDiscord<ElegantBeef> So only inline emojis and normal responses work
05:49:33FromDiscord<Anonymous Poet> oh, good to know about that
05:49:56FromDiscord<Anonymous Poet> what about @ mentions?
05:50:06FromDiscord<Rika> yes
05:50:51FromDiscord<iWonderAboutTuatara> is there a way for me to know the number of files in a dir?
05:51:00FromDiscord<iWonderAboutTuatara> @ mentions work properly across the services yeah
05:51:10FromDiscord<iWonderAboutTuatara> in IRC if you say the person's name it @'s them
05:51:14leorizeyou iterate through walkDir and count
05:51:25FromDiscord<iWonderAboutTuatara> oh that's unfortunate
05:51:41FromDiscord<iWonderAboutTuatara> ah well, it's all initalization time anyway so speed doesn't matter a whole lot
05:51:42FromDiscord<iWonderAboutTuatara> thanks!
05:52:19leorizeany other implementation would still have to do that
05:52:40FromDiscord<Rika> theres no faster way i believe
05:53:01leorizemost OS don't expose the number of files afaik, though extended information APIs are sprouting up and might have that info
05:53:53leorizebut generally you should never use that number for any purposes
05:53:57leorizedue to TOCTOU
05:56:00FromDiscord<Rika> how is toctou usually prevented anyway
05:56:21*qwertfisch quit (Quit: ZNC - http://znc.in)
05:56:31leorizejust do it first, handle errors later
05:56:31FromDiscord<ElegantBeef> FOCYOU i think 😄
05:56:41FromDiscord<iWonderAboutTuatara> oh man
05:56:44FromDiscord<iWonderAboutTuatara> races arae so much fan
05:56:59FromDiscord<iWonderAboutTuatara> love bugfixing due to random races that you weren't expecting at all
05:57:00FromDiscord<iWonderAboutTuatara> great fun
05:57:02FromDiscord<iWonderAboutTuatara> can recommend
05:57:03*qwertfisch joined #nim
05:57:16FromDiscord<Rika> 🏎️
05:57:17leorize[m]https://github.com/CppCon/CppCon2015/raw/master/Tutorials/Racing%20the%20Filesystem/Racing%20the%20Filesystem%20-%20Niall%20Douglas%20-%20CppCon%202015.pdf
05:57:45leorize^ that should explains a bit
05:58:04leorizeand it's the main reason why I haven't managed to give nim-sys a file system api
05:59:37FromDiscord<iWonderAboutTuatara> glad I don't ahve to do with that
05:59:41FromDiscord<iWonderAboutTuatara> deal
06:01:49saemnim-sys?
06:02:02leorize!repo nim-sys
06:02:02disbothttps://github.com/FedericoCeratto/nim-syslog -- 9nim-syslog: 11Nim syslog module 15 16⭐ 5🍴 7& 4 more...
06:02:05FromDiscord<ElegantBeef> Reimpl of io afaik 😄
06:02:09leorize!repo alaviss/nim-sys
06:02:10disbothttps://github.com/alaviss/nim-sys -- 9nim-sys: 11Abstractions for common operating system interfaces 15 1⭐ 0🍴
06:02:25leorizereimpl of many stdlib components
06:02:29FromDiscord<ElegantBeef> Ah os and io stuffs 😄
06:02:35leorizefocusing on osproc atm
06:03:38saemCool. Though it's pretty tricky I imagine, not just across platforms, but also a bunch of things really need concurrency to work well.
06:03:52disruptekno shit.
06:05:01saemquiet, you! back to the CPS salt mines.
06:05:16disruptekcps is looking good.
06:05:21saemreally is
06:05:23*u0_a216 quit (Read error: Connection reset by peer)
06:05:43disruptekcurrent problem is that i don't see how to do results without my generic hack.
06:06:44saemI need to start reading nim files from the top for imports and types, then bottom up for the rest.
06:06:49*u0_a216 joined #nim
06:07:27saemdisruptek: generic hack? that anything to do with keeping the sem info and avoiding copies of nodes and crap you and z were talking about earlier today?
06:08:10disruptekno, the problem is that if all continuations take continuation type C and return type C, then how do you get specific result from a given continuation?
06:08:35saemdamn... this morning it was red, now it's green, green is good, unless you're colour blind, but still.
06:08:36disruptekand what does that even look like?
06:09:12disruptekand this is my best effort so far: https://github.com/disruptek/cps/blob/master/experiments/chain.nim
06:09:41saemAh, so without thinking too hard I'd want C[R] -> C[T]... but then issues, I'm presuming
06:09:47disruptekand when mortals see this it's going to make their little heads spin right off their necks.
06:10:08saem`{.experimental: "dotOperators".}` this can only end well
06:10:26disrupteki think this version doesn't use them.
06:11:15disruptekbut look at the bottom.
06:11:38saemdon't try to hide five lines down where you sneak in a concept.
06:12:46disruptekwe just composed a continuation using "normal" data and an existing "normal" proc.
06:12:48*u0_a216 quit (Read error: Connection reset by peer)
06:13:03disruptekand the type was one that we supplied and impl'd ourselves.
06:13:05saemOh wow, I didn't realize the whole can just say c.fn is P as some arbitrary type.
06:13:06*u0_a216 joined #nim
06:14:37saemGuess that ends up being an implicit unbound type parameter that a type of that concept must define?
06:14:39disruptekprocs have types, yes.
06:15:18disruptekthe concept defines it as Pv or Pl, say.
06:15:27disruptekwhich is Pvar or Plet.
06:16:16disruptekso P[C] is a proc usable against a continuation, either an immutable or mutable continuation.
06:16:54disruptekwhat we're working on here is `()`().
06:17:04disruptekthe perky-nips operator.
06:17:18saemI'm still not used to types can appear in any order within a type section, keep thing it has be all pre-declared. Got that idea stuck in my head. All makes sense the syntax highlighting had me ignoring P's definition further on.
06:17:41disruptekyeah, that's a nice feature.
06:17:51saemI thought that was the sad balloon operator
06:18:05disruptekit's a little annoying that consts cause you to have to break a type block, but...
06:18:50disruptekit lets us do `let x = continuation()` to reveal the result.
06:18:59disruptekkinda huge.
06:19:06disruptekit's, y'know, what you want.
06:19:16disruptek"run it"
06:19:18disruptekwhat else?
06:19:36*u0_a216 quit (Ping timeout: 256 seconds)
06:24:47saemOK, enough using github... downloading it locally
06:25:59disruptekwhat's neat is we can do things like lazy evaluation so elegantly.
06:26:51FromDiscord<mratsim> @disruptek, I already said this multiple times but you do not need to return arbitrary continuations, just return nil or the same continuation type as you were passed
06:27:22FromDiscord<mratsim> to switch to any continuation, you then just store that continuation in a data structure, and pop the one you want
06:27:47disruptekwhat does that have to do with anything?
06:27:57FromDiscord<mratsim> this emulates stackful coroutine that can switch to any coroutine for example even though our continuations only switch back to the caller
06:28:14disruptekyou're telling me i cannot act on an immutable continuation; to me, that's a deal breaker.
06:28:23FromDiscord<mratsim> it has to do with not having to return arbitrary continuation in CPS which significantly ease design and ergonomics
06:28:48disruptekthe design is fine and the ergonomics can be solved at higher levels.
06:29:14FromDiscord<mratsim> well last time Ia sked you said that design was what you wanted to nail
06:29:52FromDiscord<mratsim> the 3 primitives I introduce {.resume.}, {.suspend.} and bindCallerContinuation gives you everything you need for continuations at a low-level.
06:30:07disruptekthey give /you/ everything /you/ need.
06:30:49FromDiscord<mratsim> create an issue, with a use-case that you think can't be done
06:31:12FromDiscord<mratsim> you can model every control flow with those primitives
06:31:12disruptekwhat's the point?
06:31:46FromDiscord<mratsim> the point is to have low-level primitives that compose well and can be explained and grasped easily by people.
06:31:57saemhuh, lots of ioFailures around rod files, weird... I wonder if that's due to the funny things my branch is doing.
06:32:03disruptekabstractions are made to be written.
06:32:08disrupteksaem: nope.
06:32:19FromDiscord<mratsim> this function suspends the caller, this function can resume, and this allows you to store the continuation
06:32:36FromDiscord<mratsim> this is 100% what the continuations need
06:32:41FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2LCy
06:32:53FromDiscord<mratsim> that's because in the VM everything is runtime
06:33:07FromDiscord<mratsim> so use plain i
06:33:20FromDiscord<mratsim> VM runtime is rest of the code compile-time
06:33:27FromDiscord<Rika> static: for i in... then remove the static()
06:33:45disruptekit's already static; it's a const.
06:33:45FromDiscord<mratsim> ah right
06:33:53FromDiscord<Rika> oh i didnt see that lol
06:33:55FromDiscord<mratsim> block: static: would work
06:33:59FromDiscord<flywind> known issue I think https://github.com/nim-lang/Nim/issues/12172
06:33:59FromDiscord<mratsim> actually
06:34:01disbotError in const block inside proc ; snippet at 12https://play.nim-lang.org/#ix=2Itw
06:34:48FromDiscord<mattrb> Does that work here, or am I missing something?
06:34:58FromDiscord<mratsim> it works here, but you don't need it
06:35:07FromDiscord<mratsim> in a const block everything is in the VM
06:35:21FromDiscord<mattrb> In the example mratsim was helping me look at earlier, the limitation to the approach I wanted seemed to be that `i` wasn't static
06:35:24*adnan338 joined #nim
06:35:24FromDiscord<mratsim> if you want your staticI you need to implement a staticFor that unrolls i at runtime
06:35:27*adnan338 quit (Client Quit)
06:35:36*adnan338 joined #nim
06:36:02FromDiscord<mratsim> there was no technical limitation (maybe ergonomic), macro are in the VM so everything xwas resolved at compile-time
06:36:35FromDiscord<mratsim> sent a code paste, see https://paste.rs/k8J
06:37:31FromDiscord<mattrb> Sure yeah, not trying to imply any technical limitation. I'm sure it's _possible_, but they way that was suggested didn't really reduce the code is all I meant. I'll take a look at staticFor!
06:40:42FromDiscord<mratsim> The code in the proc generated removed the if branches from the proc and inlined only the part of the code that needed to be run at runtime AFAIK
06:40:51saemI wonder if it's a matter of perspective, whether you have a specific continuation and you're chaining that along (more from the outside) vs you got a pile of them and you're trying to figure out what to do next (more from the inside). I can see how suspend, resume, bind, where the type information would be lost (no longer static).
06:42:17FromDiscord<mattrb> This one required duplicating the logic for branchImpl. That proc will end up being something longer, and there will be more args to generate it than just `i`, so I don't think this approach is super extensible to that use-case, unfortunately
06:43:00saems/where the/is where the
06:43:12FromDiscord<mattrb> This seems like it would require writing a different version of `branchImpl` for each use-case anyway, which is what I'm trying to avoid
06:43:18FromDiscord<mratsim> the type part is orthogonal to the uses and design
06:43:54disrupteki don't agree.
06:44:07disruptekif that were the case, you wouldn't care so much about the type.
06:44:41disruptekfeel free to add your thoughts to https://github.com/disruptek/cps/discussions/40 as i have.
06:44:42FromDiscord<mratsim> look at the staticFor code I linked, create your proc and apply "replaceNodes" to replace the instances of i by the static values of i
06:44:56*Zevv quit (Ping timeout: 240 seconds)
06:45:25disrupteksaem: composition is everything, basically.
06:45:26FromDiscord<mratsim> I assume when saem talks about type information, he meant Nim type system
06:45:56saemYes, that's what I mean... I mean you're using concepts so you're in the Nim type system.
06:47:13FromDiscord<mratsim> @disruptek, you talk about thoughts but the only thing you replied to my point is "so what"
06:48:11disruptekwell, if you don't want to answer my questions, i will settle for my assumptions.
06:48:54FromDiscord<mratsim> I give you concrete ways to emulate arbitrary return types even if we constrain ourselves in the CPS transform to returning the same continuation type we were passed.
06:49:15disruptekyou didn't back up your assertions and some of them are flat out wrong.
06:49:29disruptekwhat makes you think i believe any of the assertions i cannot immediately disprove?
06:49:41disruptekthere's nothing to talk about.
06:49:51FromDiscord<mratsim> so much for a discussion
06:51:37disruptekwe currently constrain ourselves in the CPS transform to returning the same continuation type we were passed. i don't need to emulate returning arbitrary types; i already have that.
06:51:59FromDiscord<mratsim> That constraint is not a problem
06:52:07FromDiscord<mratsim> it simplifies the backend, codegen and types
06:52:34disruptekso what?
06:52:39FromDiscord<mratsim> at the scheduler level, those that needs to switch to arbitrary continuations, they just need type erasure
06:52:51disruptekare you so insecure about what you know that you cannot defend any of it?
06:53:12disrupteki asked you to port your type erasure over and you refused.
06:53:18disruptekwhat more do you want from me?
06:53:26disruptekfork the code and do what you want. it's free.
06:53:43FromDiscord<mratsim> listen, I'm here for technical discussion, you want to attack me personally. Just stop
06:53:51disruptekthere's nothing personal about it.
06:54:00disruptekyou refuse to answer my questions or back up your assertions.
06:54:02FromDiscord<mratsim> "are you so insecure"?
06:54:12disruptekwell, you tell me what the reason is, then.
06:54:27FromDiscord<mratsim> 2 weeks ago you and zevv said that one of the main blocker was ergonomics.
06:54:31disruptekall i can do is assume.
06:55:01FromDiscord<mratsim> We explored type erasure, I said that we can have ref based for ref and JS and union-based for C/C++.
06:55:31FromDiscord<mratsim> This would suit our use-cases, both ergonomic and no GC
06:56:03FromDiscord<mratsim> There are PoC with those, those can be macro-ified, sure but I thought it was more important to then tackle ergonomics
06:56:04disruptekthe chain demo was written 5mos ago. i think it's pretty ergonomic, but we can go further. ergonomics are only a blocker because we aren't sure how far to go.
06:56:15FromDiscord<mratsim> what do we show to our users.
06:56:23disruptekwhatever we want.
06:56:35disruptekno one, and i mean no one, has commented on the rfc wrt syntax.
06:56:37disrupteknot
06:56:37disruptekone
06:56:38disruptekperson
06:56:39FromDiscord<mratsim> that's why I focused on those suspend, resume and bindCallerContinuation primitives
06:56:43disruptekno one gives a single fuck.
06:56:55disruptekokay, you're the only person.
06:57:06disruptekmy mistake.
06:57:10FromDiscord<mratsim> well I give, and I have been writing and refining research and 2 design documents
06:57:18FromDiscord<mratsim> restarting when I reached a dead-end
06:57:26FromDiscord<mratsim> i;e. pure coroutines without continuations
06:57:39FromDiscord<mratsim> because I wanted to explore the alternatives as well
06:58:06FromDiscord<mratsim> and contrary to what you seem to think I care a lot about ergonomics
06:58:20disrupteki never said you don't care about ergonomics.
06:58:31FromDiscord<mratsim> my examples that required unsafeAddr in Weave are because of Nim limitations
06:58:54FromDiscord<mratsim> you need ptr to modify a var, because you can't capture them in a closure
06:59:26FromDiscord<mratsim> what can I do. I don't want to spend 2 weeks trying to come up with a clever liftLocals because I don't have a solution builtin
06:59:38disruptekyou don't have to.
06:59:46disrupteki'm the one who is unemployed, here.
07:02:44disrupteki will produce some immutable iterator tests. you can ensure they continue to pass.
07:04:08disrupteki really only care about the very lowest level of cps. i'm confident we can build whatever abstraction we want on top of it.
07:04:18disrupteki don't care how hard that is for other people to comprehend; no one else needs to understand it.
07:05:23FromDiscord<Varriount> What if you get hit by a bus?
07:05:49FromDiscord<Varriount> Also, which RFC?
07:06:27FromDiscord<mratsim> The really low-level is really the CPS transformation into continuation.↵A proc doesn't change return types in the middle of a call.↵I'm fine with continuations not changing return type.
07:08:31FromDiscord<mratsim> Basically the CPS low-level would provide: CPS transformation of typed proc into series of typed continuations. Type-erasure facilities. API for suspend, resume, store.
07:09:15disruptekdisbot: am i lagging or is it you?
07:09:15disbotsigns point to yes.
07:09:20FromDiscord<mratsim> Then, nice to have would be hooks for custom logging/stackframes
07:09:26disruptekyes what
07:09:53disruptek!rfc cps
07:09:55disbothttps://github.com/nim-lang/RFCs/issues/295 -- 3next steps for CPS 7& 4 more...
07:11:02disruptekanyway, anyone that doesn't grok the lowest level of cps can use the next level.
07:11:20disruptekif they aren't bright enough or are lazy, they can use the level after that.
07:11:39disruptekrika can use the level after that.
07:11:39disruptekand beef, i dunno, maybe he'll be satisfied with async/await.
07:11:43FromDiscord<mratsim> which is why I separated into core and scheduler folders in the repo
07:12:05FromDiscord<mratsim> if you put everything in the same folder it makes it appear more complicated than it really is
07:12:37disruptekwe plan to move the scheduler(s) out to their own libraries.
07:13:11disruptekthey are only in the repo because i wanted some way to compare performance to async/await for similar operations.
07:13:13FromDiscord<mratsim> yes, but people who read the RFC might think, how, it comes with a scheduler, why, I have mine, or that's too much overhead
07:13:42FromDiscord<Avatarfighter> LMAO BEEF SLANDER
07:14:04disruptekfeel free to PR a change to the README.
07:14:04disrupteki don't know how to make it much more clear; i say over and over that it's optional, included, example, etc.
07:14:04disruptekwe can have some links to external schedulers.
07:14:30disruptekbut, really, people should write their own schedulers. we will give them the tools to do it, if we have to.
07:15:02FromDiscord<ElegantBeef> I dont use async so .... 😄
07:15:09disrupteksee.
07:15:16disrupteksatisfied.
07:15:26disrupteklook, cps is simple.
07:15:32disruptekit's so simple that you won't believe it.
07:16:15saemThe Kotlin talk is really fantastic.
07:16:15FromDiscord<Avatarfighter> i do think that some handholding should be given for cps for less experienced people who want to dabble with cps at a certain level. Just my thought separate from what you guys were talking about.
07:16:17disruptekthe hard part is only rewriting nim that's not already cps.
07:16:23FromDiscord<mratsim> I agree, people should write their own scheduler, and it makes the dealing with the "how" 3 lines of code, and only "what to schedule" is left
07:16:47disruptekyes.
07:16:57disruptekbut once the rewrite is working, we can make even the rewrite simple.
07:16:59FromDiscord<mratsim> that's not the hard part, that's the tedious part.
07:17:03disruptekand the cps code in the wild won't change.
07:17:10disruptekunless it gets faster.
07:17:14FromDiscord<mratsim> but the stdlib needs an overhaul anyway
07:17:30disruptekand everyone will just write normal nim anyway; it'll just run as cps.
07:17:35disrupteknothing to know.
07:17:45disrupteksimple.
07:18:47disruptekfighter: we will do a lot of coaching, i'm sure.
07:19:05disruptekbut again, you're not going to need to know anything, really.
07:19:18disruptekthat's the whole point: we take the code you wrote and we make it async for you.
07:19:27FromDiscord<mratsim> CPS is not suitable for every use case, we will need flavours.↵For example sequtils/strutils will likely have a CPS flavor for composition (ala Python iterutils), and pure in-place algorithm when you need raw speed, and you compose them via `dup` (which does multiple pass over the data, it only solves ergonomic composition)
07:19:30FromDiscord<Avatarfighter> disruptek: yeah i'm really liking my runs with cps rn I just know that some people might not be as excited to learn
07:19:52disruptekthose people can kiss my furry ass.
07:20:01FromDiscord<Avatarfighter> @ElegantBeef
07:20:08saemlucky
07:20:09disruptekyou gon' learn, son.
07:20:13FromDiscord<ElegantBeef> What?
07:20:20FromDiscord<Avatarfighter> you may kiss 😛
07:20:24FromDiscord<ElegantBeef> Kiss what?
07:20:32FromDiscord<Avatarfighter> read above my ping
07:21:15FromDiscord<ElegantBeef> Why am i being targetted?
07:21:32FromGitter<gogolxdong> Is there a web framework supports route injection?
07:21:34disrupteki can't remember the names of all the nimlets.
07:21:34FromDiscord<Avatarfighter> im just teasing, I made a bad joke. My apologies ElegantBeef I didn't mean any harm.
07:21:45FromDiscord<Avatarfighter> nimlets
07:21:48FromDiscord<Avatarfighter> ahah
07:22:30FromDiscord<ElegantBeef> All harm felt
07:22:54FromDiscord<Avatarfighter> 😭
07:23:10FromDiscord<mratsim> He has a beef with your remark
07:23:15disrupteki lost a pound of raw meat tonight.
07:23:16FromDiscord<Avatarfighter> I know
07:23:31FromDiscord<Avatarfighter> I don't know what's worse though, being called a nimlet or beef's beef
07:23:31saemit's always the last place you look.
07:23:35disrupteknot that pound, this was supposed to be dinner.
07:23:48disrupteki have no idea where it fucked off to.
07:23:57disrupteki saw it this afternoon, and this evening, poof.
07:23:58disruptekgone.
07:25:15saemis the CPS library meant to do anything in terms of "operator fusing"? I'm thinking of the streaming/itertools/sequtils case.
07:25:34disrupteknope.
07:26:02saemor is another extension point the rewriting part, so some folks write dispatchers, others write "rewriters"?
07:26:46saemor is the intention to have that sort of thing be orthogonal?
07:27:00disrupteki doubt we will need rewriters. we will need a lot of dispatch, though.
07:27:24FromDiscord<Varriount> Is there any syntax to CPS aside from the macro? Or is it essentially implicit that certain procedures get passed the continuation object?
07:27:31disrupteklike, i fully expect that we'll provide some tools for dispatchers and you'll bring your own and have maybe hundreds of different dispatchers in a modest project.
07:28:14disruptekvarriount: we create the procs that take the continuation object, so, no; ideally, there's no real syntax.
07:29:03disruptekyou can look at the tests to see what that looks like.
07:29:07FromDiscord<Varriount> Sounds like what gevent/eventlet do.
07:29:17saemoh so the dispatcher when "fusing" operations, would simply sequentially call all the operations per item, that's the "fusing", so you're no longer running over the same thing over and over again.
07:29:25disruptekthose are heavier.
07:29:44disrupteksaem: exactly.
07:30:02disruptekyou would compose the function and sink it into a continuation to do the operation.
07:31:19saemthen the compiler _should_ be able to do the rest of the optimization on what are ideally pure funcs and can merge/inline those into the least amount of stack frames.
07:31:52FromDiscord<Varriount> Would the final implementation of CPS support all Nim code, or is it only possible to support a subset?
07:33:29disrupteksaem: we would probably do that in rewrite, but yes.
07:33:32FromDiscord<Varriount> And how will CPS interact with JavaScript compilation and promises?
07:33:56disruptekvarriount: it's an open question as far as which parts we cannot support. we target js.
07:34:19disruptekso, like, we're not sure about supporting mutation of calling params.
07:34:43disruptekonce you're inside your proc-that-has-the-cps-pragma, you can mutate all you want. you can mutate globals or other shit in scope.
07:34:53disruptekbut the params passed to the proc? i dunno.
07:35:36disruptekwe have a test for it and an open issue but it's currently not impl'd.
07:35:39FromDiscord<Varriount> But aside from parameters, any other constructs?
07:36:07FromDiscord<mratsim> > is the CPS library meant to do anything in terms of "operator fusing"? I'm thinking of the streaming/itertools/sequtils case↵I don't agree, you can reimplement all of those in CPS and they compose well and can be async
07:36:16FromDiscord<Varriount> Blocks, for loops, case statements, etc
07:36:20disruptekpretty much. we can probably come up with stuff that'd be hard, but yeah, pretty much anything.
07:36:23FromDiscord<mratsim> @saem
07:36:52saemmratsim: I know, but there is CPS and then there is CPS as implemented in Nim (whenever that's final
07:36:54saem)
07:36:55disruptekyeah, he gets it.
07:37:05*PMunch joined #nim
07:37:19FromDiscord<mratsim> I think try/except might be tricky, Swift disables suspending within try except, but they use coroutines, try/except can be modeled as CPS so we can overcome that
07:37:47disruptekwe already have a try/except impl, both one based on CPS only and one that uses native exceptions.
07:38:23FromDiscord<mratsim> well given that closure iterators are pretty broken with try/finally and defer that's a good argument to replace them
07:38:35FromDiscord<mratsim> it's like the number one issue we have in Chronos
07:38:40disrupteksaem: the cps macro probably wouldn't do your fusing for you, but it doesn't have to.
07:39:12disruptekmratsim: we will likely reimpl defer, try/finally, and closure iterators in cps, so... 😉
07:39:30FromDiscord<mratsim> I already reimplemented closure iterators 😉
07:39:46FromDiscord<mratsim> coro cover all use-cases of closure iterators.
07:39:54disruptekthe compiler version?
07:39:59FromDiscord<mratsim> I just need some nice syntax to create anonymous coroutine
07:40:09FromDiscord<mratsim> well no, it's "as a library"
07:40:13FromDiscord<Varriount> coro?
07:40:14saemdisruptek: yeah, I was more asking in the direction of you have folks who use CPS and don't care, folks who write dispatchers because their program has needs, then there are those that write dispatchers for very general cases like libraries, then there are CPS impl authors. Dispatchers are an existing extension point, was wondering if rewriters were one too.
07:40:21saemdisruptek: but my question is answered
07:40:22disruptekoh, i mean we will rewrite `fo` and stuff.
07:40:28disruptekoh, i mean we will rewrite `for` and stuff.
07:40:40FromDiscord<mratsim> @Varriount https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex06_coroutines.nim#L8-L12
07:41:03FromDiscord<mratsim> @saem, disruptek, Zevv and I have very different needs in terms of dispatchers
07:41:42FromDiscord<mratsim> look at the bottom of this section: https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md#motivation
07:41:58saemmratsim one thing I noticed is regardless of a fn's return type, if it has an effect like raise, then one way to reason about it is that it has two return types, one being the error case. Presently, the code I've seen so far in the CPS impl is one return type whether that's C or C[R] (the immutable kind), regardless it seems the raise needs to account for both paths... or exceptions being another branch/flow.
07:42:22disrupteksaem: so there's an extension point that we call "cpsMagic" that are procs that know about continuations but aren't really rewritten.
07:42:23FromDiscord<mratsim> we can make the dispatcher only care about what to schedule and when, all the "closure" and saving/restoring variable will be taken care of by CPS
07:42:24saemmratsim going back to the limitations you mention in swift being in the same vein.
07:42:30FromDiscord<Varriount> I'm curious though, how does CPS handle intermediate leaf functions pausing the continuation?
07:43:03FromDiscord<Varriount> CPS -> somerandomfunc -> sleep
07:43:06FromDiscord<mratsim> @saem we can reattach the effect (provided Nim compilers gives us hooks)
07:43:17FromDiscord<Varriount> (edit) "CPS" => "Continuation"
07:43:18disruptekif a leaf node falls into a dispatcher, there it sits until the dispatcher awakens it.
07:43:47FromDiscord<mratsim> sleep as a CPS version of sleep or some blocking calls that CPS doesn't know about?
07:44:29FromDiscord<Varriount> But the continuation state has to be associated with the function, doesn't it? And somerandomfunction may not be marked with the cps macro.
07:44:48FromDiscord<mratsim> if it uses CPS code it is marked with CPS tag
07:45:02FromDiscord<Varriount> Sleep as a CPS procedure.
07:45:05disruptekhe's talking about function color.
07:45:23FromDiscord<Varriount> What if I pass a closure that calls sleep?
07:45:24disruptekmy plan is to sniff that stuff at compile-time.
07:45:44disruptekthen it will have effects.
07:45:48FromDiscord<mratsim> the closure suspends and the whole thing goes into your scheduler
07:45:56FromDiscord<mratsim> or anywhere you store the continuation
07:47:14FromDiscord<Varriount> I take it all of the continuation state will need to be allocated on the heap?
07:47:27disrupteksaem: cpsMagic lets you play your fusion games without writing any compile-time code, so i think that's a fair solution. we're not fully committed to the concept yet, either.
07:47:42disruptekvarriount: not really.
07:47:47FromDiscord<mratsim> it doesn't need to if suspend/resume are always in the same scope. But if you use a scheduler that can resume from anywhere yes
07:47:59disrupteksaem: but tell me more about how the rewrite could hook in.
07:48:05saemdisruptek: I'm reading the macro now -- simultaneously I'm wondering about the raise parts and cancellation not being explicit.
07:48:18FromDiscord<mratsim> cancellation just means drop the continuation
07:48:28FromDiscord<mratsim> if you don't continue it's cancelled
07:48:36disruptekthe raise parts will probably go into the erasure.
07:48:39saemNo, it's not proceeded, which is different.
07:48:48saemThe effect is the same, but they're not the same.
07:48:55FromDiscord<mratsim> if there are resource to release, you need to use a channel
07:49:10FromDiscord<mratsim> just liek goroutines
07:49:19*u0_a216 joined #nim
07:49:30FromDiscord<Varriount> I'm still doubtful about the performance of final implementation, if the language isn't fairly restricted, but this seems to be working out.
07:49:32disruptekif your continuation is destroyed, that's your explicit cancellation event.
07:49:46FromDiscord<Varriount> (edit) "I'm still doubtful about the performance of ... final" added "the"
07:50:18FromDiscord<mratsim> I hope to make it very efficient
07:50:41disruptekthe performance will be roughly the same as closure iterators, since it's basically the same idea; they can compile to a fsm on the stack.
07:50:49FromDiscord<mratsim> we might be able to use LLVM builtins even.
07:51:01FromDiscord<mratsim> closure iterators can use the stack?
07:51:16disruptekcurrently, we are a little slower than the earlier impl. 😢
07:51:17FromDiscord<Varriount> Well, they could
07:51:17saemdisruptek: does that not rely on the memory management behaviour, in which case the event can arrive at a non-deterministic time later?
07:51:36FromDiscord<mratsim> arc is deterministic
07:51:41disruptek^
07:51:42FromDiscord<mratsim> CPS was built with arc
07:51:58FromDiscord<Varriount> The implementation doesn't allow it, but closure iterators could stored on the stack
07:52:04FromDiscord<mratsim> and you can manually memory managed continuations
07:52:11saemI knew CPS was meant to work with it, didn't realize it was mandatory.
07:52:18disruptekit's not.
07:52:20FromDiscord<mratsim> it's not mandatory
07:52:35FromDiscord<mratsim> but other GC is undefined behavior 😉
07:53:28*u0_a216 quit (Ping timeout: 246 seconds)
07:53:28disruptekthe first test i did, we were within 10-15% of closure iterators.
07:53:38FromDiscord<mratsim> regarding stack vs heap, I asked Araq for "heap allocation elision"
07:53:46FromDiscord<Varriount> (edit) I'm still doubtful about the performance of a final implementation that allows mostly unrestricted Nim code, but this seems to be working out.
07:53:59FromDiscord<mratsim> , right now the bottleneck of CPS I would say, is that the transformation is too eager
07:54:18FromDiscord<mratsim> we transform all control flow to CPS even though they don't involve a suspending branch
07:54:23disruptekyeah, it's optimized for correctness. 😁
07:54:45saemHmm, I'm wondering if non-explicit cancellation might act as an optimisation fence in some cases -- need to think through more streaming cases, which is what I'm mostly thinking for right now.
07:54:46FromDiscord<mratsim> there is also a benchmark to do between functionc alls/callbacks v state machines
07:55:31FromDiscord<mratsim> @saem: Rust "poll-based" "demande-based" async/await is a lot about making cancellation just dropping the future
07:55:34disrupteksaem: it's what you want. it lets you control the behavior.
07:56:18FromDiscord<mratsim> CPS is really about: adding to normal function the capability to suspend themselves and be resumed from that point.
07:57:17FromDiscord<mratsim> or another way to look at it is "unindented callbacks"
07:57:56saemYeah, I get that. But when you want to do some really fun stuff for streaming, then we're talking about operation fusion and micro-batching. The amount of explicit information available is often (purely intuition here) the limitation in terms of what one can and cannot do.
07:59:13FromDiscord<apollo> hello worl
07:59:15FromDiscord<apollo> (edit) "worl" => "world"
07:59:45disrupteksaem: so impl your explicit cancel() {.cpsMagic.}
07:59:53disruptekwhatever, dude. 😉
08:00:17saemI need to finish reading it -- actually I should sleep early morning, blech
08:00:29disruptekyeah.
08:00:41FromDiscord<apollo> where can i post issues that i have?
08:01:15saemgithub if they're bugs, questions on stackoverflow, the forums, or here.
08:01:47FromDiscord<apollo> so im getting this issue "not all cases are covered"
08:02:05FromDiscord<apollo> im following the nim tutorial on the website
08:02:12saemI'm assuming they're nim related and if they're not, then no matter what disruptek says, he's not a doctor.
08:02:31FromDiscord<apollo> what?
08:02:52narimiran@apollo post your code on https://play.nim-lang.org and share a link with us
08:02:53FromDiscord<ElegantBeef> Post the code
08:03:01FromDiscord<apollo> okay
08:03:15saemyou have a case statement I presume and you're not account for all cases. if it's an enum cover all variants, if the type has a big range, like string/int/etc... use an else branch... but without code I'm just guessing.
08:03:16FromDiscord<ElegantBeef> you probably dont have a `else: discard` for your case statement
08:03:17FromDiscord<apollo> the code is rather small
08:03:18disruptekcase statements need exhaustive clauses.
08:03:22FromDiscord<apollo> i can post it here
08:03:25narimiranand send us the link to the faulty tutorial example
08:03:33saemNo, use the playground, please.
08:03:38disruptek~paste
08:03:39disbotpaste: 11a frowned-upon behavior in chat; please use a service such as https://play.nim-lang.org/ or http://ix.io/ or https://gist.github.com/ and supply us a URL instead. -- disruptek
08:03:42FromDiscord<apollo> sent a code paste, see https://play.nim-lang.org/#ix=2LCR
08:03:43FromDiscord<ElegantBeef> Posting here pushes to the playground
08:03:51disruptekbut, y'know, i'm not a doctor. i'm just good with my hands.
08:03:52FromDiscord<ElegantBeef> yea you lack an `else:`
08:03:53FromDiscord<apollo> oh okay my bad sorry
08:04:03FromDiscord<apollo> so an else is always necessary for this
08:04:05FromDiscord<ElegantBeef> yes
08:04:10FromDiscord<ElegantBeef> `else: discard`
08:04:10saemdisruptek: going to add that to the things of not to believe.
08:04:15FromDiscord<apollo> i guess thats what it means by "not all cases covered"
08:04:19FromDiscord<ElegantBeef> yes
08:04:22FromDiscord<ElegantBeef> where is the tutorial now?
08:04:22FromDiscord<apollo> thanks
08:04:25narimiran"However, the above code does not compile:"
08:04:34FromDiscord<ElegantBeef> lol
08:04:35narimirandid you read the first sentence below the code sample?
08:04:43disruptekno.
08:04:47FromDiscord<apollo> wait arent these people bot's
08:04:48FromDiscord<apollo> ?
08:04:55disruptekdisbot: are you a bot?
08:04:56disbotas i see it, yes.
08:05:00disruptekvery good.
08:05:04FromDiscord<ElegantBeef> Those are people through the irc bridge
08:05:43FromDiscord<apollo> whats irc?
08:05:50narimiranbots, mostly
08:06:02narimiranand people who read
08:06:09FromDiscord<apollo> ok
08:06:15FromDiscord<apollo> anyways thanks for the help
08:06:49FromDiscord<ElegantBeef> Internet relay chat for the actual answer, this discord connects to gitter, matrix, and IRC
08:06:55FromDiscord<ElegantBeef> Gives us more chuckleheads
08:07:15FromDiscord<ElegantBeef> Isnt that right dissy?
08:07:20FromDiscord<Varriount> IRC was discord, but from the 1990's
08:07:30FromDiscord<Varriount> (edit) "was" => "is"
08:07:44FromDiscord<apollo> just found nim and got to say the syntax is really something else 0-0
08:08:00FromDiscord<ElegantBeef> That could be taken 1 of 2 ways 😄
08:08:30FromDiscord<apollo> :nim3:
08:09:54FromDiscord<ElegantBeef> But yes it's something else, it's good 😄
08:12:03FromDiscord<apollo> yep its really unique i meant to say
08:12:16FromDiscord<apollo> feels weird coding in it but i hope i get over that soon
08:12:25FromDiscord<ElegantBeef> Well it's a merger of a bunch of languages really
08:12:34FromDiscord<ElegantBeef> Pascal, Oberon, Ada, Python
08:12:43FromDiscord<apollo> which one uses the 'echo'
08:12:58FromDiscord<apollo> yeah i noticed the python indentation
08:13:09FromDiscord<apollo> but i havent worked in any of those other languages you mentioned
08:13:24FromDiscord<ElegantBeef> They're more or less obscure languages
08:14:16FromDiscord<ElegantBeef> I'm guessing echo has it's roots in Unix's `echo` command but no clue
08:14:50FromDiscord<apollo> yeah since im on a linux machine i immediately noticed the echo and was like ohh thats cool
08:15:00FromDiscord<apollo> thought i was writing bash for a minute
08:19:28FromDiscord<mratsim> > Yeah, I get that. But when you want to do some really fun stuff for streaming, then we're talking about operation fusion and micro-batching. The amount of explicit information available is often (purely intuition here) the limitation in terms of what one can and cannot do.↵↵I want to have nanosecond context switches for CPS, similar to what C++ coroutines enable in the papers I linked yesterday
08:20:54PMunchnarimiran, ey, we're not all bots
08:21:19narimiranyes, we're programmed to say exactly that
08:21:53PMunch<_<
08:21:58FromDiscord<Rika> Beep hoop
08:22:02FromDiscord<Rika> Boop
08:23:20FromDiscord<apollo> bots
08:26:44ForumUpdaterBotNew question by Alex Craft: How to use default generic types in Nim?, see https://stackoverflow.com/questions/65663489/how-to-use-default-generic-types-in-nim
08:27:13*krux02 joined #nim
08:36:59FromDiscord<ElegantBeef> They always have weird questions
08:37:16FromDiscord<ElegantBeef> And i've seen their "opinionated stdlib" and it's something
08:38:00FromDiscord<mratsim> the "Why Nim doesn(t use default value for generic type" is aggressive, but the T = void is a genuine issue that shouldn't compile.
08:38:18FromDiscord<ElegantBeef> Aliasing `values` and `keys` for tables just sends shivers down my spine
08:38:37PMunch"opinionated stdlib"?
08:38:42FromDiscord<ElegantBeef> Yea
08:38:54FromDiscord<ElegantBeef> They're making their own additions to their own stdlib that fits their views
08:39:03FromDiscord<mratsim> but where?
08:39:05PMunchah
08:39:09FromDiscord<ElegantBeef> Like returning sequences instead of iterators for `values`/`keys`
08:39:15FromDiscord<ElegantBeef> https://github.com/al6x/bon_nim
08:39:17PMunchWhat?
08:39:22PMunchThat's just a bad idea :P
08:39:29FromDiscord<ElegantBeef> Yea they dont like having the `toSeq(iter)`
08:39:58FromDiscord<mratsim> it's empty though
08:40:01PMunchThen write a converter?
08:40:08FromDiscord<Rika> It’s not empty
08:40:09FromDiscord<mratsim> you can't
08:40:14FromDiscord<mratsim> toSeq is a template
08:40:35PMunchCan't you write a converter from iterator(): T to seq[T]?
08:40:40FromDiscord<ElegantBeef> The issue is that you cannot use `iter.templ`
08:40:41FromDiscord<mratsim> toSeq is broken anyway, it doesn't work in templates or generic proc ....
08:41:17FromDiscord<ElegantBeef> I dont like those 4 dots i feel you judging me
08:42:48FromDiscord<mratsim> nop, I'm judging early symbol resolution in generics
08:43:15FromDiscord<ElegantBeef> Ah
08:43:27*u0_a216 joined #nim
08:43:30FromDiscord<mratsim> https://github.com/nim-lang/Nim/issues/8677
08:43:31disbot[Meta] Generics/Static early symbol resolution
08:44:09FromDiscord<ElegantBeef> I honestly want very little, late binding statics and iterators as first class 😄
08:45:12*Zevv joined #nim
08:48:42*haxscramper joined #nim
08:49:31*Vladar joined #nim
08:51:42haxscrampernarimiran: yardanico suggested that I should add my pattern matching article to nim blog - I made a PR with it, so could you please look over it when you have time?
08:51:43haxscramper
08:51:43haxscramper
08:51:43haxscramperAlso I noticed there is no link to 'contribute' on the nim blog, or it is not
08:51:46haxscramperobvious enough. I remember earlier someone talked about ways to get more
08:51:49haxscramperpeople to write articles there, and considering that I know how to write articles only because someone explained to me earler, this might be a noticeable roadblocker.
08:51:52haxscramper
08:51:55narimiranhaxscramper: will do
08:51:55haxscramperI expected something like "... as well as guest authors. <link to how-to for contribution>" or something like that.
08:51:58haxscramper
08:52:01haxscramperMinor complaint, but I though I should mention this.
08:52:18FromDiscord<mratsim> yep I agree
08:52:32FromDiscord<mratsim> my last article on raytracing was because you ot it from my repo
08:52:44FromDiscord<mratsim> it's better if we have a push model where we submit them
08:52:52FromDiscord<mratsim> with the format, metadata to put
08:53:05FromDiscord<mratsim> and where we put the markdown in the website repo
08:55:07haxscramperThere is "his is a guest post by <username>. If you would like to publish articles as a guest author on nim-lang.org then get in touch with us via ..."
08:55:18haxscramperBut this is per-article
08:57:41haxscrampernarimiran: also - `caseStmtMacros` is still an `experimental`, but I haven't ran into any issues with it whatsoever, except for https://github.com/nim-lang/fusion/pull/33#issuecomment-716140197
08:57:42disbotPattern matching implementation
08:58:17haxscramperAnd I'm not even sure this is a bug
08:58:38haxscramperCan this flag be enabled by default?
08:58:40narimiranok. hopefully you're not the only one using it :)
08:59:02narimirani.e. other people use it, and they found no bugs
08:59:35haxscramperI suppose there is not a lot of people who are using it directly, but I hope I managed to cover most of the edge cases in my unit tests
09:06:49*u0_a216 quit (Ping timeout: 264 seconds)
09:17:51*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:28:30*Tanger quit (Remote host closed the connection)
09:29:29FromDiscord<flywind> !eval static:↵ let a = MyUint64.high; echo uint64(a)
09:29:31NimBotCompile failed: /usercode/in.nim(1, 13) Error: invalid indentation
09:31:09saemmratsim: I think we need explicit cancellation in CPS so I can call cancel on my brain thinking about CPS instead of falling asleep, thank you. :D
09:31:49FromDiscord<mratsim> you can't cancel a proc that has been started unless you pass a channel that it will check at specific location
09:31:57saemI need to learn to wind down before bed.
09:32:20FromDiscord<mratsim> Just like for regular proc, the scheduler should abstract that.
09:32:24saemMratsim now you tell me. How an I going to sleep now. :P
09:33:17FromDiscord<mratsim> channel being any synchronization primitives, can be atomics as well or a ptr to a memory location with true false
09:37:06saemSo you see the same continuation being handled by more than one dispatcher?
09:43:39*habamax joined #nim
09:54:25giacocorrect way to create an array of uint8 from a "ptr uint8" and a "size: uint64"?
09:57:42*abm joined #nim
10:02:43*l1x joined #nim
10:03:14PMunchcast[ptr array[size, uint8]](myPtr)[]
10:03:32Zevvno no no
10:03:58PMunchNo?
10:04:03Zevvsize is static
10:04:07PMunchOh wait
10:04:08PMunchYeah
10:04:21Zevvhttps://nim-lang.github.io/Nim/manual.html#types-unchecked-arrays
10:10:26*Tanger joined #nim
10:11:25giacothis? var data = cast[ptr UncheckedArray[uint8]](mypointer)
10:15:19FromDiscord<mratsim> yes
10:15:37FromDiscord<mratsim> toOpenArray also but it needs a ptr UncheckedArray first
10:16:58giacomratsim cool, will toOpenArray copy memory or just type?
10:17:12FromDiscord<mratsim> @saem, While we can have multishot continuations, (running the same continuation multiple times) they cause significant problems with resource management so I think it's best to restricted to one-shot continuations. significant as in, you can allocate once, and free multiple times if the free is in a continuation.
10:17:41FromDiscord<mratsim> also in scheme there are multiple discussions over this in their mailing list and it's probably a design mistake.
10:17:55Zevvmratsim: we still should be able to make a deepcopy and run that, right?
10:17:59FromDiscord<mratsim> they need a "rewind" scheme that reacquire resources at continuation entry
10:18:00Zevvaka, fork() in disruptek-speak
10:18:09FromDiscord<mratsim> you can't deep copy a database connection.
10:18:19Zevvsays who.
10:18:25Zevvif the database connection implements a propy =copy
10:18:34Zevvproper
10:18:50FromDiscord<mratsim> you can't deep copy a thread
10:19:02FromDiscord<mratsim> you can't deep copy memory
10:19:02Zevvno, but I can deep copy tons of other things
10:19:19Zevvif it's not deepcopyable, sure, then you can't do it. but if it's deepcopyable, there should be no reason /not/ to be able to
10:19:20FromDiscord<mratsim> sure, but I don't think this is needed right now
10:19:33Zevvneither do I, but I recall that disruptek was fond of it, for some reaso
10:19:55FromDiscord<mratsim> it's a controversial feature in Scheme, it has only a toy use-case after over a decade in their language
10:20:23FromDiscord<mratsim> I think we can deliver CPS with this restriction, and enable it later if we find a compelling reason for
10:20:32FromDiscord<mratsim> and properly analyze the implications
10:20:45FromDiscord<mratsim> we can restrict to supportsCopyMem types for starter
10:20:48Zevvfair enough
10:21:39FromDiscord<mratsim> But I don't want CPS discussion to be derailed by memory management for a feature that didn't see a use-case in the language that implemented continuations a decade ago (or more?)
10:22:44FromDiscord<mratsim> so likely we want to have core features (CPS transforms, storage of the activation frames, compat JS, not pigeon-holing us with the GC) spelled out.
10:23:07FromDiscord<mratsim> and the non-core (multishot continuations, heap allocation elision, ...)
10:23:39FromDiscord<mratsim> and the upper layers (schedulers, asyncstreams, async/await integration).
10:26:45*NimBot joined #nim
10:27:02adnan338hello, how can I check for OS in the runtime? when defined linux would be a compile time directive, wouldn't it
10:28:49*u0_a216 joined #nim
10:29:39FromDiscord<mratsim> yes
10:29:47FromDiscord<mratsim> binaries are OS specific
10:32:06FromDiscord<mratsim> Unless you go that way: https://justine.lol/cosmopolitan/index.html
10:35:05*keyle quit (Quit: leaving)
10:38:45PMunchHas anyone actually tried to see if they can get that working with Nim?
10:39:59Zevvplease don't go there
10:40:03Zevvit's really not worth it
10:43:49giacowhy stream module doesn't handle generic byte streams, but only file and string streams? I have a uint8 array, isn't it a stream?
10:44:01PMunchZevv, I was just curious :P
10:46:24PMunchgiaco, there are unfortunately a lot of streams missing..
10:46:52giacook, but logically a generic byte stream comes before ad-hoc streams
10:47:03giacolike strings or other data
10:48:13ZevvPMunch: yeah, I read some old story once about somebody who got curious. That did not end well.
10:48:37PMunchgiaco, you'd think wouldn't you, but alas
10:49:09PMunchZevv, haha :P
10:49:20PMunchgiaco, what are you actually trying to do by the way?
10:49:20giacohaha
10:51:57Clonkk[m]You can convert seq[byte] as a string without copying memory and use string stream. You can use Status fast stream as well https://github.com/status-im/nim-faststreams
10:52:02giacoPMunch: well, the short story is that I am dealing with realtime multimedia stream coming from gstreamer, each buffer is a uint8 ptr and I have a parser build with binarylang. To feed that buffer to bianrylang I have to convert it to string first and I don't get why
10:52:22Clonkk[m] * You can convert seq[byte] as a string without copying memory and use string stream (but you have to be careful as playing with memory can be unsafe if you don't know what you're doing). You can use Status fast stream as well https://github.com/status-im/nim-faststreams
10:52:49PMunchbinarylang? Is that the new port thing of my binaryparse library?
10:53:12PMunchClonkk[m], he has a pointer though
10:53:29PMunchYou can implement a Stream yourself for a ptr/len combination
10:53:38PMunchIt's not terribly difficult
10:54:08PMunchBasically you just need to implement a couple read/write procedures
10:54:16PMunchOh, and peek
10:54:30giacoyou're the author of binaryparse? yeah I tried it when I switched to binarylang. It leverages on this package to build streams but supports file and strings https://github.com/sealmove/bitstreams
10:54:48PMunchYeah I created binaryparse :)
10:54:51Oddmongerin «typed vs untyped parameters» in the template section of nim manual, what does the first sample ?
10:55:09Oddmongermaybe more a question for the forum, forget it ^^'
10:55:13PMunchbinarylang was originally meant to just be a pull request to binaryparse
10:55:36PMunchOddmonger, typed gives you the AST after the type checking has occured
10:55:53PMunchAt this point the code in the block is valid compile-able Nim that has full type information with it
10:56:18PMunchUnlike untyped which is just a representation of the syntax as seen by Nim, without any attempt at actually figuring out what the code is supposed to do
10:56:50*a_b_m joined #nim
10:57:10PMunchBut I kept pushing back on features I felt were half-baked or poorly thought through. And by the time it was getting good it was so different that he decided to create a new thing out of it
10:57:14Oddmongerbut the code does nothing
10:57:26PMunchOh, what code are you referring to?
10:57:33OddmongerdeclareInt(x)
10:57:37PMunchLink?
10:57:43giacoPMunch: actually I moved to binarylang and there were feature I needed at that time, but then things simplified a lot into my code and now probably I could just switch back seamlessly. Not really sure though
10:57:53Oddmongerexcuse me: https://nim-lang.org/docs/manual.html#templates-typed-vs-untyped-parameters
10:58:17PMunchWhat feature if you don't mind me asking? I still want to add some of the features he proposed into binaryparse
10:59:02PMunchAh yes Oddmonger, as I said when you use `typed` the code has to be completely and compile-able
10:59:27PMunch`x` in that case is not complete as it isn't declared anywhere (that is what the template is supposed to do)
10:59:37*abm quit (Ping timeout: 256 seconds)
10:59:42PMunchImagine just putting x in a file by itself, that wouldn't be valid Nim
10:59:57Oddmongeri think i understand, it's like a lazy evaluation ?
11:00:48PMunchNow if you had var x: int before the template then it would work (but obviously give you an error saying that x was already defined when you tried to call the template).
11:00:53PMunchNot quite
11:01:06PMunchThe Nim compiler works in steps
11:01:07FromDiscord<mratsim> @giaco, because the stdlib streams modules hasn't been revisited for 10 years, also byte streams should use byte not uint8
11:01:36PMunch@mratsim, not quite true, I tried to add a byte stream, but the PR got declined
11:01:49PMunchWouldn't have helped for giaco though, as it was based on seq[byte]
11:01:55FromDiscord<mratsim> also proc foo[T: byte|uint8|char](input: openarray[T]) will match string and seq[byte]
11:02:09Oddmongerneed to think about that, but thanks :)
11:02:12FromDiscord<mratsim> @PMunch that's exactly what I'm talking about
11:02:12giacoPMunch: 1) skipping a field or group of field according to previous field (think of protocols like RTP where you have "extension" bit that if it is true you have an addictional field with "extension len" that extends the header)
11:02:24FromDiscord<mratsim> there is no way currently to make streams evolve
11:02:27PMunchBut it would be pretty simple to write a PtrStream[T](data: ptr T, len: int)
11:02:53PMunch@mratsim, why not? I just got my socketstream PR accepted
11:03:22FromDiscord<mratsim> byte streams are more fundamental than sockets
11:04:27giaco2) dynamic subparser, for example change last field parser according to previous field value
11:05:32PMunchOddmonger, first it parses the text in your file into an abstract syntax tree. This is just a tree representation of your code that matches Nim syntax. Then it runs macros that expect `untyped` on this tree. Then it check if things are actually valid Nim code, not just syntactically similar, by evaluating all the types checking procedure signatures, figuring out generics etc. After that the `typed` macros are run which now have access to a syntax
11:05:32PMunchtree with a lot more information in it. Then everything is turned into C and passed to the C compiler
11:05:41PMunchThat is greatly simplified of course
11:06:04FromDiscord<mratsim> yep, it's not true in a generic proc
11:06:35PMunch@giaco, hmm I see. All those are possible with custom parsers, but it's a bit clumsy
11:06:48FromDiscord<mratsim> in a generic proc you get garbage you need to plow through as AST.
11:06:56PMunchI think most of the gripes with binaryparse could be solved by just making it easier to define custom behaviour
11:07:48PMunch@mratsim, garbage? Isn't it just SymChoice and such?
11:08:42FromDiscord<mratsim> you get OpenSymChoice, you get symbols, in becomes contains, array accesses become nnkCall AFAIK
11:09:07FromDiscord<mratsim> and when you work on getImpl(mySymbol) it's a lottery if you will just get T, or something sensible
11:09:36giacoPMunch: sure, with custom parser you can do it, but size of change is actually larger than parsing the stream manually directly. Binarylang saved my quite some code
11:09:38FromDiscord<mratsim> ah and good luck rebuilding types and sifting through getTypeInst, getType and getTypeImpl
11:10:31FromDiscord<mratsim> you also get disappearing type AST, when you call getImpl on a type
11:11:14PMunch@giaco yeah exactly, if binaryparse had better ways of passing simple custom logic it would be neater
11:11:40PMunchWould be very interesting to see a side-by-side of binaryparse vs. binarylang for something like that
11:14:49giacoClonkk[m]: thanks for the feedback. I'm interested in converting "data: ptr uint8" + "size: uint64" into something I can use as "StringStream" without copy. How would you do it?
11:15:55PMunchI would just create a new Stream
11:16:25PMunchPreferably of course in a package you can put on Nimble and/or PR to stdlib
11:17:00FromDiscord<mratsim> toOpenArrayByte(cast[ptr uncheckedArray[byte]](p), 0, size.int - 1) solves the no copy part. Add a separate index variable to track the current position.
11:17:02giacoPMunch: yeah sadly I went gradually overcomplicating things first, so I switched, then I simplified them losing the actually machinery.
11:17:06PMunchSince you only need reading as well you can implement only the reading parts
11:17:27Clonkk[m]<giaco "Clonkk: thanks for the feedback."> Without copy I'm afraid you can't as is. You can't convert a ptr+len into a seq or string without copy
11:17:35FromDiscord<mratsim> with experimental: views you can store openarray in objects.
11:17:39PMunch@mratsim, they still need a stream to be able to pass it to binarylang
11:17:59Clonkk[m]> <@freenode_giaco:matrix.org> Clonkk: thanks for the feedback. I'm interested in converting "data: ptr uint8" + "size: uint64" into something I can use as "StringStream" without copy. How would you do it?
11:17:59Clonkk[m] * Without copy I'm afraid you can't as is. You can't convert a ptr+len into a seq or string without copy. I thought you already had a ``seq`` as Input. PMunch is correct you need to create stream on pointer.
11:18:00FromDiscord<mratsim> ah, well then custom stream
11:19:06Clonkk[m] * Without copy I'm afraid you can't. You can't convert a ptr+len into a seq or string without copy. I thought you already had a `seq` as Input. PMunch is correct you need to create stream on pointer.
11:20:33PMunchAs you can see it's not terribly complicated: https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/streams.nim#L1128-L1299
11:20:59PMunchNote that https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/streams.nim#L1137-L1190 is behind a `when` switch so you can ignore that
11:21:42Clonkk[m]Creating a stream is like 8 proc if i'm not mistaken
11:22:47PMunchThere's close, atEnd, setPosition, getPosition, readDataStr, readData, peekData, writeData, and new
11:25:13PMunchMost close is probably just a discard (unless you also want it to free), atEnd, setPosition, and getPosition are one-liners that just update or check the position variable. peek, read, and write are all just memcpy and a little position handling
11:25:36PMunchOr copyMem rather
11:26:01*a_b_m quit (Quit: Leaving)
11:27:41*superbia joined #nim
11:28:04superbiais anyone streaming at the moment?
11:28:22*narimiran quit (Ping timeout: 246 seconds)
11:28:59PMunchNot that I know of
11:30:50*narimiran joined #nim
11:32:16giacoPMunch: I don't feel confident enough to push it to std, but yeah I can try fiddling with StreamObj
11:32:40giacosuperbia: what do you mean?
11:34:36FromDiscord<mratsim> He was maybe joking about you streaming
11:34:41PMunchgiaco, sometimes people stream themselves programming in Nim
11:35:42giacooh! interesting, didn't know that. How to follow the feed of these events?
11:42:29PMunchJust keep an eye on this channel pretty much :P
11:42:48PMunchAnd following people streaming as you find them
11:44:05PMunchI stream here: https://www.twitch.tv/pmunche, and on YouTube: https://www.youtube.com/channel/UCBiDnWzKvyF9tTypc8A0CKw
11:44:24Clonkk[m]<PMunch "giaco, sometimes people stream t"> Next step is sport commentator style applied to programming ?
11:44:33PMunchHaha :P
11:44:40FromDiscord<himu> html template engine for nim suggestions?
11:44:47PMunchI mean I guess that could be interesting for something like a 48 hour hackathon
11:49:14FromDiscord<dom96> 🤔
11:49:52PMunchMan, I miss doing stuff like that..
11:50:21PMunchHopefully vaccine production can ramp up quickly so we can start being social again..
11:50:38superbiait's technically not vaccine PMunch
11:50:56FromDiscord<dom96> (edit) "🤔" => "Hmmm"
11:51:11PMunchsuperbia, really?
11:51:14superbiamaybe you have seen this https://berthub.eu/articles/posts/reverse-engineering-source-code-of-the-biontech-pfizer-vaccine/ ?
11:51:35PMunchI know there are two kinds, one that is rDNA based and one which is based on more "traditional" vaccine tech
11:52:43ZevvFOSDEM was a bit _too_ social to my liking
11:52:57PMunch"It is 4284 characters long, so it would fit in a bunch of tweets." what a weird comparison :P
11:53:11PMunchAnything can fit in "a bunch of tweets"
11:53:32PMunchZevv, oh I really like that, in bursts mind you
11:54:42superbiait's what happens outside FOSDEM what makes FOSDEM great
11:55:07PMunchHave you been to FOSDEM superbia? Why haven't we ever met up there :P
11:55:25PMunchThis CRISPR stuff is just so amazing, feels so close to coding, but works on DNA
11:55:36superbiaYou were to handsome for me to even be able to approach you
11:55:45PMunchHaha
11:55:45superbiaya, enjoy :)
11:55:56PMunchHopefully it will help us nip other diseases in the butt as well
11:56:06*clyybber joined #nim
11:56:50PMunchI mean with stuff like this guy just ordering DIY gene therapy online it's getting pretty wild: https://www.youtube.com/watch?v=aoczYXJeMY4
11:58:34ZevvPMunch: the waiting in line and then not getting in was not the greatest part
11:58:42FromDiscord<flywind> sent a code paste, see https://play.nim-lang.org/#ix=2LDE
11:58:45FromDiscord<flywind> Should this compile with `arc`?
11:58:45PMunchZevv, oh yeah that part sucks..
11:59:16PMunchWould definitely be nice if all the rooms had higher capacities
12:00:42FromDiscord<lqdev> @flywind yeah, why?
12:00:45FromDiscord<flywind> This doesn't compile with `refc` as expected.
12:00:48FromDiscord<lqdev> why not
12:00:53FromDiscord<lqdev> what's the error?
12:01:02FromDiscord<flywind> should use ref object.
12:01:12FromDiscord<lqdev> ah
12:01:16FromDiscord<lqdev> well now i see it :p
12:01:22FromDiscord<flywind> with refc: `Error: unhandled exception: invalid object assignment [ObjectAssignmentDefect]`
12:01:36FromDiscord<lqdev> well then it does compile
12:01:41FromDiscord<lqdev> just throws an error
12:01:47FromDiscord<flywind> arc: print something same with using ref object
12:02:20FromDiscord<flywind> JS backend: compiles but print wrong strings
12:06:55*kinkinkijkin quit (Quit: Connection closed for inactivity)
12:07:07FromDiscord<flywind> The issue https://github.com/nim-lang/Nim/issues/7002#issuecomment-757910155
12:07:15disbotBroken method behavior with derived objects ; snippet at 12https://play.nim-lang.org/#ix=2LDJ
12:12:10FromDiscord<mratsim> that can't work on the stack because you need fixed size on the stack
12:12:15FromDiscord<mratsim> @flywind
12:13:10FromDiscord<mratsim> if you make the object bigger than 64-bit so that it requires 2 registers for being passed, I think it will crash with refc as well
12:14:58FromDiscord<flywind> What's right behaviour for `arc`? We should disable it in arc too. Right?
12:15:14FromDiscord<flywind> (edit) "What's ... right" added "the"
12:16:25FromDiscord<mratsim> the right behavior is to make that an error.
12:16:38FromDiscord<flywind> I see, thanks
12:17:04FromDiscord<mratsim> Preventing method on non ref object of RootObj seems reasonable
12:17:16FromDiscord<mratsim> I don't think there is a use-case for methods beyond that.
12:19:53FromDiscord<flywind> > pre-existing, but what's the rationale for high(a: Dollar) being automatically defined for type Dollar = distinct int ?
12:20:02FromDiscord<flywind> Do you think this is reasonable?
12:20:11FromDiscord<flywind> https://github.com/nim-lang/Nim/pull/16681#issuecomment-757893543
12:20:12disbotfix #13517
12:22:11FromDiscord<mratsim> timothee's remark make sense
12:22:32FromDiscord<mratsim> if they want high they should {.borrow.}
12:23:00FromDiscord<flywind> I see, thanks
12:24:37FromDiscord<mratsim> We need to borrow +, -, $ after all
12:24:48FromDiscord<mratsim> I think the only thing we don't need to borrow is ==
12:28:03FromDiscord<mratsim> actually we need to borrow it as well
12:32:15FromDiscord<flywind> I see, `high` accepts `Odianal` types which may be the reason.
12:34:15FromDiscord<flywind> not sure whether it is easy to disable it.
12:36:27FromDiscord<mratsim> should distinct of ordinal be ordinal though?
12:36:36*superbia quit (Quit: WeeChat 3.0)
12:36:50FromDiscord<mratsim> distinct cint is used to implement C enums with holes for example, they aren't ordinal
12:38:47*inv2004 joined #nim
12:40:03inv2004Why check field compare kind of the obj with pwr of 2?
12:40:18inv2004((1 &((NU8)1<<((NU)(b__9b0TPEIuSEk5lcmaJoBqmcQ.kind)&7U)))!=0)
12:43:01FromDiscord<exelotl> inv2004 that's how sets work in Nim
12:44:21FromDiscord<exelotl> Are you doing something like `b.kind in {myEnumVal}` ?
12:44:29*Torro joined #nim
12:44:41PMunchHas anyone tried those IngChips BLE things? The ones that have an official Nim SDK?
12:44:53FromDiscord<inv> Not, it is just standard --d:release check to raiseFieldError
12:45:13FromDiscord<inv> (edit) "Not," => "No,"
12:45:26FromDiscord<exelotl> Oh, maybe its using sets under the hood then
12:46:05ForumUpdaterBotNew thread by Drkameleon: Experimenting with an SQLite-based portable graph DB engine, see https://forum.nim-lang.org/t/7374
12:46:43FromDiscord<inv> Thx for pointing for it. Do you have idea why the set is here? ... Ah, maybe because case can have multiple values ... letmecheck
12:48:16FromDiscord<exelotl> I'm not sure but it sounds likely :)
12:52:57*adnan338 quit (Ping timeout: 256 seconds)
12:57:59*inv2004_ joined #nim
13:02:01*inv2004 quit (Ping timeout: 264 seconds)
13:13:52*Torro quit (Remote host closed the connection)
13:13:57*T0rr0 joined #nim
13:16:14*T0rr0 left #nim (#nim)
13:16:17FromGitter<gogolxdong> https://www.bilibili.com/video/BV1E54y147xg/
13:17:35*inv2004_ quit (Quit: Leaving)
13:21:01FromGitter<gogolxdong> Dont know whether you can play, but still sorry for lacking of English version, this GUI application uses wNim + libp2p + miniblink + ffmpeg(WIP) + QUIC(using underlying Go QUIC)
13:22:44giacoPMunch: I'm watching your speech at fosdem. I wish I could speak clearly in public like that. Thanks for that!
13:22:58FromDiscord<mratsim> @gogolxdong that's awesome
13:23:07PMunchgiaco, oh cool, which one?
13:23:09FromDiscord<mratsim> We're getting Nim QUIC up to speed
13:23:28giacoMetaprogramming with Nim
13:23:36PMunchNice
13:23:52PMunchI'm going to record this years FOSDEM talk tonight, for the all-online version
13:24:12FromGitter<gogolxdong> It combines IPFS and http, establishes connection between any two libp2p node all over the world.
13:24:44PMunchSo much harder to plan what to say when I don't have an audience. Typically I just improvise and base what I say based on how confused or bored the audience looks
13:25:34PMunchAnd I've always liked public speaking, what actually made me the most nervous for that presentation was knowing that it was live streamed and recorded :P
13:27:08FromGitter<gogolxdong> GUI crashed after sending filestream.
13:27:18FromDiscord<mratsim> what is ffmpeg for? doing decentralized video?
13:27:30FromGitter<gogolxdong> yes
13:27:53FromDiscord<mratsim> I should really retrain myself in Chinese
13:28:03giacoI actually teach, but when audience is made of students is not the same as presenting to peers. That confrontation makes the quality and confidence of my speech drop by 50%
13:28:25*habamax quit (Ping timeout: 246 seconds)
13:29:06FromDiscord<mratsim> before students or before peers?
13:29:51FromGitter<gogolxdong> Maybe I spoke a bit fast.
13:30:15PMunchOh yeah for sure! I used to work as a teaching assistant at my university, and that didn't faze me at all. But talking to a room full of peers and knowing that anyone could watch it live and that it would be recorded for prosperity was certainly a bit stressful
13:30:16FromDiscord<mratsim> The main issue with students is, what is their knowledge level, what can I assume? For peers it exists as well but i'm more worried about the one who never stops asking questions and derail the Q&A session.
13:30:45FromDiscord<mratsim> @gogolxdong, no it's pretty clear, and I could easily distinguish the words, it's just that I don't know what they mean :p
13:31:04FromGitter<gogolxdong> haha
13:31:39PMunch@mratsim, that's true. I guess there's also quite a big difference between a 2 hour TA session and a 15 minute presentation
13:32:18FromDiscord<mratsim> I gave an AI course to marketing major in 2019
13:32:22FromDiscord<mratsim> 3 hours
13:32:22FromGitter<gogolxdong> It's here , https://github.com/gogolxdong/2DeFi I will update all Nim part, without go vendor packages.
13:32:41*hmmm joined #nim
13:32:41FromDiscord<mratsim> we used to vendor go-libp2p-daemon in libp2p
13:32:46FromDiscord<mratsim> it's still there for testing
13:33:22*greenfork joined #nim
13:33:44FromGitter<gogolxdong> hope nim-libp2p will catch up with ARC/ORC
13:34:01giacoWith students there's this wall of knowledge that has to be overcome before reaching teacher level, while at a conference it is completely possible to just face show stoppers at minute 1
13:35:07FromDiscord<Rika> do we have webrtc? or is it time for me to get working on one xd
13:35:13FromDiscord<Rika> a webrtc library
13:35:57FromDiscord<mratsim> a wrapper: https://github.com/TensorTom/nim-webrtc
13:36:41FromDiscord<mratsim> should have submodule the C library and replaced make with {.compile: .c.} though
13:40:22greenforkdoes anyone know what's the correct passL:"???" flag for Windows if I want to link library with mingw and I have these files: libraylib.a, libraylibdll.a, raylib.dll? so the command is "nim c --passL:"???" myfile.nim"
13:42:44FromDiscord<mratsim> passL:"-Lpath/to/folder -lraylib"
13:43:11FromDiscord<mratsim> or use dynlib
13:43:28leorize[m]you can't link directly to a dll
13:43:38FromDiscord<mratsim> if you want to statically link, use {.link:"foo.a".}
13:43:46leorize[m]either you have an import library or you use dynlib
13:44:11FromDiscord<mratsim> passL:"-Lpath/to/folder -lraylib" would work
13:44:57leorize[m]I doubt it, if you don't have a `raylib.lib`
13:46:24greenforkleorize[m], I can't use dynlib because some files are single header+implementation files which strictly require inclusion with #include in original C
13:47:34greenforkfor now I just want to dynamically link 1 dll. my understanding is that raylib.dll is for mingw (gcc) compiler and raylib.lib is for vcc compiler, I'm pretty sure I can get raylib.lib too
13:48:50leorize[m]you can still use dynlib in that case, but if you can get the import library I would recommend that instead
13:48:51greenforkmratsim, thanks, I thought that windows handles path resolution and includes current directory. the problem is that it can't find -lraylib even with raylib.dll in the same folder as exe. I assume one also needs libraylibdll.a to be present, but we will see
13:49:33leorize[m]gcc needs either `.lib` or `.dll.a`
13:49:33FromDiscord<mratsim> you likely need to fix your path
13:49:49FromDiscord<mratsim> LD_LIBRARY_PATH or whatever the equivalent is on windows
13:50:10leorize[m]there's no way around it because windows is kinda weird
13:50:37leorize[m]ld_library_path don't exist on windows
13:50:44leorize[m]nor rpath
13:50:45greenforkleorize[m], there's 1 file distributed as dll and some files are distributed as #include and some files needs to be statically linked. working with dynlib here is tough. one issue is name mangling, other "#included" files need original names
13:51:53leorize[m]then you need the import library
13:52:28greenforkwhat's "import library"? with "lib"?
13:53:17leorize[m]they are packaged as either `lib` or `dll.a`
13:53:52*Torro joined #nim
13:54:15greenforkI have dll.a. what's my passL flag if I have them in the same folder as exe, just --passL:-lraylib ?
13:55:40leorize[m]you need `-Lpath/to/folder` too since the exe folder is probably not in your linker search path
13:56:11greenforkokay, thank you! I will ask my volunteers to check it
14:04:56*PMunch quit (Ping timeout: 240 seconds)
14:05:18FromGitter<gogolxdong> this client is made for sharing Nim things worldwide.
14:05:20*Tanger quit (Quit: Leaving)
14:06:46FromGitter<gogolxdong> It has a latest working binary daemon and Nim code, as well i18n part, in which I translated most word into English.
14:10:46FromDiscord<apollo> im getting this really confusing error can someone help out?
14:11:29FromDiscord<Rika> sure, hit us
14:11:30FromDiscord<haxscramper> Show code/error
14:11:51FromDiscord<apollo> this is the error message
14:12:05FromDiscord<apollo> and this is the code
14:12:08FromDiscord<apollo> sent a code paste, see https://play.nim-lang.org/#ix=2LEk
14:12:23FromDiscord<apollo> im just learning nim
14:12:26FromDiscord<apollo> sent a code paste, see https://play.nim-lang.org/#ix=2LEl
14:12:28FromDiscord<Rika> missing colon before the last "string"
14:12:30FromDiscord<apollo> and its way of doing functions are abit confusing
14:12:32FromDiscord<Rika> in the first line
14:12:45FromDiscord<Rika> so it should be `proc HelloUser(name: string): string =`
14:13:02FromDiscord<apollo> huh i didnt even notice that :facepalm:
14:13:09leorize[m]found the go user :p
14:13:13FromDiscord<apollo> i feel soo dumb now
14:13:17FromDiscord<apollo> precisely
14:13:22FromDiscord<apollo> thanks rika
14:13:26FromDiscord<Rika> its fine, i feel the compiler should catch that
14:13:40FromDiscord<Rika> but it doesnt rn
14:18:29*PMunch joined #nim
14:19:57*clyybber quit (Quit: WeeChat 3.0)
14:20:11FromDiscord<shadow.> maybe zig lol
14:20:13*u0_a216 quit (Ping timeout: 246 seconds)
14:20:16FromDiscord<shadow.> ah nvm they said precisely
14:20:40FromDiscord<shadow.> also
14:20:48FromDiscord<shadow.> typically camelCase is preferred to PascalCase for proc names
14:21:40FromDiscord<shadow.> im doing a task where im looping through the lines of a txt file and checking if each line is valid using a function ive made. is this suitable for parallelism with something like weave?
14:22:28leorize[m]no
14:22:46FromDiscord<shadow.> ah
14:22:49FromDiscord<shadow.> why's that?
14:22:50leorize[m]since your bottleneck is the act of reading file, which must be serialized
14:22:57FromDiscord<shadow.> hm
14:23:04FromDiscord<shadow.> i read it into memory at once and then use a split iterator
14:23:13FromDiscord<shadow.> most of the time is in the validator function
14:23:20leorize[m]for parsing optimization you should use SIMD instead
14:23:23*kinkinkijkin joined #nim
14:23:38FromDiscord<shadow.> any libraries you know of for that? or somewhere i could read up on it
14:23:52leorize[m]it's infinitely lower overhead compared to threading :p
14:24:22leorize[m]cue @mratsim, he's the expert on high performance computing here
14:24:45FromDiscord<shadow.> fair enough lol
14:24:55FromDiscord<mratsim> I'm not a parsing expert though
14:25:05*hmmm quit (Quit: WeeChat 3.0)
14:25:13FromDiscord<mratsim> strings !=!=!=!= high perf computing 😉
14:25:27FromDiscord<mratsim> I'm amazed at people who manages to keep the CPU busy with strings
14:25:43FromDiscord<mratsim> they are better dev than me
14:25:55FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LEr
14:26:00FromDiscord<shadow.> simple asf, just slow lol
14:26:34FromDiscord<shadow.> i know i could optimize it but im not doing it to be optimized, just wanted to try different libraries in nim for high performance computations i suppose
14:26:42FromDiscord<shadow.> educational lol
14:28:40FromDiscord<mratsim> where does that letters, appear?
14:29:42FromDiscord<mratsim> you should likely use an array[PrintableCharsEnum, int] and dump via a for loop all the letter count in there
14:29:51FromDiscord<shadow.> letters is just a global
14:30:03FromDiscord<mratsim> and then you index that array with your letter
14:30:04FromDiscord<shadow.> it's just like
14:30:10FromDiscord<shadow.> array[26, int]
14:30:12FromDiscord<shadow.> where 26 is a-z
14:30:30FromDiscord<shadow.> it's precomputed into a count-table type thing but yk
14:30:33FromDiscord<shadow.> with an array instead
14:30:37FromDiscord<mratsim> your algorithm is quadratic
14:30:40FromDiscord<shadow.> yep.
14:30:45FromDiscord<shadow.> lmao
14:30:45FromDiscord<mratsim> make it linear
14:30:49FromDiscord<shadow.> hm
14:31:02FromDiscord<mratsim> scan once over the data
14:31:25FromDiscord<shadow.> dont know how i could do it without checking every character though
14:31:45FromDiscord<shadow.> since i have to at one point or another for the computation
14:32:08*hyiltiz quit (Remote host closed the connection)
14:32:36FromDiscord<mratsim> yes you can!
14:33:02FromDiscord<mratsim> scan the word and keep a count in an array or table of all the words you encountered
14:33:27FromDiscord<mratsim> at the end you have the count of all letters in a nice tidy data structure
14:33:36FromDiscord<mratsim> in one pass
14:33:56FromDiscord<shadow.> well yes but i still have to check every character to turn it into that array?
14:33:59FromDiscord<shadow.> and i have to do that for every word
14:34:32FromDiscord<shadow.> OH WAIT
14:34:35FromDiscord<shadow.> i think ik wym lmao
14:34:40FromDiscord<shadow.> just iterate and do += on the array?
14:34:43FromDiscord<mratsim> yep
14:34:46FromDiscord<shadow.> ahh i see
14:34:48FromDiscord<shadow.> so two pass
14:34:50FromDiscord<shadow.> hm lemme try that
14:34:55FromDiscord<mratsim> no it's one pass
14:34:59FromDiscord<mratsim> one pass over the words
14:35:06FromDiscord<mratsim> but 2 stages if you want
14:35:11FromDiscord<shadow.> yeah
14:35:11FromDiscord<mratsim> one O(n) and one O(1)
14:35:16FromDiscord<shadow.> yep
14:35:53FromDiscord<shadow.> simple enough?
14:35:57FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LEv
14:36:06FromDiscord<shadow.> kk lemme try that thanks
14:36:24*hyiltiz joined #nim
14:36:58FromDiscord<shadow.> hmm
14:37:16FromDiscord<shadow.> if i turn all the words into `CountMap`'s then iterating letters will be slow right?
14:37:21FromDiscord<shadow.> or do i just iterate all indexes and skip 0's
14:39:44FromDiscord<mratsim> I suggest you use this: https://github.com/mratsim/Arraymancer/blob/master/examples/ex06_shakespeare_generator.nim#L32-L39
14:40:23*clyybber joined #nim
14:40:28FromDiscord<mratsim> create an array or seq or table that maps printable characters to an integer
14:40:37FromDiscord<mratsim> create the inverse mapping function
14:40:40FromDiscord<shadow.> ahh yeah
14:41:17FromDiscord<mratsim> and then you do inc(countTable[charToIdx[letter]])
14:41:33FromDiscord<shadow.> yeah
14:41:34FromDiscord<shadow.> ty
14:41:50FromDiscord<shadow.> i suppose i need a good use case for weave to learn it then lol
14:42:31FromDiscord<mratsim> if you want to do a parallel for loop or spawn tasks basically
14:43:10FromDiscord<mratsim> look in the benchmark folders there are plenty of examples (except the overhead ones, the overhead benchmarks are bad reason to use parallelism)
14:43:21*arnetheduck joined #nim
14:43:28FromDiscord<mratsim> (usually because task is to short and so you don't accelerate anything)
14:44:15FromDiscord<shadow.> so would i not be able to loop through the lines in parallel once they're all in memoru?
14:44:20*arnetheduck quit (Client Quit)
14:44:25FromDiscord<shadow.> (edit) "memoru?" => "memory?"
14:44:30FromDiscord<shadow.> not saying i should, just wondering
14:44:36FromDiscord<shadow.> ye lemme look at benchmarks
14:47:26FromDiscord<shadow.> ahh i see so you need to use uncheckedarray if you're going to modify it in parallel?
14:57:36leorizeit's just because refc is terrible :P
14:59:04FromDiscord<shadow.> rip
15:12:09giacoin $data[0].uint8, what is the order of execution? [], $, uint8?
15:12:49FromDiscord<exelotl> $((data[0]).uint8)
15:13:24giacothanks
15:13:24*PMunch quit (Ping timeout: 256 seconds)
15:22:54*hyiltiz quit (Quit: No Ping reply in 180 seconds.)
15:26:32*PMunch joined #nim
15:27:07giacocould you please explain me what's happening here? https://play.nim-lang.org/#ix=2LER
15:27:18giacoI'm converting to string and back a single byte
15:28:57PMunchYou're grabbing the first character of $foo aka. "[128]"
15:29:05PMunchAnd converting that into a uint8
15:29:22PMunch91 is the ASCII value for [
15:30:18PMunchYou appear to actually want this: https://play.nim-lang.org/#ix=2LET
15:30:25PMunchgiaco ^
15:32:08*l1x quit (Quit: Connection closed for inactivity)
15:33:51FromDiscord<mratsim> you're spreading misinformation @leorize refc main issue is that it's non-deterministic and that seq and strings uses it by default.
15:34:30FromDiscord<mratsim> the fact that heap allocation kills performance is true for any GC.
15:34:56FromDiscord<mratsim> that said the fact that the heap is thread-local is indeed a problem.
15:36:04leorizeit's correct in the context :P but I can see how people may misinterpret it
15:36:19giacoaaah ok, me stupid. Buy how to convert an openArray[uint8] into a string with exactly the same bytes?
15:36:23leorizeI'm still waiting for views to mature, that would solve a lot of my api problems
15:36:34*xet7 quit (Quit: Leaving)
15:37:33FromDiscord<mratsim> @giaco, var s = newString(opena.len) then a for loop with char(yourBite)
15:37:33FromDiscord<shadow.> cast or copymem
15:37:37FromDiscord<shadow.> ah wait
15:37:42FromDiscord<shadow.> mratsim's way is more elegant
15:37:42FromDiscord<shadow.> lmao
15:37:46FromDiscord<mratsim> no, you don't cast an openarray
15:37:51FromDiscord<shadow.> ah an openarray
15:37:52FromDiscord<shadow.> i see
15:37:54FromDiscord<mratsim> you can copyMem though
15:37:56FromDiscord<shadow.> yeah
15:38:12FromDiscord<shadow.> var s = newString(opena.len) then copymem by addr ig
15:38:13FromDiscord<mratsim> the for loop should be detected as copymem anyway
15:38:27FromDiscord<shadow.> ah fair enough
15:40:02giacoI should really implement a stream for bytes, sigh
15:47:22*hyiltiz joined #nim
15:48:03ForumUpdaterBotNew question by Artem Klevtsov: Can&#39;t int array with uint8 type, see https://stackoverflow.com/questions/65670050/cant-int-array-with-uint8-type
15:49:03*hyiltiz quit (Excess Flood)
15:50:46*hyiltiz joined #nim
15:50:46*hyiltiz quit (Changing host)
15:50:46*hyiltiz joined #nim
15:51:18*waleee-cl joined #nim
15:56:05giacothanks, conversion works
15:57:22*hnOsmium0001 joined #nim
16:05:54*hyiltiz quit (Ping timeout: 260 seconds)
16:08:38*hyiltiz joined #nim
16:13:03*hyiltiz quit (Client Quit)
16:14:06*Torro left #nim ("bye")
16:15:37*krux02 quit (Quit: Leaving)
16:15:56leorize@mratsim is std/atomics fast in non-threading scenario?
16:16:19FromDiscord<mratsim> why would you use them if you don't need to sync threads?
16:16:25leorizeI'm not a big fan of splitting my code for threadsafe and non-threadsafe paths
16:17:01leorizemy library need to support threading
16:17:08FromDiscord<mratsim> load and store are "zero-cost" on x86, and costly on ARM, Power, MIPS Itanium
16:17:19FromDiscord<mratsim> add/sub are costly everywhere
16:17:35FromDiscord<mratsim> they mean flush cache, sync, do the operation
16:18:06leorizeso I still have to split my code paths...
16:18:07leorizethanks
16:18:08FromDiscord<mratsim> compare and swap are more expensive.
16:18:28FromDiscord<mratsim> well, it depends on your bottlenecks
16:18:39FromDiscord<mratsim> if your bottleneck is IO you don't need to care.
16:18:50leorizeI'm dealing with file operations
16:18:55FromDiscord<mratsim> they will be plenty fast, they don't incur kernel context switch
16:19:23FromGitter<eagledot> @mratsim hey,active on arraymancer?
16:19:41FromDiscord<mratsim> (unlike locks or condition variable)
16:19:42leorizeapparently on Windows the file position has to be handled by the user if you use async io
16:20:32FromDiscord<mratsim> @eagledot: in maintenance mode, I'm too busy with plenty of projects to develop Arraymancer beyond small patches
16:21:06FromGitter<eagledot> @mratsim No i meant active on arraymancer channel?
16:21:29FromDiscord<mratsim> ah, no, Gitter dropped the ball on me so i switched to discord full time
16:21:40FromDiscord<mratsim> I also linked to Discord instead of Gitter this morning
16:21:55FromDiscord<mratsim> I do check the channel from months to months
16:22:05FromGitter<eagledot> Ok ,I suppose have to generate an account on discord !!
16:22:15leorizemratsim: so the file operations will always take the majority of the time so I don't have to care about atomic perf hit?
16:22:18leorizethat's good to know
16:22:38FromGitter<eagledot> @Vindaar you there?
16:22:39FromDiscord<mratsim> the kernel context switch due to file IO will flush your cache anyway
16:25:17FromDiscord<Vindaar> Yup, I'm here
16:25:28FromDiscord<mratsim> so yea, Atomics is like 15-20 cycles maybe, and context switch is more like 180 cycles
16:25:40FromGitter<eagledot> @vindaar on arraymancer too?
16:25:53FromDiscord<Vindaar> sure, can hop over there
16:25:55FromDiscord<mratsim> http://ithare.com/infographics-operation-costs-in-cpu-clock-cycles/↵↵@leorize https://media.discordapp.net/attachments/371759389889003532/798226191663628308/part101_infographics_v08.png
16:26:47FromDiscord<mratsim> They pur the kernel call at 1000 😮
16:26:48FromDiscord<mratsim> put
16:27:20FromDiscord<mratsim> seems like you shouldn't use exceptions in your file IO as well
16:28:13leorizenim exceptions are just `if`s statements nowadays
16:28:48leorizewith --exception:goto, which is gonna be the default
16:29:02*lritter joined #nim
16:29:50leorizeso basically same overhead as checking for errors
16:29:57FromDiscord<mratsim> anyway, FileIO = kernel call, and they don't get the Futex API like locks and condition variables (Futex: fast user mutex, do most in user-land if you can)
16:30:18FromDiscord<mratsim> so it's 10 to 50 more costly than atomics
16:30:18leorizenot sure when will the `ref` requirement for exceptions go away though, probably never
16:33:34*fputs joined #nim
16:34:23*leorize quit (Ping timeout: 240 seconds)
16:36:11*hyiltiz joined #nim
16:36:11*hyiltiz quit (Changing host)
16:36:11*hyiltiz joined #nim
16:41:27*tane joined #nim
16:44:31*leorize joined #nim
16:45:49*mahlon quit (Quit: WeeChat 3.0)
16:46:43*mahlon joined #nim
16:59:06*hyiltiz quit (Quit: No Ping reply in 180 seconds.)
17:00:22*hyiltiz joined #nim
17:04:08disruptekthere was talk of rm'ing exceptions as refs but it seems like a tough battle to me.
17:04:23disrupteki think it could be done in the compiler, though.
17:05:18FromDiscord<mratsim> technically Exceptions are all "object of RootObj" not "ref object of RootObj"
17:08:57*daehee joined #nim
17:10:16*haxscramper quit (Ping timeout: 240 seconds)
17:10:30daeheedoes the httpclient Response object reference the original Request? didn't appear so in the docs, but could someone confirm this.
17:20:57*daehee quit (Quit: Textual IRC Client: www.textualapp.com)
17:21:18*haxscramper joined #nim
17:22:31haxscramperdisruptek: I PRed proof-of-concept graphviz export for gram, with some basic documentations. CI fails but probably because I misconfigured dependencies
17:23:14haxscramperIf you are good with this implementation I will spend some more time on dependencies/documentation and it is basically done
17:23:37FromDiscord<Avatarfighter> daehee: the Response object does not reference the original request
17:28:52disruptekscramper: i'm not picky; there are a lot of free version numbers left for gram. 😘
17:29:39disruptekyou can read the CI output, right?
17:32:55haxscramperYes I can, though testes doesn't output reason for compilation failure, hasts is installed correctly etc. (at least I looks like this to me, because otherwise whole test would fail because it can't even `import hasts/graphviz_ast` in `gram`). But again, I haven't looked into this part specifically
17:33:31disruptek--define:release when you build the rest and you'll get compilation errors.
17:33:43disrupteki just added you to the repo so you can push.
17:35:16haxscramperOh, yes I forgot `--defined:release` when testing
17:37:30disruptekthis is super cool, can't wait to see how people use it. 🎉
17:41:47FromGitter<daehee> AvatarFighter: ok thanks. I'm capturing the HTTP redirect chain, and noticed that the original prepared Request would be a helpful field on the Response object, similar to Go (https://golang.org/pkg/net/http/#Response) and python requests (https://requests.readthedocs.io/en/latest/api/#requests.Response.request) implementations.
17:47:19*clyybber quit (Quit: WeeChat 3.0)
17:48:51Zevvdisruptek: where does the symbol 'checkpoinst' come frm
17:52:21Zevvow wait
17:52:24Zevvit's not you
17:53:16FromDiscord<mratsim> cue in someone who mentions that all function usd should be qualified
17:53:31Zevvdisruptek: something is wrong with testes
17:53:47Zevvyes, I'm ready for the puns
17:54:02disruptekmy doctor says it will clear up if i stop picking at it.
17:54:12Zevvbut tzevv with testes ends up getting 46 kloc, while under unittest it's just 6 kloc
17:54:23disruptekthere's no playin' aroun'.
17:54:29Zevvkeep'em coming
17:54:47disruptekif you rub them, they get bigger. what can i say? i'm a grower, not a shower.
17:54:55Zevvone more
17:55:08disruptekjeeze.
17:55:17Zevvhehe
17:55:29Zevvanyway, I'm not sure why it blows up like this, but my tests are kind of unusable now
17:55:46disruptekuse version <1.1.0.
17:56:02disruptekit's due to check revealing the symbols in its input.
17:56:09Zevvk
17:56:27disruptektestes breaks cps in 1.1.0+ anyway, due to the foreign bindsym.
17:56:36disruptekor, vice-versa, actually.
17:56:37Zevvnice
17:56:57disruptekhence the requires statement in cps.nimble.
17:57:20*hyiltiz quit (Quit: No Ping reply in 180 seconds.)
17:57:34*hyiltiz joined #nim
17:58:27disruptekironically, the symbol it pukes on is `useColor`, which was added to appease a certain neanderthal who cannot handle color, italics, or emojis.
17:58:52FromDiscord<Daniel> looking at the operation costs, looks like division is costs more than multiplication.....makes me curious, does substitution for division with multiplication make it cheaper on cpu?...for example if i want to divide 30 by 5, instead of that i send to cpu 30 times 0.2 ....would that be cheaper?
17:59:14FromDiscord<Meowz> `conline(int type, const char sf)` would `cstring` work to wrap the second argument?
17:59:47disruptekdaniel: the compiler will figure that shit out for you.
17:59:50FromDiscord<Daniel> (edit) removed "is"
18:00:41FromDiscord<mratsim> yes
18:00:59FromDiscord<mratsim> all compiler do that when the divisor is known at compile-time
18:01:19FromDiscord<mratsim> there is a paper about that from 93 iirc
18:01:23FromDiscord<mratsim> by the author of GMP
18:01:29FromDiscord<bark> why is division more expensive than multiplication on floats 🤔
18:02:00FromDiscord<mratsim> it's all about hardware logic gates
18:04:55FromDiscord<mratsim> apparently this is an optimized hardware floating point division circuit https://media.discordapp.net/attachments/371759389889003532/798251103178981436/unknown.png
18:05:58FromDiscord<mratsim> source: https://digital.library.adelaide.edu.au/dspace/bitstream/2440/37996/10/02whole.pdf
18:06:00FromDiscord<bark> oh so this is not done using consecutive bit shifts
18:06:48FromDiscord<Daniel> its quite interesting how from Abacus we came up with to solutions made of 2 numbers(0,1)
18:26:52leorizedisruptek: if you don't wanna make testes configurable you can make the test runner a library
18:27:03leorizethen if you find a tests/runner.nim just compile that file and run it
18:27:17disruptekthat's an idea, yeah.
18:27:49disruptekor, you supply the path on the cli maybe.
18:28:02leorizethat too
18:29:06disrupteki wonder if that defeats the purpose, though.
18:31:25disruptek!repo asynctest
18:31:27disbothttps://github.com/markspanbroek/asynctest -- 9asynctest: 11Unit testing of asynchrononous code in Nim 15 0⭐ 0🍴
18:31:44*Q-Master quit (Ping timeout: 256 seconds)
18:31:56disrupteki don't even.
18:39:54*hyiltiz quit (Quit: hyiltiz)
18:42:01*hyiltiz joined #nim
18:49:55ForumUpdaterBotNew thread by B3liever: Can you please explain these benchmark results (and confirm my numbers), see https://forum.nim-lang.org/t/7375
18:53:52*clyybber joined #nim
19:01:53*jkiesian joined #nim
19:02:27*Q-Master joined #nim
19:02:34haxscramper
19:02:34haxscramperdisruptek: I also thought about nimph and your idea for package management, specifically in context of your complaints about nobody switching from nimble (possibly wrong phrasing, but at least that's how it looks to me right now).
19:02:34haxscramperSo, if I take nimph, specifically it's readme there are following sections - 'features', 'usage', 'demo', and more usage. There is no 'moving from nimble', 'getting started from scratch', or general description of why this particular approach is superior.
19:02:34haxscramperSame goes for gitnim - 'installatin', 'usage', done.
19:02:37haxscramperSpecifically in my case, when I first found nimble but haven't used it because, even though it might seem like an amazing tool overall, I haven't found a simple step-by-step guide how to move from my existing setup, what problems does it have (it works for me /now/, what else I might need?). So, as you said earlier "not better enough".
19:02:51haxscramperThis is just some relatively random ideas
19:03:06haxscramperNot really actionable
19:04:13PMunchDoes nimph have a build system similar to nimble?
19:04:21disruptekno.
19:04:22PMunchI.e. a Nimble file
19:04:25haxscramperBut just general description along the lines of "why do **I** need this, here and now"
19:04:36PMunchAh, that's for me good enough reason not to switch..
19:04:40haxscramperBecause it is really an amazing tool from what I can tell
19:04:51PMunchI want to run nimble install X and get everything it depends on as well
19:04:59disrupteknimph doctor
19:05:05PMunchOr download a project and do nimble run and it will just grab everything and run it
19:05:20*disruptek shrugs.
19:05:20haxscramperBut this /looks/ great, but the problem I don't /exactly/ know how to move from thinking in terms for nimble to nimph terms.
19:05:42haxscramperThis does sound a bit uncertain, but I dont' think I can phrase i better
19:06:10haxscramperit*
19:06:29leorizenimph currently just outsource things to nimble when it doesn't know the command iirc
19:07:05disruptekthe idea of nimph is that it helps you to make the environment match the configuration you specified such that the compiler can do its thing.
19:07:10disruptekthat is all.
19:07:39disruptekyou declare your env in a nim.cfg or whatever and nimph will tell you of any problems and fix anything it can fix without your intervention.
19:09:05disrupteknimph goatfucker will run nimble goatfucker for you, yes.
19:09:43disruptekthe reason nimph is the future is that it knows how to sniff your git repo quickly and accurately. we don't exploit this all that much today, but we will.
19:09:52leorizehave you tried to implement MVS in nimph?
19:10:15disrupteknot since i originally wrote it.
19:11:36disruptekscramper: i probably need more demos, but basically, i don't want to use nimph. that's the design goal. it's designed to not be used.
19:11:54disruptekthe compiler works well. i don't want another layer between me and the compiler.
19:12:10disrupteknimph just makes sure that the compiler can do its thing.
19:13:02leorizenow you just need to write an RFC to fold the package manager into the compiler
19:13:17disrupteki will work on gitnim today. that's the first step.
19:13:43leorizeeither that or Araq implements compiler plugins so we can experiment with the idea outside of the compiler
19:13:45disruptekscramper: just build it. you can run `nimph` anywhere and it's intructive but non-destructive.
19:14:48disruptekie. use it alongside nimble. it plays nicely.
19:16:46*D_ quit (Quit: No Ping reply in 180 seconds.)
19:16:57disrupteki used to have an Opinions section that explained why nimph exists but maybe i took it out.
19:17:03haxscramperdisruptek: I'm talking more about explaining what is going on in general. And even more specifically following questions: "How I can create nim projects nimph?", "how I add dependencies.", "how do I publish them?"
19:17:03haxscramper
19:17:16haxscramperE.g. most dead-simple question
19:17:19disruptekyou use your .nimble file as per usual.
19:17:39disruptekit's a fair question, though, i will update the readme.
19:17:51*D_ joined #nim
19:18:18haxscramperSo basically https://documentation.divio.com/how-to-guides/ are not present in readme
19:18:28haxscramperIt has a good reference guide
19:18:48haxscramperIt might benefit from explanation of reasoning behind, maybe some cool tricks
19:18:50disrupteki think the video shows this.
19:18:59disruptekbut like i said, i need to produce some new demos.
19:19:11haxscramperI personally watched video one time
19:19:18disruptekit was easier when i was streaming; people could pop in and watch it work.
19:19:39haxscramperI can't spend all time looking for particular second in the video where it shows somehting, regardless of how great it is
19:21:13*narimiran quit (Ping timeout: 246 seconds)
19:21:51disrupteki understand; you want me to sell you my product that i made for myself, but you want to be spoon fed, wined and dined, on your terms.
19:22:02haxscramperWell
19:22:03haxscramper
19:22:23disruptekif you're satisfied with nimble, use nimble. nimble needs more users.
19:22:35haxscramperI'm not /exactly/ satisfied with nimble
19:22:41disrupteknimph has remained virtually unchanged for a year. it doesn't really need attention.
19:23:01haxscramperBut at the same time I don't /exactly/ know how to make nimph useful to me
19:23:13disruptekhonestly, that's not my problem.
19:23:16haxscramperWell
19:23:24haxscramperokay, let's stop them
19:23:26haxscramperthen*
19:23:29disrupteki am happy to talk about it, but don't make me guess what your problem is with nimble.
19:23:29*narimiran joined #nim
19:24:33haxscramperIf you made nimph mostly for yourself then I guess, yes, it doesn't really matter
19:24:47haxscramperI just had an impression you wanted people to start using it
19:24:58disruptekhah, no. i gave up on that.
19:25:06disrupteki also made nimph for araq.
19:25:10disruptekand shashlick.
19:25:18haxscramperalright, just some misunderstaning I guess
19:25:46haxscrampermisunderstaning on my side*
19:25:48disruptekbut, shashlick got sucked into the bottomless pit of nimble and is now on hiatus. and araq thinks my opinion is only slightly less worthless than my code, so...
19:26:22haxscramperalright, I will then try to implement some of the things I wrote above
19:26:25haxscramperafter docgen
19:26:39*PMunch quit (Quit: leaving)
19:27:39disruptekare you talking about gram?
19:27:57*haxscramper left #nim ("ERC (IRC client for Emacs 27.1)")
19:28:04*haxscramper joined #nim
19:28:14haxscramperNo, I'm talking about how-to guides for nimph
19:28:24haxscrampergram is just a matter of writing some code
19:28:28disruptekoh, don't worry about it. i will get to it eventually.
19:28:44disruptekit's silly to ask someone who doesn't need/use software to write technical docs for it.
19:29:24disrupteknimph has a much more sophisticated dependency analysis system than nimble.
19:29:47disruptekit knows about tags and what they mean, how they relate to nimble versions, where and where they occurred.
19:30:00haxscramperWell, whatever, though I would say in my experience /the best/ how-to guides can be written by someone how is learning how to use things themselves.
19:30:02disruptekit knows about github, forks, remotes, clones, etc.
19:30:19disruptekit knows how to upgrade/downgrade projects so that all dependencies remain satisfied.
19:30:47disruptekit knows how to work with projects that may have multiple nimblePaths, local deps, not-quite-local deps, and any combination of the same.
19:30:51haxscramperAnd again - I'm not talking about /techical/ documentation, I'm talking about this spoon-fed, sliced/diced approach that you don't partuclarly seem to be a fond of
19:31:58haxscramperso I said I will look into writing this part
19:32:01disrupteki think the problem i have with "spoon fed" is that i would never presume to tell you how to work.
19:32:15disrupteknimph is a tool. how you wield it is up to you.
19:33:13haxscramperyeah, but just any tool I need to know /at least one/ way to wield it, and I would bet you have something to tell about this?
19:33:38disruptekif you have access to the README.md you can see many examples of usage.
19:33:54disruptekif you don't, you might glean something from `nimph --help` i guess.
19:33:59haxscramperBut anyway, this is starting to go in circles, but I think I understand your position on this much better now
19:34:32disrupteknimph is opinionated: the opinion is that package management shouldn't even be a thing.
19:34:45disruptekit's stupid, hateful, terrible business and we should outlaw it.
19:43:50FromDiscord<dom96> Hopefully soon we’ll get lockfiles into nimble. That should improve it significantly.
19:47:15leorizelockfiles require too much compiler changes tbh
19:48:06disruptekweird.
19:48:17disruptekscramper: do you want to drop 1.2 support? i'm fine with that, btw.
19:48:23disruptekfrom gram, i mean.
19:48:28haxscramperyes
19:48:29*u0_a216 joined #nim
19:48:38disruptekjust update the ci in .github
19:48:47leorizewe should just move the package manager into the compiler instead of this weird "nimble development requires compiler changes" scheme
19:49:05haxscramperThough I stated to backfix hmisc, but this is easier
19:49:10disrupteki have a new gitnim that works with the dist if you wanna fuck with it.
19:49:29disruptekit's probably a little buggy.
19:49:43haxscramperdisruptek: by they way, I remembered you wanted to see pathutils in stdlib
19:49:54*abm joined #nim
19:50:12disruptekyeah, i know you have a paths lib.
19:50:18haxscrampergood
19:50:32disruptekmaybe i'll use it in ups instead of nimph's stuff.
19:51:07haxscramperIt is a bit raw wrt. to API, but it should be usable
19:54:13FromDiscord<dom96> @leorize lock files shouldn’t need any changes to the compiler
19:54:28*u0_a216 quit (Ping timeout: 246 seconds)
19:54:49disrupteki can't even find the lockfiles pr anymore.
19:56:09leorize[m]@dom96 #12104
19:56:10disbothttps://github.com/nim-lang/Nim/pull/12104 -- 3Add changes required by Nimble lock file support
19:57:43*leorize quit (Ping timeout: 240 seconds)
19:58:59*leorize joined #nim
19:59:20leorizeis status still working on lock files or have they bailed?
20:00:01disruptekleorize: araq insists that the compiler itself not access the network, so except for that requirement, i agree that the pm should be in the compiler.
20:00:52*leorize quit (Remote host closed the connection)
20:01:06FromDiscord<mratsim> "Hopefully soon", I think I finally understand that `soon` in Nim is in Valve Time (yes I'm also guilty of this).
20:01:19*leorize joined #nim
20:01:26leorizenot accessing the network is easy, just assign the task to an external tool
20:01:37disruptekyes.
20:02:02leorizeand hey, if that tool have a defined interface to the compiler, then you just invented vendoring :P
20:02:08FromDiscord<mratsim> A new RFC: https://github.com/nim-lang/RFCs/issues/312
20:02:09disbotRenaming openarray
20:02:19FromDiscord<mratsim> bikeshed at will
20:03:43*clyybber quit (Quit: WeeChat 3.0)
20:06:11leorizeit would also be nice if analysis expands to closure, so that we can capture openArray[T]/var parameters
20:06:21leorizebut that's out of scope of your rfc i believe
20:07:08*vicfred joined #nim
20:07:23*waleee-cl quit (Read error: Connection reset by peer)
20:07:43*waleee-cl joined #nim
20:08:17haxscramperdisruptek: CI is green, I fixed your suggestions, though `toDotNodeId` converter is still marked as `export` directly, because I don't think it is necessary to abstract it
20:08:42disruptekgreat, merge that fucker please.
20:09:13FromDiscord<mratsim> @leorize, yeah i want a plain bikeshedding RFC
20:09:28FromDiscord<mratsim> the last part is just to plant ideas in mind for a future RFC 😉
20:10:48disrupteki guess status doesn't want to help with dist.
20:10:49FromDiscord<Clyybber> why would the compiler need to change for lockfiles
20:11:00FromDiscord<Clyybber> the compiler shouldn't care about package management tbh.
20:11:13FromDiscord<Clyybber> It gets a filesystem with files. That should be plenty enough of information
20:11:49disruptekwe already distribute the pm with the compiler.
20:12:28FromDiscord<Clyybber> Yes. But they are perfectly fine seperate
20:12:54FromDiscord<Clyybber> Which is better because it enables diversity for the package managers
20:13:00FromDiscord<Clyybber> otherwise nimph wouldn't exist
20:13:04disruptekyeah, fat lot of good that has done us.
20:13:21FromDiscord<mratsim> @disruptek, dist?
20:13:23disrupteki would rather have no package manager, honestly.
20:13:29disruptek!repo disruptek/dist
20:13:31disbothttps://github.com/disruptek/dist -- 9dist: 11a nim distribution 👑 15 14⭐ 0🍴
20:13:40disruptekneither you or arne accepted my invite. 😢
20:13:54FromDiscord<Clyybber> disruptek: Exacttly why its great to not merge it into the compiler
20:14:04FromDiscord<mratsim> ah, it's likely that we were drown in mails
20:14:59FromDiscord<mratsim> We do want to improve tooling though, we are reaching the limit of makefiles, and git submodules are also somewhat error prone
20:16:05FromDiscord<Clyybber> @mratsim I added a small comment to the PR, since we will need two kinds of slice types
20:16:12FromDiscord<Clyybber> One that can be copied and one that cannot be
20:16:30leorizeClyybber: no they are not fine separate. The compiler has a different notion of nimbleDir than the package manager
20:16:46FromDiscord<Clyybber> The compiler shouldn't have any notion of nimbleDir IMO
20:16:54FromDiscord<Clyybber> nimble isn't even using nimbleDir anymore
20:17:02FromDiscord<Clyybber> afaik
20:17:02leorizebut user experience suffers
20:17:12FromDiscord<Clyybber> How so?
20:17:17FromDiscord<mratsim> @Clyybber isn't the copy/nocopy derived from T? I'm only talking about openarray here
20:17:23disrupteknimble doesn't use nimblePath; it uses nimbleDir, which is a different thing that the compiler doesn't know about.
20:17:44leorizeClyybber: `nimble install` won't give you the "install then you can prototype" experience
20:18:34FromDiscord<Clyybber> Because you have to add it as a dependency?
20:19:03FromDiscord<Clyybber> @mratsim Yeah, but one would still want two kinds of slices because one might want to guarantee that a slice keeps being a view into the original container
20:19:17leorizebecause I would need a .nimble before I can do any writing is what I mean
20:19:21FromDiscord<Clyybber> and the copyable slice is kind of like a background optimization
20:19:33FromDiscord<Clyybber> leorize: Yeah, understood
20:19:42disruptekleorize: use nimph for your prototyping. 😁
20:19:47FromDiscord<Clyybber> Seems like thats solved with config file
20:19:58leorizeso practically you end up needing to use `nimble c`, `nimble build`, etc.
20:20:15FromDiscord<Clyybber> IMO we just need wildcard support
20:20:17leorizeClyybber: uh, no
20:20:37disruptekwhat is wildcard support?
20:20:54leorizethere's a dependency graph associated with packages
20:20:57FromDiscord<Clyybber> --path:somepathtoanimbledir/
20:20:58FromDiscord<mratsim> @Clyybber when you copy a pointer, it keeps being a pointer to the original location
20:21:08FromDiscord<Clyybber> @mratsim I am talking about deep copies
20:21:17leorizeif the compiler solve it wrong your precious `nim c` stops working
20:21:21disruptekwe have that in nimblePath afaik.
20:21:27FromDiscord<mratsim> but openarrays have deepCopy?
20:21:47leorizeI don't know what is this weird fascination with not having the package manager in the compiler
20:22:13disruptekit would make more sense if there was a richer api to worry about between the two.
20:22:24FromDiscord<Clyybber> @mratsim Imagine if the regular slice index returned non-copyable views, it would break all kinds of code because the returned slice cannot escape its owner
20:22:33FromDiscord<Clyybber> So to solve that we deep copy the slice whenever needed
20:22:34disruptekthen separating them could ensure they stay true to the api.
20:22:49FromDiscord<Clyybber> But we should give the user the option to prevent that
20:22:56FromDiscord<Clyybber> via a non-copyable slice type
20:23:19FromDiscord<Clyybber> leorize: Not a weird fascination. Just a simple seperation of concerns
20:23:29FromDiscord<mratsim> but now openarray can be returned from a proc
20:23:33leorizeit's not, really
20:23:42FromDiscord<Clyybber> Its simply easier for the compiler devs if they are given --paths
20:23:51FromDiscord<mratsim> there is no code that would be broken because you couldn't return openarray from a proc
20:24:02FromDiscord<mratsim> at least until experimental:views
20:24:16FromDiscord<Clyybber> @mratsim But we want to change a[0..10] to return a slice
20:24:29FromDiscord<mratsim> that's why it's in stretch goal
20:24:41FromDiscord<Clyybber> Yeah, I just wanted to add it for brevity
20:24:55FromDiscord<Clyybber> Since its something I discussed with cooldome and araq
20:25:10leorizethis is kinda like C++ people refusing the idea of modules, which btw, many of them still don't want that, they think their include system is superior because of the same reason
20:25:40FromDiscord<mratsim> tbh I don't understand the difference between a file and a module
20:25:55FromDiscord<Clyybber> leorize: I simply don't understand why the package manager needs more than --path and maybe wildcards
20:26:11leorizebecause dependency resolution
20:26:39disrupteki just don't want wildcards that allow for gram-1.0 and gram-1.0.0 and gram-2.0.0.
20:26:48disruptekif it's a flat namespace, make it flat.
20:26:49leorizepackage A requires "B >= 0.5.0 & < 1.0.0", but you have "B 1.2.0" and "B 0.3.0" installed
20:27:09leorizethe package manager will resolve the issue and pick the right version
20:27:19FromDiscord<Clyybber> Yes. Problem solved
20:27:23leorizegive it to the compiler? it will mash "A" and "B 1.2.0" together
20:27:32FromDiscord<Clyybber> Huh?
20:27:37leorizenow your `nim c` doesn't work
20:27:49disruptekleorize: he wants the pm to edit the nim.cfg.
20:28:07disruptekwhich is not unreasonable as long as /only/ the pm edits the nim.cfg.
20:28:10leorizeyou have practically the same issue, just with a larger graph
20:28:26leorize"multiple version of the same package" is a feature that's useful
20:28:34FromDiscord<Clyybber> and the compiler supports it
20:28:51leorizesemver is stupid in that it believes a "major" bump is just an increment of a number
20:28:51FromDiscord<Clyybber> by simply using the filesystem structure
20:30:16leorizehow does the compiler know which version to pick?
20:31:00disruptekas does nimph.
20:31:00disruptekit could exploit the fs structure better by not versioning directories.
20:31:01disruptekreally creepy code.
20:31:02disruptekand it doesn't necessarily do the right thing.
20:31:03disruptek...which is another reason nimph exists.
20:31:17disruptekof particular concern is shadowed versions such that you remove one and suddenly the compiler is using a different version of a dependency; it's a real problem in nimble.
20:31:18FromDiscord<Clyybber> it doesn't. I understand your issue. You want the compiler to understand versions so you don't have to invoke the package manager
20:31:42disrupteki don't. maybe leorize does.
20:32:17FromDiscord<Clyybber> the argument for quick prototyping doesn't hold up IMO
20:32:27disruptekuse dist for that.
20:32:33FromDiscord<Clyybber> because once you are specifying which versions you want to use you are out of the quick prototyping stage
20:32:38FromDiscord<Clyybber> and you might as well invoke the PM
20:32:47FromDiscord<Clyybber> but as I said we could simply use the config for that
20:33:45FromDiscord<Clyybber> which could include --path:pathtonimbledirorwhatever/testes-2.0/
20:34:45disruptekdist or gitnim could generate a series of `--path="$nimbledir/some-1.0/src/"` statements to stdout and you could append it to your cfg, i guess.
20:35:08disruptekthen you simply set nimbledir to dist and you're done.
20:35:56disruptekit still breaks when you have multiple nimblePaths defined, though.
20:38:14leorizeClyybber: let me give you a graph: A depends on "B v1.0.0" and "C v1.2.0", C depends on "B v2.0.0". B has a breaking change from v1 -> v2. How is the compiler gonna handle this?
20:39:07FromDiscord<Clyybber> the .cfg of A includes --path:pathToBv1.0.0 and the .cfg of C includes --path:pathToBv2.0.0
20:39:32giacoI'm building a nim program that shows no external .so with ldd, but requires them at runtime. "strace -e trace=open ./myprogram" doesn't catch them, how can I list all the required libs?
20:39:40leorizeClyybber: `.cfg`s doesn't mix between packages in Nim
20:39:51leorizethey don't even mix between modules
20:39:58FromDiscord<Clyybber> What do you mean?
20:40:15leorizethe compiler only load the config of the main file
20:40:38FromDiscord<Clyybber> I don't know what you mean
20:41:22leorizeI'm telling you why your .cfg scheme doesn't work
20:41:56FromDiscord<Clyybber> Yeah, I don't get why
20:42:08FromDiscord<Clyybber> Are you telling me that only A.cfg will get read?
20:42:19FromDiscord<Clyybber> and not C.cfg?
20:42:35leorizebecause if you call `nim c file.nim`, only global configs will be read + `file.nim.cfg` and/or `nim.cfg` in the directory
20:44:00leorizepackage A here can just be something I installed via `nimble install` to try out
20:44:11FromDiscord<Clyybber> Ah, right. I think we need a way to let A.cfg chain C.cfg then
20:44:41FromDiscord<Clyybber> This needs to be implemented in the compiler
20:45:19leorizegiaco: you can't, sadly. I'm planning to write an RFC to favor link-time dynamic linking instead of the current runtime dynamic linking
20:45:43leorizea way out could be to use `{.passL.}` to pass the link flag and drop `{.dynlib.}`
20:47:35leorize@Clyybber: well now you got a problem. Some configuration can't be composed between modules. Realistically only `--path` can be composed, which is why our config resolution works the way it is right now.
20:47:51leorizecomposed safely*
20:48:26FromDiscord<Clyybber> Hmm, you're right
20:48:59FromDiscord<dom96> @dom96 #12104↵↵See my comments in that PR.
20:49:00disbothttps://github.com/nim-lang/Nim/pull/12104 -- 3Add changes required by Nimble lock file support
20:49:16FromDiscord<dom96> (edit) "@dom96 #12104↵↵See" => "@leorize See"
20:49:17disbothttps://github.com/nim-lang/Nim/pull/12104 -- 3Add changes required by Nimble lock file support
20:50:40leorize@Clyybber so now you need a new format to only specify paths
20:50:44FromDiscord<Clyybber> leorize: Sounds like we need .path :P
20:50:47FromDiscord<Clyybber> yeah :/
20:50:54leorizeand that's assuming that you want the "vendoring" model
20:51:03FromDiscord<dom96> > because I would need a .nimble before I can do any writing is what I mean↵↵Glad I’m not the only one that cares about this
20:51:16leorizeas in all deps got installed in one place in the current project
20:51:31FromDiscord<dom96> This is the only reason Nim is aware of Nimble
20:52:32FromDiscord<Clyybber> leorize: They could be installed anywhere as long as your pathconfigs are set up to point at them
20:52:50leorizethey can't be global
20:52:57FromDiscord<Clyybber> why not?
20:53:10leorizethe reason is simple, upgrades
20:53:59FromDiscord<Clyybber> can you elaborate?
20:54:25leorizelet's revisit our A, which requires "B >= 1.5.0 & < 2.0.0" and "C >= 1.2.0 & < 2.0.0", where C requires "B 2.0.0"
20:55:00leorizenow you add an another dep into the list, which is "D", that requires "B >= 1.7.0 & < 2.0.0"
20:55:28leorizenow you would want to upgrade to "B 1.7.0" for A since it's still compatible
20:56:34leorizewhat does that mean? you have to rewrite .path for A, globally affecting everything else
20:57:31FromDiscord<Clyybber> you mean rewriting .path for A affects everything else? But everything else also has a .path which takes priority
20:57:47leorizeit affects other projects
20:57:57leorizeremember, our packages folder is globally shared
20:58:43giacoleorize: thanks
20:59:08*narimiran quit (Ping timeout: 265 seconds)
20:59:09FromDiscord<Clyybber> leorize: Oh, what I meant is for the dependecies to be global not the configs
20:59:14FromDiscord<Clyybber> A would have its own .path
20:59:36FromDiscord<Clyybber> which does not affect anything not part of A
21:00:08FromDiscord<Clyybber> I meant we can point --paths in a .path of A to someGlobalDirForPackages/Bv.1.7.0
21:01:33leorizesay, you're developing "foo" and "bar", where "foo" imports "A", and "E", which requires "B == 1.5.0", but "bar" imports "A" and "D"
21:04:10leorizewhen you build "bar.nim", "B" need to be upgraded to a newer version for "A", which rewrites A's ".path"
21:04:48leorizenow you `nim c foo.nim`, and you can see the problem
21:05:29FromDiscord<Clyybber> but As .path would still be fine for A
21:05:43FromDiscord<Clyybber> since A requires B >= 1.5.0 & < 2.0.0
21:05:45leorizefoo.nim depends on: A, B 1.5.0, B 1.7.0, E
21:05:59leorizethe dep tree is now polluted for foo.nim
21:06:44FromDiscord<Clyybber> Why wouldn't foo.nim simply depend on A, B 1.7.0, E now?
21:06:49leorizeit should only require "B 1.5.0", but because a previous build of "bar" with "package manager" rewrites "A.path" to refer to "B 1.7.0", "foo.nim" now need both B 1.5.0 and 1.7.0
21:06:53FromDiscord<Clyybber> oh eh
21:07:10leorizeE requires "B == 1.5.0", which "foo.nim" depends on
21:07:11FromDiscord<Clyybber> which part of foo requires B == 1.5.0?
21:07:14FromDiscord<Clyybber> ah
21:07:28FromDiscord<Clyybber> But A doesn't require E ?
21:08:24*u0_a216 joined #nim
21:09:02leorizeyou can see the dep tree: it's foo -> [A -> [B 1.7.0, C -> B 2.0.0], E -> B 1.5.0]
21:09:43leorizebut A is compatible with B 1.5.0, so you would want to only need B 1.5.0 in the build to reduce deps
21:10:47FromDiscord<Clyybber> I see.
21:10:47leorizebut if the package manager is not used (our scenario is `nim c foo.nim`), A.path won't be updated to use B 1.5.0
21:11:07FromDiscord<Clyybber> So it would still compile but pull in unneeded deps
21:11:14FromDiscord<Clyybber> Hmm
21:12:46FromDiscord<Clyybber> So we should actually move all .paths to foo, conceptualy
21:13:03leorizenow you need to invoke the package manager to build every single thing
21:13:05FromDiscord<Clyybber> So that foo has .path files that define paths for A, C, and E
21:13:09leorizecongrats you invented rust
21:13:17leorizecargo*
21:13:28FromDiscord<Clyybber> But the compiler could read these path files
21:13:51leorizeyes but if you don't call the package manager you won't get them to begin with, right?
21:14:42FromDiscord<Clyybber> yeah. So you call the PM once to build your depency tree/config/paths
21:14:49FromDiscord<Clyybber> And then you can use the compiler normally
21:15:13FromDiscord<Clyybber> And they communicate via .paths
21:15:40*u0_a216 quit (Ping timeout: 246 seconds)
21:15:47FromDiscord<Clyybber> Which are basically lockfiles
21:15:49FromDiscord<Clyybber> I guess
21:15:50leorizenow, to use packages, you end up calling "nimble c", "nimble whatever" all the time because it would just works™ then
21:16:15FromDiscord<Clyybber> you can do that
21:16:27FromDiscord<Clyybber> or you could do nimble reload/nimble setup or whatever
21:16:31FromDiscord<Clyybber> and then just nim c
21:17:10leorizewhy do that when `nimble c`, `nimble suggest` do the right thing all the time?
21:17:15*u0_a216 joined #nim
21:17:28leorizeyou've deprecated the `nim` command into a "please never use" command
21:17:56leorizebasically this is how gcc, clang, rustc works
21:18:25FromDiscord<Clyybber> But we have .path/.cfg files
21:18:31FromDiscord<Clyybber> So its different
21:18:41leorizeand if we want to modularize the stdlib into a collection of packages, what would happen then? you need to call `nimble` to build every damn thing
21:19:35leorizerealistically, what will those files do you when you have to call nimble anyway?
21:20:42FromDiscord<Clyybber> yeah nothing. If you only ever call nimble then nimble could do it the C way and pass the paths as cmdline args
21:21:10FromDiscord<Clyybber> So what you propose is to move this version resolving mechanism into the compiler
21:21:36FromDiscord<Clyybber> Is it also the compilers duty to download packages?
21:22:40FromDiscord<Clyybber> There are just so many ways to do package management
21:22:41leorizeit could be, but if you hate the compiler accessing the internet then it's easy to outsource that
21:23:00FromDiscord<Clyybber> I don't feel its a smart idea to put THE ONLY ONE WAY into the compiler
21:23:20FromDiscord<Clyybber> Maybe the compiler needs to have a package manager option then
21:23:31FromDiscord<Clyybber> So that it can call "nimble reload" when invoked
21:23:58FromDiscord<Clyybber> Or package managers should be some kind of compiler plugin
21:25:05*u0_a216 quit (Ping timeout: 240 seconds)
21:25:49leorizeI think by this time we should agree that packages are as fundamental of an unit as modules
21:26:03leorizeit's everywhere, the moment you use 3rd-party code you have packages
21:26:18Zevvdisruptek gave up joining your discussions?
21:26:19*u0_a216 joined #nim
21:26:34leorizeso I'd argue that it need first class support the same way we support modules
21:26:39FromDiscord<Clyybber> packages are arbitrary
21:27:10FromDiscord<Clyybber> we can do it on a folder granularity
21:27:24FromDiscord<dom96> Nim already has a concept of a "package"
21:27:31FromDiscord<dom96> but it's something that has grown organically
21:27:37FromDiscord<dom96> and probably could be improved
21:27:46FromDiscord<dom96> A package is any folder with a .nimble file inside it
21:27:56FromDiscord<Clyybber> Yeah, thats fine
21:28:10giacoafter Nim in action, is there any other Nim book / long organic prosaic reading that you would recommend?
21:29:10FromDiscord<inv> Are there any smart logic how NIm select kind for field-check or it is just fieldname<=>kind mapping at the moment ?
21:29:28FromDiscord<inv> (edit) "NIm select" => "Nim selects"
21:30:06FromDiscord<Clyybber> leorize: IMO packages should be a first class concept to the PM which then translates these packages into folder/path concepts which are first class for the compiler
21:30:26FromDiscord<Clyybber> This is simple and allows us to exchange the way that packages are handled more easily
21:30:39leorizefolders don't have dependency
21:30:59FromDiscord<Clyybber> which is why we translate packages into folder/path concepts
21:31:41FromDiscord<Clyybber> with something similar to timothees prefix path RFC we would have a way to specify dependencies for folders/modules using paths
21:32:14disrupteka directory is a package.
21:32:14disruptekit's just that simple.
21:32:27disrupteki'm at the point where i don't really care anymore as long as the compiler doesn't change in some stupid way that makes it impossible for me to do the right thing.
21:32:47disrupteki have more interesting arguments to make on more interesting software.
21:33:25FromDiscord<Clyybber> We only need to agree on how the PM and the compiler communicate
21:33:41disruptekshashlick established that long ago.
21:34:08FromDiscord<Clyybber> Yes. leorize doesn't like it because it makes nimble c work always
21:34:17FromDiscord<Clyybber> and nim c only work after invoking the PM once
21:34:17disrupteki don't see how.
21:34:25*filcuc_ joined #nim
21:34:26FromDiscord<Clyybber> so he says users will always prefer nimble c
21:34:45disruptekwell, nimph can produce the cfg and then the compiler runs. just that simple.
21:34:53FromDiscord<Clyybber> Yep
21:34:58disruptekif users want nimble, they can use nimble.
21:35:10FromDiscord<Clyybber> leorize's point is that they can't use nim c itself
21:35:15FromDiscord<Clyybber> So they will use nimble c
21:35:23disruptekeventually, nimph will also produce your test runner and a builder (or the same thing).
21:35:26FromDiscord<Clyybber> or nimph c
21:35:35FromDiscord<Clyybber> and afterwards they may be able to use nim c too
21:35:36disruptekno, you don't need nimph c.
21:35:49FromDiscord<Clyybber> nimph init/reload/buildDependencyTree or whatever
21:35:59disruptekwell what's the solution? you already said you don't want the pm to interface with the compiler.
21:36:15disruptekobviously, it has to run before the compiler if the compiler won't invoke it, right?
21:36:16FromDiscord<Clyybber> Yeah, I don't see a better solution
21:36:21FromDiscord<Clyybber> And its not a real problem
21:36:25disrupteki agree.
21:36:35FromDiscord<Clyybber> It doesn't hurt the user if they run nimble c instead of nim c
21:36:44FromDiscord<Clyybber> but if they want to nim c
21:36:56FromDiscord<Clyybber> then obviously they must first invoke the PM once
21:37:01disrupteknim c /could/ conceivably work with a static .nimph. pragma.
21:37:05disruptekbut i wouldn't hold my breath.
21:37:16FromDiscord<Clyybber> what woudl that be?
21:37:42FromDiscord<dom96> IMO the "nimble c" vs "nim c" distinction is a nice one to have
21:37:46disruptek{.nimph: "https://github.com/disruptek/gram#<2.0.0".}
21:38:31FromDiscord<Clyybber> leorize's point is (sorry leorize if I misunderstood you), that the average user doesn't care about the difference between compiler and PM and wether they are seperated
21:38:58FromDiscord<Clyybber> So it would be less confusing for them if there were one right way TM
21:39:07FromDiscord<Clyybber> which would be nim c
21:39:22disrupteksure, well that's clear.
21:39:42FromDiscord<Clyybber> I guess the compiler could read a config option telling him to invoke a PM
21:39:53FromDiscord<Clyybber> so that nim c first calls nimble reload
21:40:04disruptekmadness.
21:40:14FromDiscord<Clyybber> yeah, its a bit mad
21:40:20disruptekwhy don't we just agree that not all users need to use the same workflow.
21:40:36FromDiscord<Clyybber> disruptek: I mean this would be seperate of workflow I suppose
21:40:50giacoI'm a newbie, but I like to nimble c. It would be even better if nimble would install packages in local folder next to nimble file by default instead of ~/.nimble
21:40:51FromDiscord<Clyybber> Users coudld also set it to git --init --recursive
21:40:52disruptekespecially when it may, for some users, include software that sucks a big, fat, throbbing, glistening, horse cock.
21:40:54FromDiscord<dom96> Is it really that confusing to learn the difference between `nim c` and `nimble c`?
21:41:14leorizeit's not about having to learn them
21:41:24FromDiscord<dom96> giaco: you can enable local deps and have Nimble do this
21:41:25disruptekgiaco: see --localdeps option to nimble.
21:41:26leorizeit's about "why the hell would I need two different thing?"
21:41:30FromDiscord<lqdev> so i'm in progress of trying to port pan, my animation program, to a newer version of nim and my engine, and i got this strange error:
21:41:39FromDiscord<lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2LHb
21:41:41giacoyeah, that's why I added "by default"
21:42:06FromDiscord<lqdev> and the offending call is generated using `newCall` from a macro
21:42:14FromDiscord<lqdev> problem is, i don't use named parameters anywhere…
21:42:50FromDiscord<dom96> leorize: most people indeed wouldn't need both
21:42:59disruptekgiaco: i think if you `mkdir nimbledeps` it defaults to localdeps mode.
21:43:18disrupteki'm not super well-versed on nimble, though.
21:44:38disrupteklqdev: are you using it in a template?
21:44:49FromDiscord<lqdev> no, in a proc
21:45:02FromDiscord<lqdev> i think this may be related to the recent change that proc params are now typed
21:45:02leorizeif you add "compiler commands" into nimble, then, uh... did you just invent compiler and package manager in one software?
21:45:12FromDiscord<lqdev> do i need to genSym them now? right now i'm just generating nnkIdents
21:45:50FromDiscord<Clyybber> leorize: Well fork nimble and remove nimble c. Then users can't get confused anymore
21:45:53FromDiscord<lqdev> oh wait
21:46:01*u0_a216 quit (Ping timeout: 265 seconds)
21:46:03FromDiscord<Clyybber> .s/Well/Well one could
21:46:06FromDiscord<lqdev> i'm not generating them, just copying them over from the previous proc's signature
21:46:10FromDiscord<inv> I am confused, why nimble run --d:release abc and nimble --d:release run abc compiles in release, but I definitely see the different
21:46:12FromDiscord<lqdev> that could be the issue but idk
21:46:17FromDiscord<inv> (edit) "I am confused, why nimble run --d:release abc and nimble --d:release run abc compiles in release, but I definitely see the different ... " added "in speed"
21:46:28disrupteklqdev: are you sure you're not passing an identDefs to the proc?
21:46:55disruptekyou didn't really give us enough paste to work with, i think.
21:46:57FromDiscord<Clyybber> leorize: And even with nimble c, nimble is basically just passing it over
21:47:05leorize@Clyybber my point is you should never need this arbitrary distinction
21:47:10leorizeUX-wise it's terrible
21:47:11FromDiscord<lqdev> disruptek: yeah
21:47:14disruptekyes, it serves only to confuse things.
21:47:31FromDiscord<lqdev> disruptek: this is the macro https://github.com/liquidev/pan/blob/master/src/pan/luaapi.nim#L118
21:47:54FromDiscord<dom96> leorize: it's how cargo/rustc works too afaik
21:48:13disruptekdom96: well, then it /must/ be the right design.
21:48:50disruptekuse repr when composing strings based on symbols.
21:49:08disruptekwhatfer gensym reasons.
21:49:48disruptekyou need to desem that procedure.name i'll bet.
21:49:54FromDiscord<Clyybber> leorize: I dunno. there are simply multiple ways to do PM.
21:50:14disruptekident(repr procedure.name) is sufficient.
21:50:15FromDiscord<Clyybber> And we can still patch over the "terrible" UX by providing passthrough PM commands for compiling
21:50:37FromDiscord<dom96> disruptek: not saying it's the right design, but there is merit for it and it works fine for them.
21:50:53disruptekdom96: this is not rust.
21:51:02disrupteki won't argue with you as if it were.
21:51:05disruptekthat would be stupid.
21:51:08FromDiscord<Clyybber> disruptek: You agree with dom96 though
21:51:21disruptekit happens from time to time.
21:51:21disruptekhe's not a complete idiot.
21:51:23leorize@Clyybber then what's the point of even showing the `nim` command to the user?
21:51:45FromDiscord<Clyybber> leorize: There is none. Depending on your PM
21:51:53FromDiscord<dom96> lol
21:51:59FromDiscord<lqdev> disruptek: de-symming the original proc params' identDefs solved the problem
21:52:04FromDiscord<Clyybber> If your PM does not provide those passthrough commands then there is.
21:52:09FromDiscord<lqdev> stdlib really needs a desym proc or something like that
21:52:21disruptekclyybber: here's the problem: the job that the pm does only needs to be done when the env changes.
21:52:21disruptekergo, i want to run it only at those times.
21:52:21FromDiscord<Clyybber> @lqdev Got recently added
21:52:27disrupteki want it to manage only those changes.
21:52:28FromDiscord<lqdev> @Clyybber is it in 1.4?
21:52:38FromDiscord<Clyybber> disruptek: Yes, but the PM can figure it out.
21:52:45disruptekof course it can, yes.
21:52:52disruptekbut i don't want to run it except at those times.
21:52:55FromDiscord<Clyybber> @lqdev Don't think so
21:53:07disruptekthe rest of the time, either the pm will have produced a build program for me, or i will build using the compiler.
21:53:16FromDiscord<Clyybber> Yeah
21:53:23disrupteki plan to ship a package manager with my projects in the future.
21:53:37disruptekit will include testing, ci, performance analysis, everything.
21:53:45disruptekbecause this shit is fucking ridiculous.
21:54:07FromDiscord<lqdev> @Clyybber where's the proc on devel? looking through macros in devel docs, can't find anything.
21:54:17FromDiscord<Clyybber> Oh, maybe it wasn't merged yet
21:54:36disrupteki think maybe planetis-m authored it but i don't recall.
21:54:54disruptekanyway, you can write your own desym to do the same thing. or steal it from any of my macro-heavy projects.
21:55:25FromDiscord<Nisha|💻⭐> What's a desym?-
21:55:34FromDiscord<Clyybber> disruptek: How is it ridiculous? We basically all agree that theres a conflict between UX and flexibility
21:55:52disrupteknisha: turning a symbol into an identifier.
21:56:07disruptekclyybber: because this is not the useful part of software sharing.
21:56:15FromDiscord<Nisha|💻⭐> Thanks!
21:56:24disrupteknone of it adds value.
21:56:32FromDiscord<Clyybber> disruptek: Well it's a discussion.
21:56:43FromDiscord<Clyybber> good UX does add value
21:56:48FromDiscord<Clyybber> flexibility does too
21:56:56leorize@Clyybber: the reason that I'm critical about the "just work without having to declare dependency while prototyping" flow is that if we ever want to turn stdlib into a collection of packages, this is the exact problem
21:57:07disruptekyes, and that's why i'd supply everything you need to test, document, build, install, use my software.
21:57:23disruptekyou supply the compiler. i'll supply everything else.
21:57:51FromDiscord<Clyybber> leorize: If the stdlib gets turned into packages they should be treated as packages
21:58:00FromDiscord<Clyybber> So of course you would then need a package manager
21:58:00leorizeusers want `echo "Hello, world!"` or `import re` to work without declaring dependencies
21:58:14disruptekand they will, with dist.
21:58:15FromDiscord<Clyybber> well then we shouldn't split the stdlib into packages
21:58:37disruptekgitnim now manages the distribution, too. at least, the version in 1.5.1.
21:59:03disruptekthough it's probably buggy as fuck.
21:59:11leorizesplitting stdlib into packages is realistically the best way to develop it
21:59:24FromDiscord<Clyybber> But if you split it into packages
21:59:27leorize`os` gets a breaking change? release `os 2.0.0`
21:59:48FromDiscord<Clyybber> then its also realistic that users will want to specify dependecies
22:00:02disruptekand they can do.
22:00:12FromDiscord<Clyybber> but things like dist could still provide a fallback
22:00:30leorizethey can, but why would they when they are just experimenting?
22:00:52FromDiscord<Clyybber> if they are just experimenting they will use the fallback
22:00:52FromDiscord<dom96> I don't think splitting the stdlib from the language is realistic
22:01:00leorizewhen they want to turn it into a project they call "nim init-package" and suddenly they got a project dir with all the deps they were using added
22:01:03FromDiscord<dom96> For one thing, the compiler depends on a lot of the stdlib
22:01:19disruptekdom96: that's why i want dist.
22:01:19FromDiscord<Clyybber> leorize: Well, yeah? What else would they want/
22:01:26disrupteki want to be able to bring modern software into the compiler.
22:01:51FromDiscord<dom96> right...
22:01:55FromDiscord<Clyybber> If I clone a package I would want to knwo what deps it has
22:01:56leorize@Clyybber well I'm telling you why having no-config build is useful
22:02:24leorizeif it doesn't have .nimble or whatever, it's not a package
22:02:29leorizesimple as that
22:02:38disrupteka package is any directory with a .nim in it.
22:02:42disrupteksimple as that.
22:03:20FromDiscord<Clyybber> leorize: Ok, but whats the problem? They can still import re because the global .nim cfg has a fallback
22:03:40*haxscramper quit (Remote host closed the connection)
22:03:55FromDiscord<Clyybber> And once they create a package they can choose to rely on people having the same cfg as them (bad) or they can specify that they actually need re
22:04:49leorizeI'm just picking `re` as an arbirtary example
22:04:52FromDiscord<dom96> all packages need some metadata
22:05:09disruptekgit provides this.
22:05:24leorize@Clyybber if say, it's arraymancer, which have its own deps
22:05:45FromDiscord<dom96> depending on git is a bad idea
22:06:02leorizethen even in "no config" situation the compiler still has to resolve the deps
22:06:27FromDiscord<Clyybber> ah, so the issue is that when you experiment
22:06:33FromDiscord<Clyybber> without creating a package/config
22:06:36FromDiscord<Clyybber> and do import arraymancer
22:06:43FromDiscord<Clyybber> it won't work without the PM
22:06:50leorizeyep, it's a completely realistic use case
22:07:05leorizeyou can say "but dist will bundle it all"
22:07:14FromDiscord<dom96> no you can't
22:07:15disruptekwell, it's only true because of histerical reasons.
22:07:32FromDiscord<Clyybber> We can also teach people to use the PM
22:07:32leorizebut I say why would you need that when the compiler would be able to resolve all deps correctly?
22:08:19disrupteki don't even know what point you're trying to make.
22:08:31disruptekthe deps are already resolved for you in dist.
22:08:32FromDiscord<dom96> The compiler should simply enable a dependency tree to be specified
22:08:33disruptekthat's the idea.
22:08:47FromDiscord<dom96> and compile the code using that information
22:08:59FromDiscord<Clyybber> disruptek: Take dist out of the equation for a moment
22:09:04disruptekokay.
22:09:25disruptekall the compiler is trying to do is map strings to files.
22:10:18disruptekdom96: you're not wrong, but it's also not hard to produce a simpler interface.
22:10:23FromDiscord<Clyybber> leorize: So either we teach people to use nimble c for such cases
22:11:09FromDiscord<Clyybber> or we make nim c invoke PM code through some means (plugin?, just calling a configurable command)
22:11:14FromDiscord<Clyybber> or we merge the PM into nim
22:11:27FromDiscord<Clyybber> UX wise 2 and 3 are basically the same
22:11:59disruptekyou're missing the fact that we only need the pm when the env changes.
22:12:40FromDiscord<Clyybber> disruptek: Thats for the PM to figure out. It's not relevant here IMO
22:13:03FromDiscord<Clyybber> The PM can always simply do nothing if the env didn't change
22:14:26FromDiscord<Clyybber> With option 2 one could do "import somePkgTHatsNotInMyDeps"
22:14:29FromDiscord<Clyybber> run nim c
22:14:49FromDiscord<Clyybber> and nim c would invoke the PM which could then automatically add somePkgThatsNotInMyDeps to your .nimble
22:14:57FromDiscord<Clyybber> which would be nice for UX
22:14:57leorizea compiler plugin is not out of the question, I heard that IC is supposed to enable external plugins
22:16:11FromDiscord<dom96> at that point there'd be no need for the PM to add it to your .nimble file
22:16:20FromDiscord<Clyybber> why not?
22:16:38FromDiscord<dom96> because the compiler would know what package it needs apparently
22:16:52FromDiscord<Clyybber> No, the compiler does a prepass
22:16:53FromDiscord<dom96> the PM would just need to put it in a lock file
22:17:00FromDiscord<Clyybber> Then tells the PM what it needs
22:17:04FromDiscord<Clyybber> or what it can't find
22:17:10FromDiscord<Clyybber> then the PM adds that
22:17:18FromDiscord<Clyybber> and the compiler continues with the added paths
22:17:26FromDiscord<dom96> huh, that sounds more complex than it's worth
22:17:29*xet7 joined #nim
22:19:39FromDiscord<Clyybber> with a compiler plugin the prepass wouldn't be needed
22:19:56FromDiscord<Clyybber> it wouldn't be strictly needed without a compiler plugin either
22:20:17FromDiscord<Clyybber> but then you would end up invoking the PM executable potentially multiple times
22:21:32FromDiscord<tomck> Can i store arbitrary data in a `string`? Or does it need to be null terminated
22:22:19FromDiscord<ElegantBeef> Nim's strings do not require being null terminated
22:22:35FromDiscord<ElegantBeef> You can store all the characters of the rainbow in them
22:22:39*Vladar quit (Quit: Leaving)
22:23:02FromDiscord<Clyybber> disruptek: a global .cfg with a fallback to dist would solve this, but not magically add somePkgThatsNOtInMyDeps to your .nimble/deps obviously
22:23:30FromDiscord<mratsim> Be careful of what you wish, you will summon ponies
22:23:31FromDiscord<dom96> In any case, we've discussed this a lot already. Here is an issue about this topic https://github.com/nim-lang/nimble/issues/654
22:23:38disbotRemoving Nim's knowledge of Nimble ; snippet at 12https://play.nim-lang.org/#ix=2LHv
22:23:46FromDiscord<Clyybber> but if you just always invoke nimble c then this is solved too
22:24:06FromDiscord<ElegantBeef> @mratsim so it is true what they say, if you want to know if someone is a bronie just way and they'll tell you
22:24:14FromDiscord<Clyybber> because nimble can invoke the compiler, see if it errors with missing file, add it as a dep, and try again
22:25:26FromDiscord<Clyybber> @dom96 Yeah, but there were some new arguments today
22:26:33FromDiscord<dom96> What were the new arguments?
22:26:57disruptekjust leave it the way it is. i run the pm to manage my env. i run the compiler to compile my software.
22:26:57FromDiscord<Clyybber> that nimble and nim should be one because of UX
22:26:57disruptekif users cannot figure that out, they can go work with rust lifetimes.
22:27:04FromDiscord<Clyybber> lol
22:27:34*NimBot joined #nim
22:27:47FromDiscord<dom96> pretty sure that was suggested before
22:27:53FromDiscord<dom96> maybe not in that issue though
22:28:41FromDiscord<dom96> History shows that these kinds of features separate out of the compiler
22:28:48FromDiscord<dom96> nimpretty used to be in the compiler IIRC
22:29:36FromDiscord<Clyybber> In general having a way to get a dependency tree from the compiler is not a bad idea though
22:29:41FromDiscord<Clyybber> And probably already possible
22:30:45FromDiscord<Clyybber> It could at least allow nimble c to automatically add dependencies to .nimble
22:30:53FromDiscord<Clyybber> Which is a small UX improvement
22:30:57FromDiscord<dom96> meh
22:31:05FromDiscord<Clyybber> but its probably not worth it rn
22:31:14FromDiscord<dom96> What's important is for Nimble to be able to tell Nim a tree of paths
22:31:16FromDiscord<Clyybber> I'm torn, so I'm voting for doing nothing RN
22:31:51FromDiscord<dom96> so that a single "compilation unit" can depend on multiple versions of the same package
22:32:23FromDiscord<Clyybber> Yeah. That isn't possible RN
22:32:26*D_ quit (Ping timeout: 264 seconds)
22:33:07FromDiscord<Clyybber> right?
22:40:30leorize[m]dom96 go is the only language that perform this bundling afaik
22:40:51FromDiscord<Clyybber> yeah, I don't know any other either
22:41:47leorize[m]it worked pretty well for them, and any kinks left appear to be because of backward compat
22:42:17leorize[m]you do `go build` and it just works
22:44:47*u0_a216 joined #nim
22:49:21leorizeyou never once need to learn `goc` or whatever, there is only one `go` and it does everything correctly
22:49:47leorizeI think in the UX aspect of PM go nailed it
22:55:33FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2LHB
22:56:01*u0_a216 quit (Ping timeout: 264 seconds)
22:57:34FromDiscord<tomck> The idea is that I could use packetTags in a macro to generate a bit switch statement that'll automatically parse packets, instead of having to make sure that the right tag number is switched to the right type in multiple places, which can lead to subtle bugs
23:00:20FromDiscord<ElegantBeef> Is this for something like an RPC?
23:01:19FromDiscord<tomck> nah this is for gamedev atm, different packets for sharing different kinds of state
23:01:35FromDiscord<ElegantBeef> Well i mean i made this for gamedev https://github.com/beef331/nettyrpc
23:01:45FromDiscord<ElegantBeef> P2P automated packet creation
23:02:56FromDiscord<ElegantBeef> It's semi similar just without manual creation of packets, and uses procedures for generating the serialization logic
23:04:21*tane quit (Quit: Leaving)
23:04:24FromDiscord<tomck> I see, this is some super wizard shit lol, is {.networked.} your own pragma?
23:04:29FromDiscord<ElegantBeef> Yea
23:04:39FromDiscord<tomck> I'll take a look at this after i've slept, too much for night time lol
23:04:48FromDiscord<tomck> thanks though, might end up using this as is
23:05:03*leorize quit (Ping timeout: 240 seconds)
23:05:06FromDiscord<ElegantBeef> What it does is add a packet emitter, and a procedure that gets called from the network client
23:05:48FromDiscord<ElegantBeef> So if you're the local client inside the proc call it sends the information that this procedure got, which then you receive and deserialize invoking it the procedure as non local
23:06:05FromDiscord<dom96> leorize: that is not the impression I got with Go's package management
23:06:26FromDiscord<dom96> There are a lot of criticism about it and many different actual package managers out there for it with differing implementations
23:07:49*xet7 quit (Remote host closed the connection)
23:08:52giacowhat could it mean if a program runs correctly with --gc:arc, but goes "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" if compiled with default gc?
23:08:58leorize[m]do you mind sourcing some of the criticisms?
23:09:23*xet7 joined #nim
23:10:25*xace quit (Ping timeout: 264 seconds)
23:11:14FromDiscord<dom96> Maybe I'm not up to date on the latest developments, it seems there were some changes relatively recently
23:11:49FromDiscord<dom96> but when the new vgo stuff was released a lot of people seemed pissed
23:12:01*leorize joined #nim
23:13:15leorize[m]it was a breaking change, someone will be pissed
23:13:32leorize[m]the ecosystem stabilized afaik
23:14:05FromDiscord<ElegantBeef> @tomck sorta want to rewrite that so i'll send you a new impl if i get it done
23:14:06FromDiscord<dom96> Does that mean `dep` is a thing of the past?
23:14:12leorizegiaco: can you describe the code you're dealing with? are you doing FFI or anything?
23:14:18FromDiscord<lytedev> is there a reasonable way to go from string to byte seq/array and back?
23:15:14mipristring <> seq[byte] isn't a good idea because strings have, for a less expensive FFI, a guaranteed trailing NUL byte
23:15:30leorize@dom96 yea `mod` is now the thing
23:15:42mipriyou can get openArray[byte] from a string with .toOpenArray(), or by passing it to such a parameter, but to go the other way you need to copy
23:15:51*xace joined #nim
23:15:58FromDiscord<lytedev> then why in the world does the base64 module primarily handle strings?
23:16:36FromDiscord<lytedev> encode should return a string and decode should take a string, but that should be it...
23:16:43FromDiscord<ElegantBeef> !eval echo cast[seq[byte]]("hello")
23:16:43leorize@lytedev because someone didn't thought of `openArray[byte]` and/or `openArray[char]` at the time
23:16:45NimBot@[104, 101, 108, 108, 111]
23:16:57FromDiscord<lytedev> ahhh ok
23:17:02giaco leorize yeah, I'm testing gstreamer bindings for nim
23:17:05leorize@lytedev you should open a bug for it
23:17:07FromDiscord<ElegantBeef> Where is the issue with the nul termination?
23:17:09FromDiscord<lytedev> wellp. that should do it. lol thanks
23:17:12*a_b_m joined #nim
23:17:19mipriyou can get openArray[byte] from a string with .toOpenArray(), or by passing it to such a parameter, but to go the other way you need to copy
23:17:24FromDiscord<lytedev> @leorize best place to do that is the GitHub repo?
23:17:33leorizeElegantBeef: it's an issue when the string makes its way to FFI
23:17:38mipristring <> seq[byte] isn't a good idea because strings have, for a less expensive FFI, a guaranteed trailing NUL byte
23:17:53leorize@lytedev yep
23:17:58FromDiscord<lytedev> will do - thanks
23:18:01FromDiscord<ElegantBeef> Well i was just asking where it pops up 😄
23:18:09mipristring -> cstring conversion
23:18:17FromDiscord<dom96> leorize: I wouldn't be surprised though if `go build` is just a thin wrapper around various separate tools which include a binary that deals with package management
23:18:25mipriif strings have a guaranteed trailing NUL byte, then string -> cstring doesn't incur a copy
23:18:36mipriand they do, so it doesn't. But you have to pay for that in other conversions.
23:19:19leorizedom96: in go case it's actually built-in, but that's semantics
23:19:25*abm quit (Ping timeout: 240 seconds)
23:19:46leorizewhat matters is that there's only one command to do everything
23:20:04leorizethere's no `goc` that have seperated flags that you need to learn
23:20:16leorizethere's only one `go`
23:20:27leorizeprototype? `go build`
23:20:36leorizea package? `go build`
23:20:51FromDiscord<lytedev> https://github.com/nim-lang/Nim/issues/16688 -- issue for base64 and openArray[byte] dealings
23:20:52disbotThe base64 module should deal in openArray[byte] instead of strings
23:20:57leorizecompilation to some embedded setup? `go build`
23:20:58FromDiscord<lytedev> thanks for coming to my ted talk
23:22:20*oddp joined #nim
23:23:05leorizedom96: I want to see a future where the `nim` binary could do this too
23:23:10*PMunch joined #nim
23:23:11leorizewhere `nim c` is all you ever need
23:25:33leorizeit makes bootstrapping much easier too tbh
23:25:40leorizeyou just need `go` to bootstrap
23:26:07leorizecompared to `rust` scheme of cargo + rustc needed to even compile rustc
23:30:09*a_b_m quit (Quit: Leaving)
23:42:20*abm joined #nim
23:44:46*filcuc_ quit (Ping timeout: 246 seconds)
23:47:37*jkiesian quit (Ping timeout: 264 seconds)