<< 07-01-2021 >>

00:01:00FromGitter<alehander92> disruptek i just dont come in often now
00:03:23*Guest25945 quit (Ping timeout: 272 seconds)
00:06:01leorize[m]@mratsim are file system races identified as potential security issues for nimbus during the security audit?
00:14:05*Tanger joined #nim
00:35:07*oprypin quit (Quit: Bye)
00:35:15*oprypin joined #nim
01:02:08*taprack quit (Remote host closed the connection)
01:02:20*krux02 quit (Remote host closed the connection)
01:02:58*hmmm quit (Quit: WeeChat 3.0)
01:09:10*Guest25945 joined #nim
01:34:05*lritter quit (Quit: Leaving)
01:41:58disruptekalehander92: is it the smell of failure that keeps you away?
02:18:37*abm quit (Read error: Connection reset by peer)
02:36:33*Tanger quit (Read error: Connection reset by peer)
02:39:48*Tanger joined #nim
02:44:09FromDiscord<shadow.> are there any packages for vector math?
02:44:23FromDiscord<shadow.> basically like yk a (T, T, T)
02:44:27FromDiscord<shadow.> with operator overloads and
02:44:38FromDiscord<shadow.> other operations like normalizing and stuff?
02:45:15FromDiscord<shadow.> ping me if answering bc im heading off for a bit
03:00:40*Guest25945 quit (Quit: Guest25945)
03:01:02*Guest25945 joined #nim
03:11:59*taprack joined #nim
03:21:43*adnan338 joined #nim
03:24:32ForumUpdaterBotNew thread by Oyster: Get temp directory on windows? , see https://forum.nim-lang.org/t/7346
03:27:07*muffindrake quit (Ping timeout: 260 seconds)
03:29:12*muffindrake joined #nim
03:29:24adnan338Hello, this is going to sound very beginner level question but here goes. Under the circumstances I am in, I am somewhat forced to use globally mutable variables. In order to make operations on the data atomic I am using a pattern like this: https://play.nim-lang.org/#ix=2L87 My question is that the Data itself is not atomic. Is it really going to be thread-safe?
03:30:07FromDiscord<ElegantBeef> You're locking the thread so it should be safe afaik
03:30:46adnan338Is it somehow possible to somehow prevent the usage of this `Data` outside a `withLock` block?
03:31:39adnan338So I don't mistakenly just use it without the lock
03:32:05FromDiscord<ElegantBeef> I'm uncertain
03:32:36disruptekwhy are you "forced to use globally mutable variables"?
03:32:43FromDiscord<Filipe Duarte> https://github.com/mratsim/Arraymancer
03:32:43disruptekthis seems to be exactly what you don't want.
03:33:06FromDiscord<Quibono> https://github.com/stavenko/nim-glm
03:33:07disruptekotherwise, you could use a macro to lock the data automatically.
03:33:58FromDiscord<Quibono> @shadow.
03:37:39adnan338disruptek: Well, I am using the Gtk library. In Gtk, to add an eventhandler I need to send an argument to a widget callback. Often times that argument has to be the UI type itself (to make changes to the UI). However when you want to manipulate some data along with the UI, you have to either embed the data into the UI type or use a globally available data type. Sending the UI type to the callbacks require the UI to be of var type in the parameter. The Gintr
03:37:41adnan338o API does not define the args to be of var type.
03:38:19disruptekfix the api?
03:39:20adnan338disruptek: Even so, doesn't embedding data into UI sound like a bad practice? (I know global mutables are also bad)
03:40:23adnan338For example, https://gitlab.com/9898287/invoicer/-/blob/master/src/frontend/ui.nim#L290
03:40:47adnan338here sending a var UI is not allowed. The other callbacks are like that too.
03:47:20*taprack quit (Ping timeout: 265 seconds)
03:52:23FromDiscord<shadow.> hmm yeah i thought of it i was just wondering if a tuple-based solution would be faster since it's on the stack right?
03:52:36FromDiscord<shadow.> but ig arraymancer is optimized to bits anyways lol
03:53:14disruptekadnan338: well, you could create a unique variable that wouldn't have a guessable name, so it'd be hard for someone else to modify it.
03:53:25disruptekbut i'd rather fix the api.
04:00:40*Guest25945 quit (Quit: Guest25945)
04:00:48FromDiscord<Filipe Duarte> Fast and easy to use
04:01:05disrupteklike my ex-gf.
04:01:26*Guest25945 joined #nim
04:08:07FromDiscord<shadow.> fair enough
04:08:23FromDiscord<ElegantBeef> Well you also have nim-glm
04:08:31FromDiscord<ElegantBeef> Which does stack allocated types
04:08:45FromDiscord<Quibono> Which I linked to. :p
04:08:48FromDiscord<ElegantBeef> Although for most of the things you'll do the heap isnt going to be that slow
04:08:58FromDiscord<ElegantBeef> Yep i was just pointing it out since they seemed to ignor you
04:09:04FromDiscord<shadow.> well im making a raytracer
04:09:06FromDiscord<Quibono> Haha thanks beef
04:09:09FromDiscord<Quibono> hug
04:09:23FromDiscord<ElegantBeef> Nah you seem to not talk a lot about Nim πŸ˜›
04:09:28FromDiscord<shadow.> lol who
04:09:38FromDiscord<ElegantBeef> Qui asking about other languages in #offtopic a fair bit πŸ˜„
04:09:40FromDiscord<shadow.> qui talks abt zig πŸ™„βœ‹
04:09:45FromDiscord<shadow.> EXACTLY
04:09:57FromDiscord<ElegantBeef> Did you ever get it on par with Nim/Rust?
04:09:58FromDiscord<Quibono> Lol guy asks about zig once and you just remember that.
04:10:10FromDiscord<shadow.> lmaoo
04:10:23FromDiscord<shadow.> uhh i think qui dropped it lol
04:10:35FromDiscord<shadow.> u never ran the example the guy sent u
04:10:47FromDiscord<Quibono> Yeah that’s true.
04:11:33saemYay, nimsuggest patch went in.
04:11:48FromDiscord<shadow.> so for like a raytracer w the typical things ill need (operators, scalars, normalizing) what do you think would be best?
04:11:51FromDiscord<ElegantBeef> Nice now you gotta work on the vscode extension? πŸ˜„
04:11:51saemNow to fix another thing and update the extension slightly.
04:12:04FromDiscord<shadow.> arraymancer or glm
04:12:35FromDiscord<ElegantBeef> Isnt arraymancer a GPU based abstraction, so would give you SPEEEED
04:12:41FromDiscord<shadow.> speeeed
04:12:50FromDiscord<shadow.> also has multicore iirc?
04:13:08FromDiscord<shadow.> but stack go brr and heap go "hm where is free"
04:13:10FromDiscord<Quibono> Just benchmark them
04:13:14FromDiscord<Quibono> :p
04:13:24FromDiscord<shadow.> at least according to zig bc of how overblown they make it :shade
04:13:27FromDiscord<shadow.> lolll
04:13:28FromDiscord<ElegantBeef> The data you have will mostly be sequential data, no?
04:13:36FromDiscord<shadow.> wdym?
04:13:50FromDiscord<ElegantBeef> Most of the data will be allocated in sequences and not be thrown around the heap
04:13:57FromDiscord<shadow.> ah true yeah
04:14:06FromDiscord<shadow.> arraymancer prolly makes more sense
04:14:17FromDiscord<shadow.> ill try benching basic operations w them
04:20:36ForumUpdaterBotNew thread by Foldl: Zig-style async/await, see https://forum.nim-lang.org/t/7347
04:21:28FromDiscord<shadow.> @Quibono ay you been waiting for this one?
04:21:46FromDiscord<Quibono> Lool
04:22:03FromDiscord<Quibono> if Nim and zig would have a baby that’s fine by me
04:22:23FromDiscord<Quibono> I’d happily scavenge each of them for their good points.
04:27:56FromDiscord<Rika> oh my god i thought someone implemented it its just someone asking if it exists
04:28:15FromDiscord<Quibono> Lol Rika got excited for a hot minute
04:28:38*spiderstew_ joined #nim
04:29:54FromDiscord<shadow.> yk i can think of some very bad names for nim and zig's baby πŸ’€
04:30:05FromDiscord<shadow.> lets just go with zim.
04:31:17*spiderstew quit (Ping timeout: 272 seconds)
04:31:17FromDiscord<Rika> its not hard to think of bad names for nim and zig's baby
04:31:25FromDiscord<Rika> also zim is already a common name
04:32:11FromDiscord<Quibono> Mizig
04:32:19FromDiscord<Rika> nizim
04:32:30FromDiscord<Rika> ziming
04:32:32FromDiscord<ElegantBeef> Mig
04:32:40FromDiscord<Rika> oh shit a jet plane
04:32:42FromDiscord<Quibono> Lol mig would rock
04:32:49FromDiscord<Quibono> Lol literally logo already figured
04:35:22FromDiscord<ElegantBeef> Now what does Zig do better than Nim?
04:35:44FromDiscord<ElegantBeef> We've got metaprogramming, easier to add it than merge the two πŸ˜„
04:36:38FromDiscord<Quibono> Easy manual memory management would be cool.
04:36:42FromDiscord<Rika> zig and nim have completely inverse goals
04:36:48FromDiscord<Quibono> That too.
04:36:51FromDiscord<Quibono> Lol
04:37:28FromDiscord<Quibono> What specifically do you see as the goals of the two rika?
04:37:34leorizemanual memory management in nim is super easy nowadays :P
04:38:08leorizezig proclaims itself as "not magic" in anything, so no operator overloads, no macros, etc.
04:38:27leorizebasically zig is like an antithesis for nim :P
04:38:46FromDiscord<shadow.> yeahh
04:38:48disruptekit's a great c.
04:39:24FromDiscord<shadow.> zig is pretty bare bones which is good for some things
04:39:45FromDiscord<shadow.> but nim certainly has a better writing speed at least for me
04:39:46leorizeto this day I'm still not sure what that is :P
04:39:57leorizewell maybe static analysis since you don't have to parse magic
04:40:27FromDiscord<shadow.> zig stl is sadly undocumented which is a big issue to achieve popularity im guessing
04:40:28FromDiscord<ElegantBeef> Hence why i'm asking what Zigs does better than Nim πŸ˜„
04:40:47FromDiscord<ElegantBeef> There has to be a reason to want a merge of the two
04:40:50FromDiscord<Rika> zig does the C look better than nim xdddd
04:40:57disrupteki like how seamless compile-time is.
04:40:58FromDiscord<ElegantBeef> Yea i cannot think of anything actual
04:41:10FromDiscord<Rika> wdym disruptek
04:42:05FromDiscord<Quibono> Beef defer and errdefer are nice.
04:42:20FromDiscord<shadow.> nim has defer just not errdefer
04:42:23FromDiscord<shadow.> iirc
04:42:34FromDiscord<ElegantBeef> We've got defer
04:42:37FromDiscord<Rika> nim defer isnt the exact same i believe
04:42:46FromDiscord<ElegantBeef> `// defer will execute an expression at the end of the current scope.`
04:42:46FromDiscord<shadow.> ig nim doesnt need it as much bc we dont needa manually free shit πŸ’€
04:42:52FromDiscord<Quibono> Also like just general Zig does errors really nicely.
04:42:57FromDiscord<Quibono> Lol that’s fair shadow.
04:43:16FromDiscord<Rika> especially when arc becomes widely used loooo
04:43:39FromDiscord<shadow.> yeah i like how zig returns errors up the stack like rust results, those are cool but like 99.99% of the time im just gonna return it all the way up so i might as well panic / raise
04:43:45FromDiscord<Quibono> Legit question, why isn’t arc the default?
04:43:59FromDiscord<ElegantBeef> Cyclical
04:44:02FromDiscord<Rika> not as stable yet as refc im guessing
04:44:07mipriit's new, it changes semantics, not everything's compatible with it.
04:44:16FromDiscord<Rika> beef that just changes the question to why is orc not default
04:44:26FromDiscord<ElegantBeef> It will be
04:44:31mipriand the default doesn't matter that much. saying --gc:orc draws attention to the new stuff, as well.
04:44:33FromDiscord<Rika> yet i mean
04:44:36disruptekorc will be the default.
04:44:49disruptektoo easy for people to complain about leaks when they use arc.
04:45:07FromDiscord<Quibono> Zig like let’s you do a catch statement for errors and if you do that it gives a compile error if you don’t include every possible error type lol, which is cool, but idk if that’s feasible in Nim.
04:45:21leorize`{.raises: [].}`
04:45:46FromDiscord<Rika> its possible but he asks if its feasible
04:45:51FromDiscord<Rika> if its sensible
04:46:04leorizeyes, status does it for their nimbus project
04:46:26FromDiscord<Quibono> Like is the Nim compiler aware of the types of errors a specific function could throw?
04:46:34leorizeyes
04:46:37FromDiscord<shadow.> yes
04:46:42FromDiscord<ElegantBeef> sey
04:46:44FromDiscord<shadow.> static typing go brr
04:46:51leorizeyou can even see them in the documentation
04:46:58FromDiscord<shadow.> yep
04:47:02FromDiscord<Quibono> Then +1 for that being a thing automatically lol
04:47:07FromDiscord<shadow.> loll
04:47:14FromDiscord<Quibono> Because when I heard about it in zig I was impressed.
04:47:50FromDiscord<shadow.> i mean it shouldnt be too impressive right? it can clearly see any raise statements and/or branch other functions to check their raise statements recursively
04:48:15FromDiscord<shadow.> obvi easier said than done but i wouldnt call it revolutionary for zig
04:54:53FromDiscord<shadow.> idk if theres any language i would say comes close to having features i miss in nim id say rust lol
04:54:57FromDiscord<shadow.> ownership is cool
04:55:30FromDiscord<shadow.> the implicit copying in nim kinda flies past me sometimes when its prolly more efficient to not copy
04:55:30disrupteki don't program so i can solve ownership puzzles.
04:55:39FromDiscord<shadow.> fair
04:56:10FromDiscord<shadow.> if nim somehow had like ownership as a no-gc mode my life would be complete
04:56:28leorizeviews are an experimental feature atm
04:56:33FromDiscord<shadow.> like nim c file -d:owner
04:56:41FromDiscord<shadow.> oh yeah i saw those
04:56:48FromDiscord<shadow.> --gc:owner
04:56:55leorizenot that it's working very well since 4raq said the analysis is flawed
04:57:28leorizewhy should --gc:owner even be a thing :P
04:57:57FromDiscord<shadow.> hmm
04:58:15leorizeviews is the feature that rust do well and nim doesn't
04:58:23FromDiscord<shadow.> well for one it'd eliminate the need for a gc while maintaining easy development (once u get the hang of it)
04:58:29FromDiscord<shadow.> yeah i agree
04:58:46FromDiscord<shadow.> i just find views make sense as a workflow in my mind but ofc everyones different
04:59:07leorizenot sure what rust's ownership system get you that arc doesn't
04:59:21FromDiscord<shadow.> removes implicit copies
04:59:38disruptekit's tighter more of the time.
04:59:38FromDiscord<shadow.> which is a curse and a blessing lol
04:59:40leorizethat's auto borrowing and is the problem views are supposed to tackle
04:59:59FromDiscord<shadow.> in nim if i pass a big object it's copied right?
05:00:02leorizerust's ownership system usually refers to it's implementation of heap-based memory management
05:00:05FromDiscord<ElegantBeef> Nope
05:00:08leorizeshadow. no
05:00:15FromDiscord<ElegantBeef> Nim sends by reference when it needs to
05:00:18FromDiscord<shadow.> oh hm
05:00:27FromDiscord<shadow.> lemme think of a better example lol
05:00:41FromDiscord<shadow.> i mean yeah im interested to see how views turn out
05:00:43leorizethere is a reason why you gotta perform shadowing yourself if you want to modify the proc params :P
05:00:51FromDiscord<shadow.> ye true
05:01:01*Guest25945 quit (Quit: Guest25945)
05:01:15FromDiscord<ElegantBeef> Also worth noting that Rust's allocator/deallocation is identical to Nim's ARC, so views + ARC gives you a more ergonomic ownership
05:01:38FromDiscord<ElegantBeef> Both are scoped based memory management with ownership
05:01:48FromDiscord<ElegantBeef> Just we dont have to be so frigging annoying with annotating the lifetime
05:02:10FromDiscord<shadow.> yeah i definitely dont prefer rust to nim in general, just for some things i find ownership makes it easy to write safe code, but with orc who knows lol
05:02:18leorizeafaict lifetimes is kinda like trying to reason the heap in terms of the stack :P
05:02:47FromDiscord<ElegantBeef> I just cant wait for views so we can stop doing copies for things like sequtils/strutils
05:02:53FromDiscord<shadow.> ah yeah
05:02:54FromDiscord<ElegantBeef> Also first class iterators would be nice
05:02:58FromDiscord<shadow.> yepp
05:03:05FromDiscord<shadow.> and more closure usage
05:03:17leorizewe do have first class iterators, just that they suck and disruptek's cps will fix that
05:03:29FromDiscord<shadow.> i should really look at zero_functional lol
05:05:11FromDiscord<ElegantBeef> Well we have the issue that things like `toSeq` have to be used like C
05:05:25FromDiscord<ElegantBeef> afaik first class iterators would resolve that issue
05:06:02leorizenim's closure iterators semantics are very weird :P
05:06:03disruptekwhat do you mean, "used like C"?
05:06:35FromDiscord<ElegantBeef> They break UFCS
05:06:47disruptekoh, who cares.
05:06:52FromDiscord<ElegantBeef> Me
05:07:02FromDiscord<ElegantBeef> I always forget what the U stands for
05:07:14FromDiscord<ElegantBeef> Occasional?
05:07:20disruptekthat must be it.
05:08:05disruptekzevv's cps tests are green as of today.
05:08:33FromDiscord<ElegantBeef> Nice
05:08:43leorizeit's more of an issue with iterators sharing the same namespace as procs
05:08:48disruptekmight have shims working tomorrow, i dunno.
05:09:06FromDiscord<ElegantBeef> Do you mean not sharing, leorize?
05:09:20FromDiscord<ElegantBeef> Atleast as i read up on it they didnt share name space
05:09:44leorizethey do share the namespace in a very weird manner, at least for the first class ones
05:10:20disruptekit might be a problem for cps, too.
05:11:01leorizecurrently I'm just concerned about the correctness of destructors
05:11:24disruptekas usual, the users are being asked to debug the software.
05:11:57leorizeyea, nim-sys will have to grow some correctness checking code for testing
05:12:52leorizehow terrible would it be to add a flag to an object that doesn't exist in the release version? :P
05:13:29disrupteki do it all the time.
05:13:53FromDiscord<ElegantBeef> Also what's considered a first class iterator?
05:13:55disruptekit's annoying when the damn .booldefine can't be used to `when` in type sections, though.
05:14:04disruptekbeef: something you can advance manually.
05:14:13FromDiscord<ElegantBeef> So closures?
05:14:29disruptekwe don't really want a limited set of semantics.
05:15:01disruptekif you look at cps, you can inject new data, yield values, perform arbitrary manipulation, stash the object, etc.
05:15:45disruptekcontinuations are what you want. cps just takes your "normal" control flow and rewrites it to give you that.
05:16:27disruptekmratsim has some syntax you can play with, but i wouldn't get too attached to the impl. πŸ™„
05:17:15FromDiscord<Anonymous Poet> does anyone know where the tests for the asynchttpserver are in the main repo?
05:17:23FromDiscord<Anonymous Poet> i wouldve expected tests/pure but theres no such folder
05:17:56leorizeit's in tests/stdlib/tasynchttpserver.nim
05:17:57FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/blob/662c5080755eb5a42df2c3acb84c044876571a46/tests/stdlib/tasynchttpserver.nim
05:19:20FromDiscord<Anonymous Poet> awesome, thanks
05:28:18*rockcavera quit (Remote host closed the connection)
05:33:40*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
05:35:41*pbb joined #nim
05:53:38saemWow, I can't brain concepts tonight.
05:57:08FromDiscord<ElegantBeef> What's the problem?
05:58:37saemIt seem so simple too, want to use a concept to make the Entry be an object type that has an `id: int` field.
05:58:41saemhttps://github.com/saem/vscode-nim/blob/main/src/nimvscode/flatdbtablenode.nim
05:58:58saemThat way I can get rid of a bunch of slowness.
06:01:18saemI instance one of those for these two types: https://github.com/saem/vscode-nim/blob/main/src/nimvscode/nimIndexer.nim#L28
06:01:18saemI get I'm tired right now... but I _thought_ I understood concepts better than this. :/
06:05:52FromDiscord<Anonymous Poet> anyone here familiar with the async dispatcher?
06:06:01FromDiscord<Anonymous Poet> i cant get the code from nim master to compile on mac os 😦
06:06:10*greenfork joined #nim
06:06:16FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2L8t
06:07:34FromDiscord<ElegantBeef> Saem does this help any? https://play.nim-lang.org/#ix=2L8u
06:07:52FromDiscord<Anonymous Poet> just copying the stdlib file into my folder and including it instead of the stdlib file results in this compile error: `Error: undeclared identifier: 'activeDescriptors'`, so i tried copying that function into the file, which results in `Error: undeclared field: 'selector' for type asyncdispatch.PDispatcher [declared in /usr/local/Cellar/nim/1.4.0/nim/lib/pure/asyncdispatch.nim(1127, 5)] `
06:09:06FromDiscord<Anonymous Poet> im going to try working off of my local nim lib file and see if that works in the meantime
06:09:17saemElegantBeef I did get that far, it was the constraining of generic type params where I'm hitting errors.
06:10:22FromDiscord<ElegantBeef> I havent used concepts much isnt it just `thingy[T: IdedObj]`?
06:10:25FromDiscord<Anonymous Poet> looks like the local one works ... not sure if maybe theres some interopt issues between my local 1.4 and master (seems to be 1.6) or maybe bad code got merged, but going to work off the 1.4 for now
06:14:12*habamax joined #nim
06:14:37FromDiscord<ElegantBeef> Saem where is your usecase?
06:16:21saemI tried to show my use case. πŸ˜“
06:16:49FromDiscord<ElegantBeef> Ah i've expanded my example to try to find what the hitch is, but i guess time to read your code πŸ˜„ https://play.nim-lang.org/#ix=2L8w
06:17:32FromDiscord<ElegantBeef> You do know concepts are compile time only, so you can only add one type to the seqs/tables
06:17:41saemOh yeah
06:17:47saemI instantiate two _separate_ ones
06:17:49saemOne for files
06:17:52saemone for types
06:18:09saemNo mingling of the two.
06:20:10FromDiscord<ElegantBeef> Sorry, i cannot see/understand the issue
06:20:35saemLet me make a playground and send it over.
06:29:35saemIt doesn't work, but you can at least see my thinking: https://play.nim-lang.org/#ix=2L8y
06:36:58saemOMG... what was I even thinking/
06:37:10FromDiscord<ElegantBeef> idk
06:37:12saemI should stop.
06:41:05adnan338Is #nim-offtopic down?
06:43:50Zevvno
06:43:54Zevv"down" does not exist in irc
06:45:46disruptekrdr2 makes me homesick for the west.
06:49:26Zevvi finished a few weeks ago. that made me sad
06:49:47Zevvnow I just switch it on, sit on a peak, make a camp, and listen to the wildlife
06:50:10*waleee-cl quit (Quit: Connection closed for inactivity)
06:50:38disruptekit really feels like northern california or western colorado.
06:51:32ZevvI couldn't tell, but it is kind of amazing how they play tricks with scale. You go from the swaps to snowy mountain tops in 12 minutes, and nowhere along the ride the landscape looks wrong
06:51:42adnan338Zevv: oh, just wanted to chat about a random idea that crossed my mind about open source and code sharing but I am not able to connect to the server
06:51:47adnan338ah well
06:51:57Zevvadnan338: use another server
06:52:02disruptekwell, don't share it here.
06:52:09disruptekthis is the rdr2 channel.
06:52:15Zevvright so
06:52:21disruptekdid you play rdr1?
06:52:27Zevvyeah
06:52:31adnan338What is an rdr2?
06:52:43disruptekit's a video-game.
06:52:44Zevvso, wait, you get sponsor money and suddenly you have a PS4 - right?!
06:52:48FromDiscord<ElegantBeef> Read dead redemption the second
06:52:50Zevvthis was for /drugs/
06:53:07adnan338oh hahah
06:53:11disrupteki think i'm gonna have to grow my own here.
06:53:13FromDiscord<ElegantBeef> I mean he needed the ketamine and did under the table favours and got both
06:53:57disruptekrdr1 was ps3.
06:54:06Zevvyeah I know
06:54:24Zevvit's plugged in in my study, but don't tell the kids
06:54:43disruptekthis game looks good at 4k but the framerate is absolute dogshit on this panel.
06:56:43disruptekyeah, more california than colorado.
06:56:57disruptekman, i gotta get some fucking work.
07:00:35*letto_ quit (Quit: Konversation terminated!)
07:01:43*letto joined #nim
07:04:45disruptekthis is awesome.
07:05:09disruptekURLs on the forum require a trailing slash in order to render as links... the trailing slash is not part of the link.
07:05:44disrupteki swear this was intentional, just to fuck with us.
07:07:45PrestigeThat's awesome.
07:09:23disruptekZevv: my horse ran out of gas. what do you do to refuel it?
07:11:45*opal quit (Remote host closed the connection)
07:12:37Zevvwah, how can you not know: 2 ginseng, 2 carrots and 2 shrooms
07:12:57disrupteki'm not wasting shrooms on a fucking horse.
07:13:09Zevvthere you go
07:13:32disrupteki got it to go again with ctrl-alt-del.
07:13:43disruptekshoulda been the first thing i tried.
07:13:45saemThat'll learn it
07:15:09*opal joined #nim
07:18:08Zevvmy iterator has a one-off
07:18:23disrupteka what?
07:18:40Zevvoff-by-one
07:18:44Zevvhttps://en.wikipedia.org/wiki/Off-by-one_error
07:18:51Zevv"An off-by-one error or off-by-one bug (known by acronyms OBOE, OBO, OB1 and OBOB) is a logic error involving the discrete equivalent of a boundary condition"
07:19:01Zevv"It often occurs in computer programming when an iterative loop iterates one time too many or too few."
07:19:14disruptekyou keep that shit queued up for 'splaining what off-by-one errors are?
07:19:25ZevvI got more where that came from
07:19:36disrupteki pity your peers.
07:19:50Zevvwhat makes a peer
07:20:05Zevvshould I pity you?
07:20:08disruptekwhere there's smoke, there's fire.
07:20:29disruptekis it bad that i murder everyone i see?
07:20:33disrupteki feel like that's bad.
07:21:16Zevvlet's see how long you keep that up
07:23:45disrupteki lasso'd a bighorn sheep.
07:23:51disruptekthen i didn't know how to do.
07:26:51disruptekyou ever lasso a squirrel?
07:32:37disruptekwhat this game gets wrong is that it never rains.
07:32:45Zevvit's in a days work
07:33:30Zevvoh it rains, allright. pouring down.
07:33:51Zevvhttps://youtu.be/I0QnV1x2Lhk?t=200
07:36:51*muffindrake quit (Ping timeout: 272 seconds)
07:37:52disruptekno, i mean it never rains in landscape like this.
07:38:25*muffindrake joined #nim
07:50:23*Vladar joined #nim
07:50:43*narimiran joined #nim
07:57:28disruptekZevv: you call your iterator 7 times and you discard the first value; what do you expect it to output?
08:01:20ZevvDid I say off-by-ones also are highly correlated with typing before coffee?
08:01:46Zevvjoking aside, in 0.0.13, the semantics were different
08:02:05disruptekreally?
08:02:12Zevvthe first call "primed" the iterator, but not resume it before calling it the first time
08:02:34disruptekthat was a weird idea.
08:02:42Zevvwell, no, yes
08:02:48Zevvwho changed this code, let me blame
08:03:00Zevvoh it was me
08:03:53disruptekthe idea of embedding a trampoline anywhere in cps seems a little mad to me, now.
08:04:12Zevvha, i'm just making a mess, sorry mate
08:04:13disruptekbut i'm not 100% sure how we will do result. i think [] is a trampoline or something.
08:04:39disruptekno, i thought it made sense at some point.
08:04:52*clemens3 joined #nim
08:04:58Zevv't is all right
08:04:58disruptekbut it works the way you want now, right?
08:05:06Zevvyeah
08:05:14disrupteki think it's good.
08:06:21disruptekare any of these other files supposed to work?
08:06:36Zevvgoto works again
08:06:52Zevvgetting echo_server_client up would be nice
08:07:27disruptekhmm.
08:08:50disruptekit's so old.
08:09:30Zevvyeah but it was nice because real and standalone
08:12:28disruptekNim closure iterators are 1.715483009230006 times faster
08:13:02Zevvshaame
08:13:36disruptekseems odd.
08:15:09disruptekthe codegen looks really good.
08:21:19*Tanger quit (Quit: Leaving)
08:25:03*greenfork quit (Remote host closed the connection)
08:25:12disrupteklooks like 50% slower at best, i guess due to alloc. panics helps a lot.
08:25:49disrupteki guess because we have more gratuitous proc calls.
08:26:16disruptekmaybe rvo issue too.
08:26:18Zevvhm but closure iterators make one call per iteration as well
08:26:40Zevvcan you push
08:27:09disruptekpushed.
08:27:24disruptekadded a hash to make sure no one optimizes out.
08:30:03disrupteki thought this test used to show us only 10-15% off pace. πŸ€ͺ
08:31:05Zevvdid you look at the actual C codegen?
08:46:11Oddmongerare there limitation of regex when parsing a buffer with a CR in it ? https://play.nim-lang.org/#ix=2L8O
08:46:21Oddmongerthe above was working with only one line
08:47:09FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2L8P
08:47:57FromDiscord<haxscramper> Not responding on forum because message parser can't handle backquotes on message, or something like that
08:49:01FromDiscord<haxscramper> for hcparse I decided to take somewhat hybrid approach to inheriting from C++ classes - https://gist.github.com/haxscramper/558f470dff55dbb3b09fce7cf92e2e74
08:49:27*PMunch joined #nim
08:49:48FromDiscord<haxscramper> But first solution incurs overhead in form of calling closure and generally directed towards qt/
08:50:10FromDiscord<haxscramper> qt-like libraries that require you to inherit from object just to override behavior
08:50:45*habamax quit (Ping timeout: 240 seconds)
08:51:43FromDiscord<haxscramper> Though I'm still not sure how I would handle generated C++ code from compilation. I thought about using nimcache, but could't find a way to get nimcache directory at compile-time
08:52:16FromDiscord<haxscramper> Though I haven't searched manual top to bottom, maybe this is something obvious and easy to do and I just missed
08:52:54FromDiscord<haxscramper> That is for the second idea/example I pasted above
08:56:28Araqnimcache is available at compile-time
08:58:43FromDiscord<haxscramper> Can you give and example on how one can access it?
08:59:00FromDiscord<haxscramper> (edit) "and" => "an"
09:04:45FromDiscord<mratsim> sent a long message, see https://paste.rs/5JK
09:05:12*NimBot joined #nim
09:05:45FromDiscord<mratsim> If we write to the disk it's through a DB. Otherwise it's config files at startup.
09:05:54FromDiscord<mratsim> @leorize ^
09:06:25Araqimport compilesettings
09:06:31FromDiscord<haxscramper> For standalone class generation I thought using something like this - https://gist.github.com/haxscramper/558f470dff55dbb3b09fce7cf92e2e74#standalone-classes , of course writing `{.emit.}` manuall is not a n option
09:06:39Araqecho querySetting(nimcacheDir)
09:07:22FromDiscord<mratsim> yes that was what I was thinking
09:07:35FromDiscord<mratsim> I don't need methods or virtual function thankfully
09:07:54FromDiscord<haxscramper> good for you
09:08:16FromDiscord<haxscramper> I wanted to leverage all information that I gathered when wrapping C++ code and make it accessible to nim compile-time
09:08:34FromDiscord<haxscramper> To provide additional functionality/wrapper correctness checking, like override etc.
09:08:59FromDiscord<haxscramper> Or `{.requiresinit.}` annotations for non default-constructible classes
09:09:42FromDiscord<haxscramper> But in the end this all will revolve around `cxxClass NewCxx of CppDerived:`, just additional information
09:10:46FromDiscord<haxscramper> Now that I know how to get nimcache directory it is only a matter of writing some files at compile-time & generating wrappers for them
09:15:39FromDiscord<haxscramper> I just realized nim type inherited from C++ class automatically can use all it's methods without requiring to wrap them again, meaning it is not strictly necessary to have any additional semantic information about base classes
09:18:45*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:23:05*Tanger joined #nim
09:23:05ForumUpdaterBotNew thread by Jseb: Regex on "multilines" buffer, see https://forum.nim-lang.org/t/7348
09:24:52*PMunch quit (Ping timeout: 246 seconds)
09:25:17*PMunch joined #nim
09:42:27FromDiscord<Enimatek> what is the difference between `proc foo[T](bar: var T)` and `proc foo[T](bar: T)` ?
09:43:09FromDiscord<Enimatek> in both cases i seem to have access to al data in T
09:43:20Zevvyes but only in the latter you can modify T
09:43:21FromDiscord<ElegantBeef> `var` is mutable
09:43:28FromDiscord<Enimatek> ah ok
09:43:30Zevvunless T is a ref type, then they behave the same
09:43:39PMunchNot quite
09:43:52PMunchWhen a ref type is a var you're able to update the original reference
09:44:00FromDiscord<mratsim> unless you use strictFunc :p
09:44:00FromDiscord<ElegantBeef> Zevv you said latter you meant former
09:44:21Zevv"almost the same"
09:44:31FromDiscord<mratsim> the devil is in the details
09:44:33Zevv"for most practical reasons"
09:44:44Zevv"and regular, non-pedantic folks"
09:44:47Zevvpfff, these people here
09:44:58FromDiscord<mratsim> regular Nim folks are pedantic πŸ˜‰
09:44:59FromDiscord<ElegantBeef> Eh i'm just correcting your sentence which was misleading πŸ˜›
09:45:04PMunch@mratsim, for strictFunc to matter they need to be funcs and not procs ;)
09:45:20FromDiscord<mratsim> I prefer funk
09:45:21PMunchI think
09:45:57FromDiscord<Enimatek> in both cases if i do `proc foo[T](bar: T): T = result = bar` it returns the same object i passed into it right?
09:46:15FromDiscord<mratsim> depends if T has ref semantics or value semantics
09:46:18PMunchIf T is a ref object, yes
09:46:24PMunchOtherwise it will return a copy
09:46:25FromDiscord<Enimatek> yes ref object
09:46:26FromDiscord<mratsim> if T has value semantics it will be copied
09:47:33FromDiscord<Enimatek> but if i do for instance `result = to(json, T)` the to (of json) will create a new object based on ref object T ?
09:48:54Zevvhttps://play.nim-lang.org/#ix=2L95
09:50:08FromDiscord<Enimatek> ok thnx, that is a nice way to check all the outcomes πŸ™‚
09:52:29FromDiscord<Enimatek> (edit) but if i do for instance `result = to(json, T)` the to (of json) will create a new object based on ref object T ? [note: yes this returns a new object] πŸ™‚
09:54:10*greenfork joined #nim
09:55:54FromDiscord<bark> how mature are concepts in nim right now?
09:56:49*hmmm joined #nim
09:57:52*xet7 joined #nim
10:00:21FromDiscord<ElegantBeef> They're usable and accessible without the experimental flag, but will be going through a change soon TM
10:01:55FromDiscord<mratsim> change?
10:02:04FromDiscord<mratsim> concepts work fine
10:02:25FromDiscord<mratsim> main issue is that they aren't cached like generics so might lead to increased compilation time
10:02:36FromDiscord<mratsim> still way better than C++ templates though.
10:02:40greenforkis there a way for c2nim to ignore any errors it sees and maybe just report them or copy them as a comment? it's annoying I have to comment every line where it fails
10:04:54FromDiscord<ElegantBeef> Afaik mratsim there are multiple RFC's which want to address concepts and change them a bit, all which seem desirable based of the reactions πŸ˜„
10:06:09FromDiscord<mratsim> The concept as is work fine for me, I just want VTable
10:06:21FromDiscord<bark> VTable?
10:06:51FromDiscord<mratsim> storing instances of the same concept in the same collection like a seq
10:07:16FromDiscord<bark> but wouldn't that mean size clashes?
10:07:30FromDiscord<bark> wouldn't that kill lookup time in seq's
10:08:33FromDiscord<bark> unless they were ref πŸ€”
10:10:58FromDiscord<mratsim> heterogeneous seq imply boxing/ref-ing yes
10:11:40FromDiscord<ElegantBeef> Yea a vtable would be niice
10:12:56FromDiscord<mratsim> it's all planned out, look in the raw manual and search for VTable (it's commented out): https://raw.githubusercontent.com/nim-lang/Nim/devel/doc/manual_experimental.rst
10:14:51FromDiscord<flywind> now we have https://github.com/yglukhov/iface
10:15:14FromDiscord<ElegantBeef> Oh never seen iface before
10:15:27FromDiscord<ElegantBeef> I had seen interfaced before
10:17:35FromDiscord<flywind> yeah, it is very new
10:17:55FromDiscord<ElegantBeef> Ah didnt notice
10:21:04*abm joined #nim
10:55:17ForumUpdaterBotNew thread by Alexeypetrushin: Why JSON % proc doesn't work for Enum?, see https://forum.nim-lang.org/t/7349
11:06:33*Tanger quit (Remote host closed the connection)
11:07:01*Tanger joined #nim
11:17:31*Tlangir joined #nim
11:20:20*Tanger quit (Ping timeout: 256 seconds)
11:33:43*leorize quit (Ping timeout: 240 seconds)
11:45:09PMunchWhere did libssl go in the Windows DLL collection?
11:45:38PMunchAnd can you download the DLL collection for older Nim versions?
12:07:26ForumUpdaterBotNew thread by HJarausch: Many Thanks !, see https://forum.nim-lang.org/t/7350
12:11:01*rockcavera joined #nim
12:15:49*xet7 quit (Quit: Leaving)
12:17:45*NimBot joined #nim
12:46:31FromDiscord<shadow.> does `float` default to `float64?`
12:46:33FromDiscord<shadow.> (edit) "`float64?`" => "`float64`?"
12:46:39FromDiscord<shadow.> only asking bc int is int64 for me
12:46:43FromDiscord<shadow.> wait i can just print sizeof
12:47:13FromDiscord<shadow.> yep float64
12:47:33narimiranyes, see: https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L30
12:49:24FromDiscord<shadow.> ah yeah
12:50:04PMunchint is defined to be the same size as a pointer on your device
12:50:12PMunchSo it'll be int32 on a 32 bit machine
12:50:36FromDiscord<shadow.> ahh that makes sense
12:50:51FromDiscord<shadow.> is there a zeros function in arraymancer?
12:51:01FromDiscord<shadow.> trying to avoid `0.repeat(n).toTensor()`
12:51:06PMunchreset?
12:51:28FromDiscord<shadow.> ohh wait
12:51:31FromDiscord<shadow.> does a tensor default to 0's
12:51:32FromDiscord<shadow.> im dumb
12:51:34FromDiscord<shadow.> lmao
12:51:44PMunchEverything in Nim defaults to 0's
12:52:06FromDiscord<shadow.> yeah i had forgotten abt how nice that was
12:52:33FromDiscord<shadow.> i am now realizing how much more i enjoy nim after coming back from a rust attempt
12:52:34FromDiscord<shadow.> lmao
12:53:05PMunchHaha, yeah you really start missing things when you realise they are gone
12:53:38FromDiscord<shadow.> like i started to go "hmm i kinda like ownership" and then i tried orc again and i was like "oh."
12:54:21FromDiscord<shadow.> lol
12:56:19FromDiscord<shadow.> time to go look at that nim tricks thing bc i have a fat result field assignment block lol
12:56:43FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2L9Y
12:57:09FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2L9Z
13:01:02FromDiscord<Enimatek> yay my first package for nimble, yet another orm, but this one is mine πŸ˜‰ https://github.com/cybertim/torm
13:03:45FromDiscord<mratsim> it's called zeros.
13:04:35FromDiscord<shadow.> c++ has `INFINITY` which is `((float)(1e+300 1e+300))`. is there an equivalent value in nim?
13:04:39FromDiscord<shadow.> ah that would make sense lol
13:04:39FromDiscord<shadow.> thx
13:04:58FromDiscord<hugogranstrom> We have `Inf`
13:04:59FromDiscord<mratsim> use "inf"
13:05:14FromDiscord<mratsim> it's described in the module fenv of Nim stdlib
13:05:32FromDiscord<shadow.> kk ty
13:05:37FromDiscord<mratsim> if you do raytracing don't use Arraymancer btw
13:05:53FromDiscord<mratsim> it's way too heavy an abstraction, and the incorrect one.
13:06:41FromDiscord<mratsim> 3 float64s will use 24 bytes while a tensor is a bit less than 128 bytes on the stack + 24 bytes on the heap
13:07:14FromDiscord<mratsim> well raytracing or raster graphics
13:07:41FromDiscord<mratsim> you can however represent the final image as a tensor and do machine learning on it
13:08:08FromDiscord<hugogranstrom> Can confirm, did a benchmark with a `Vector = object x, y, z: float` vs a `Tensor[float]` and it was 10x faster πŸ˜›
13:08:59FromDiscord<shadow.> ah rip
13:09:04FromDiscord<shadow.> do you think nim-glm would make sense?
13:09:32FromDiscord<mratsim> sure
13:09:58FromDiscord<shadow.> kk
13:10:00FromDiscord<mratsim> I didn't use it though
13:10:04FromDiscord<shadow.> fair enough
13:10:07FromDiscord<mratsim> I just reimplement math myself: https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/primitives/vec3s.nim
13:10:16FromDiscord<shadow.> yeah fair enough
13:11:00FromDiscord<mratsim> ultimately if you want speed you need to reorg your data anyway, see @planetis post on ECS
13:11:14FromDiscord<mratsim> but get a PoC out and then worry about data movement.
13:11:19FromDiscord<mratsim> be prepared to break everything
13:11:53FromDiscord<mratsim> it's the struct of arrays vs arrays of struct
13:13:54FromDiscord<exelotl> cool, nice one!
13:15:02FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2La7
13:15:03FromDiscord<shadow.> sphere is just a value object so
13:15:07FromDiscord<shadow.> i dont think i can use nil
13:15:12FromDiscord<shadow.> could i use like an option or something?
13:18:18FromDiscord<exelotl> yeah Option[Sphere] is probably good
13:18:21FromDiscord<mratsim> https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/physics/hittables/hittables_lists.nim#L48-L55
13:18:51FromDiscord<mratsim> I suggest you don't use Option here because this is the most perf critical part of raytracing and they are slower than `var` ...
13:19:34FromDiscord<mratsim> bench: https://github.com/nim-lang/Nim/pull/14417
13:19:34disbotβž₯ The whole options module should be inline
13:19:50FromDiscord<mratsim> though that might have changed since https://github.com/nim-lang/Nim/pull/14442
13:19:51disbotβž₯ make get for options use lent T
13:20:11FromDiscord<shadow.> so then what should i use here?
13:20:20FromDiscord<shadow.> a pointer?
13:20:48FromDiscord<mratsim> also I really don't like that option tag is the first field in the C repr, it wastes good space, it should be the last for better alignment/cache use
13:20:56FromDiscord<mratsim> you can use option for starter
13:21:17FromDiscord<mratsim> otherwise like me, a var float64 and you return a bool to tell if you have a hit or not
13:21:23FromDiscord<shadow.> hmm
13:21:24FromDiscord<exelotl> soo ptr?
13:21:24FromDiscord<shadow.> i see
13:21:30FromDiscord<exelotl> oops I didn't mean to send that
13:21:32FromDiscord<shadow.> lmao
13:21:39FromDiscord<exelotl> yeah use a bool xD
13:21:41FromDiscord<shadow.> we were thinking it internally πŸ’€
13:22:22FromDiscord<mratsim> that said once options are fixed to not incur unnecessary perf penalties they would be better from an ergonomic and safety point of vie
13:22:34FromDiscord<mratsim> I don't like to introduce mutation if we can avoid it.
13:23:11*abm quit (Quit: Leaving)
13:25:05FromDiscord<mratsim> and here is another implementation: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L93-L102
13:25:45FromDiscord<shadow.> hmm
13:25:49FromDiscord<shadow.> so just use a var to keep track?
13:26:20FromDiscord<shadow.> or should i just do `for sphere in spheres:`
13:26:24FromDiscord<shadow.> and use the bool
13:26:25FromDiscord<shadow.> like you said
13:26:31FromDiscord<mratsim> as you wish
13:26:37FromDiscord<shadow.> kk
13:26:56FromDiscord<mratsim> make sure to use latest Nim as well because "for sphere in spheres" used to introduce unnecessary copies as well
13:27:02FromDiscord<mratsim> was also a bottleneck
13:27:29FromDiscord<mratsim> https://github.com/nim-lang/Nim/issues/14421
13:27:32disbotβž₯ `items` is 20%~30% slower than iteration via an index ; snippet at 12https://play.nim-lang.org/#ix=2J0N
13:27:57FromDiscord<shadow.> im on devel 1.5.1
13:28:07FromDiscord<shadow.> should i update to latest commit?
13:28:57FromDiscord<mratsim> it's fixed in 1.4
13:28:59FromDiscord<mratsim> so you're good
13:29:37*leorize joined #nim
13:29:57FromDiscord<mratsim> anyway, besides the occasional perf caveats, you're free to design your application however you want
13:30:44*hmmm quit (Quit: WeeChat 2.8)
13:31:52Araqreminds me ... I still need to benchmark --exceptions:goto vs Option[T]
13:35:07FromDiscord<mratsim> when?
13:38:28*leorize quit (Remote host closed the connection)
13:46:54*hmmm joined #nim
13:48:52*hmmm quit (Client Quit)
13:49:13*hmmm joined #nim
13:49:38ForumUpdaterBotNew thread by Stbalbach: EncodeRe() , see https://forum.nim-lang.org/t/7351
13:53:57*muffindrake quit (Quit: muffindrake)
13:55:55*rockcavera quit (Remote host closed the connection)
13:59:12FromDiscord<shadow.> eek
13:59:16FromDiscord<shadow.> this is gonna be annoying to translate
13:59:17FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Lag
14:00:49FromDiscord<mratsim> it's just `var image = newSeq[Vec3f](width height); let pixel = cast[ptr UncheckedArray[Vec3f](image[0].addr)`
14:00:56FromDiscord<shadow.> ohhh
14:01:05FromDiscord<shadow.> well pixel changes
14:02:15FromDiscord<shadow.> would this not work?
14:02:18FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Laj
14:02:22FromDiscord<shadow.> oh wait
14:02:23FromDiscord<shadow.> i see
14:02:28FromDiscord<shadow.> would it be image[0].addr maybe?
14:04:18FromDiscord<shadow.> wait nvm
14:04:27FromDiscord<shadow.> not sure i understand what the cpp is doing lol
14:06:03FromDiscord<mratsim> image.addr takes the address of the seq
14:06:04FromDiscord<shadow.> (edit) would it be image[0][0].addr maybe?
14:06:07FromDiscord<shadow.> yeah
14:06:11FromDiscord<mratsim> you want the address of the buffer
14:06:11FromDiscord<shadow.> image[0][0].addr would
14:06:14FromDiscord<shadow.> take a pointer to the first one
14:06:15FromDiscord<shadow.> right
14:06:15FromDiscord<mratsim> no
14:06:16FromDiscord<shadow.> (edit) "right" => "right?"
14:06:17FromDiscord<shadow.> ah
14:06:18FromDiscord<shadow.> lol
14:06:21FromDiscord<mratsim> only one [0]
14:06:27FromDiscord<shadow.> oh right it's 1d
14:06:30FromDiscord<shadow.> whoops
14:06:36FromDiscord<mratsim> [0][0] is looking into random memory
14:06:40FromDiscord<shadow.> yep
14:06:41FromDiscord<shadow.> lmao
14:06:51FromDiscord<shadow.> so why wouldnt image[0].addr work?
14:06:55FromDiscord<shadow.> why the `cast[ptr UncheckedArray[Vec3f](image[0].addr)`
14:07:05FromDiscord<shadow.> (edit) "UncheckedArray[Vec3f](image[0].addr)`" => "UncheckedArray[Vec3f]](image[0].addr)`"
14:07:25*adnan338 quit (Ping timeout: 240 seconds)
14:07:34FromDiscord<mratsim> well, first of all, I'm just naively translating the C code
14:07:51FromDiscord<mratsim> not sure why they want that image pointer
14:08:00FromDiscord<mratsim> or pixel pointer
14:08:07FromDiscord<mratsim> in nim you can just do image[i]
14:08:13FromDiscord<mratsim> no need for that pixel stuff
14:08:18FromDiscord<shadow.> yeah hm
14:08:34FromDiscord<mratsim> second, if you take a pointer, for indexing, a ptr UncheckedArray is what you want
14:08:36FromDiscord<shadow.> they're never even reassigning pixel?
14:08:39FromDiscord<shadow.> so wouldnt it only point
14:08:41FromDiscord<shadow.> to the first element?
14:08:51FromDiscord<shadow.> oh nvm
14:08:54FromDiscord<shadow.> ++pixel in the loop
14:08:58FromDiscord<shadow.> yeah im just gonna do indexing lmfao
14:09:28FromDiscord<shadow.> `M_PI 0.5 fov / 180.` is that just `radians(fov) / 2`?
14:09:59*vindaar[m] joined #nim
14:12:46FromDiscord<mratsim> looks like it
14:13:00FromDiscord<mratsim> I just create deg_to_rad and distinct types for those
14:13:18FromDiscord<mratsim> otherwise you can crash a space shuttle
14:13:30FromDiscord<shadow.> wdym
14:13:53FromDiscord<mratsim> https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/primitives/safe_math.nim#L21-L29
14:14:16FromDiscord<mratsim> iirc one of the space shuttle crash was because someone though kilometres were miles
14:14:24FromDiscord<mratsim> and that threw computation of
14:14:30FromDiscord<mratsim> off
14:14:34FromDiscord<shadow.> jeez
14:14:35FromDiscord<shadow.> lmao
14:14:56FromDiscord<mratsim> https://www.simscale.com/blog/2017/12/nasa-mars-climate-orbiter-metric/
14:15:06FromDiscord<shadow.> yikes
14:15:07FromDiscord<shadow.> `image[y width + x]`
14:15:10FromDiscord<shadow.> i think this should work
14:15:12FromDiscord<shadow.> instead of pixel
14:16:06PMunchThat was an embarrassing mistake..
14:16:12FromDiscord<mratsim> That article is missing one bit of trivia. It's that Europe sent a referenc emeter to the US, and this was taken over by pirates
14:16:12FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Laq
14:16:21FromDiscord<shadow.> yike
14:16:48FromDiscord<mratsim> hence the US never received a reference to establish what a meter is
14:16:55FromDiscord<mratsim> before it was too late
14:17:03FromDiscord<shadow.> shouldnt nasa be expected to at least know how long a meter is πŸ’€
14:17:14PMunchmratsim, huh TIL
14:17:18PMunchDo you have a source for that?
14:17:28PMunch@shadow. they have switched to use metric only now
14:17:41FromDiscord<shadow.> good lol
14:17:58PMunchIt's funny how a lot of the US stuff is just really old European customs
14:18:12FromDiscord<mratsim> https://www.nist.gov/blogs/taking-measure/pirates-caribbean-metric-edition
14:18:12PMunchLike switching your fork back and forth while you eat
14:18:32FromDiscord<shadow.> hm
14:18:35FromDiscord<shadow.> i might just use ppm for now i guess
14:20:54FromDiscord<shadow.> are there docs for nimpng?
14:20:56FromDiscord<mratsim> beware, somehow my images were upside down: https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/io/ppm.nim#L29-L49
14:21:05FromDiscord<shadow.> https://github.com/jangko/nimPNG/blob/master/apidoc.md
14:21:06FromDiscord<shadow.> spicy
14:21:14FromDiscord<shadow.> found the seq[uint8] docs
14:21:19FromDiscord<shadow.> wait
14:21:21FromDiscord<shadow.> uint8
14:21:27FromDiscord<shadow.> isnt it uint32 for png pixels?
14:21:32FromDiscord<shadow.> rgba
14:21:36FromDiscord<shadow.> not png pixels lol
14:21:42FromDiscord<mratsim> uint8 because each r g b a is 8 bit
14:21:54FromDiscord<shadow.> ah yeah
14:22:00FromDiscord<shadow.> hm
14:22:21FromDiscord<shadow.> is there anywhere i can read just how to turn my sequence of rgb vectors into an image?
14:22:29FromDiscord<shadow.> shouldn't be too out of the ordinary right?
14:22:49FromDiscord<mratsim> it is an image
14:22:53FromDiscord<shadow.> wdym
14:23:04FromDiscord<shadow.> well yeah but
14:23:09FromDiscord<shadow.> how can i save it to a png in storage lol
14:23:12FromDiscord<shadow.> im use to ppm / bitmap bc
14:23:22FromDiscord<shadow.> i can write a ppm / bitmap writer myself in under 50 lines lol
14:23:28kinkinkijkinhey, so im trying to iterate through a global seq of objects and run methods within, and i have a spot where im running collider tests, but since the seq contains all extensible object types, it thinks i'm trying to run a collider method on generic extensibles, despite ample testing, and won't compile
14:23:36*Kurre[m] joined #nim
14:23:41FromDiscord<mratsim> use nimpng or stdimage
14:24:04kinkinkijkinhow is it that im "supposed" to do this?
14:24:23kinkinkijkini can't find anything saying this approach is wrong except the commpiler so there's gotta be something i wrote wrong
14:25:09FromDiscord<mratsim> for example this is how I use stb_image for png or jpeg: https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/io/io_image.nim#L59-L87
14:25:10FromDiscord<shadow.> yeah im using nimpng currently i just cant find docs
14:26:02FromDiscord<mratsim> write_png(filepath, width, height, num_colors, openarray[uint8])
14:26:08FromDiscord<mratsim> for stb_image
14:26:11FromDiscord<shadow.> ohh ok
14:26:13FromDiscord<shadow.> that's pretty simple
14:26:28FromDiscord<shadow.> lemme check
14:26:40FromDiscord<shadow.> https://nimble.directory/pkg/stbimage
14:26:41FromDiscord<shadow.> this one?
14:27:07FromDiscord<shadow.> and would numcolors just be `0xffffff`?
14:27:20*leorize joined #nim
14:27:22FromDiscord<mratsim> it would be 3
14:27:30FromDiscord<mratsim> you have RGB in your stuff
14:28:09FromDiscord<shadow.> ah
14:28:10FromDiscord<shadow.> 3
14:28:13FromDiscord<shadow.> lmao
14:28:15FromDiscord<shadow.> i thought it meant color range
14:28:47FromDiscord<shadow.> stbimage it is
14:29:36FromDiscord<exelotl> For nimpng you have to make an encoder object and call `encodePNG`
14:30:00FromDiscord<exelotl> Example: https://github.com/exelotl/trick/blob/master/src/trick/gfxconvert.nim#L224
14:30:09FromDiscord<shadow.> ah i see
14:30:13FromDiscord<shadow.> i only need lightweight stuff so
14:30:17FromDiscord<shadow.> stbimage makes more sense i think
14:30:32FromDiscord<exelotl> Yeah probs
14:30:46FromDiscord<shadow.> ima just do jpg
14:30:48FromDiscord<shadow.> i dont need alpha
14:37:56FromDiscord<shadow.> what are comp and quality in the params?
14:45:05*leorize quit (Remote host closed the connection)
14:45:54*leorize joined #nim
14:53:29FromDiscord<shadow.> nvm i think i got it
14:56:15FromDiscord<lqdev> theres savePNG24 and savePNG32 tho so making an encoder is overkill
14:56:37FromDiscord<exelotl> aha
14:57:09*abm joined #nim
15:04:34*waleee-cl joined #nim
15:04:56FromDiscord<shadow.> ah wait a minute
15:05:01FromDiscord<shadow.> my rgb is in float64 form lol
15:05:07FromDiscord<shadow.> im guessing stb wants it as 0-255?
15:05:14FromDiscord<shadow.> uint8?
15:05:39FromDiscord<shadow.> `(unsigned char)(std::min(float(1), image[i].x) 255)`
15:05:41FromDiscord<shadow.> im guessing that's that part
15:06:34*PMunch quit (Quit: leaving)
15:08:19FromDiscord<shadow.> https://media.discordapp.net/attachments/371759389889003532/796757107767640084/unknown.png
15:08:21FromDiscord<shadow.> ok so i dont think it worked.
15:08:29FromDiscord<shadow.> lmfaoo
15:08:33*BT40 joined #nim
15:10:04BT40Hi. just came to know about nim. Read that it compiles to c, c++ or javascript. I wanna know, can it compile independently/directly without these backends?
15:10:29FromDiscord<shadow.> you mean like straight from nim to machine code?
15:10:32FromDiscord<shadow.> not that i know of
15:10:46FromDiscord<shadow.> tho i find c compilation at least more of a blessing than a downfall
15:10:54FromDiscord<shadow.> you get the power of c plus ffi and other cool stuff
15:11:44qwrdefault is to compile via C, and the nim compiler invokes C compiler by itself, quite seemless if you're looking for the intermediate C code
15:11:44FromDiscord<shadow.> (edit) removed "at least"
15:12:16qwrs/if/unless/
15:13:16narimiranQuick reminder: if you haven't already, please fill our annual community survey: https://forms.gle/kEWvEeVyfxSHq9Uj8
15:15:46BT40thanks
15:15:47*BT40 quit (Remote host closed the connection)
15:22:57FromDiscord<shadow.> rip
15:22:59FromDiscord<shadow.> raytracer is dying
15:23:02FromDiscord<shadow.> must fix
15:23:21FromDiscord<shadow.> lol
15:23:45*hmmm quit (Quit: WeeChat 3.0)
15:24:20FromDiscord<mratsim> @BT40 you can use nlvm to compile directly to LLVM IR
15:24:38FromDiscord<shadow.> how complete is nlvm?
15:24:44FromDiscord<shadow.> and how efficient vs c backend?
15:26:35FromGitter<HJarausch_gitlab> A dump question. What to put into my local nim.cfg file to make all nimble-installed packages *importable*
15:27:03FromDiscord<lqdev> narimiran: when are the test results gonna be announced?
15:27:06FromDiscord<Rika> ? all nimble (locally) installed packages should be importable
15:28:09FromDiscord<mratsim> It works except for importc and emit.
15:28:15FromDiscord<flywind> what's the use of `std/private/since`? If I mark some procs in `std/math` as `since: (1, 5, 1)`, when I can use it in compiler?
15:28:17FromDiscord<shadow.> fair enogu h
15:28:19FromDiscord<shadow.> (edit) "enogu h" => "enough"
15:28:19FromGitter<HJarausch_gitlab> ``nim dump`` doesn't show these and I cannot import these. E.g., I had nimble install ``fusion@#master`` but
15:28:32FromDiscord<mratsim> not sure about the speed, we mostly benchmarked code size for codegolfing WASM compilation, not speed
15:28:38FromDiscord<shadow.> ohh fair enough
15:28:41FromGitter<HJarausch_gitlab> but ``import astdsl`` fails
15:29:05FromDiscord<flywind> !eval import fusion/astdsl
15:29:08NimBot<no output>
15:29:16FromDiscord<mratsim> I think it's fast, because we can model more closely nim semantics (let vs var for example)
15:29:46FromDiscord<shadow.> ah yeah fair
15:29:55narimiran@lqdev depends on when we decide "ok, that's enough votes"
15:30:19FromDiscord<flywind> you need to use `fusion` prefix
15:30:22FromDiscord<mratsim> After 3 years of usage, I'm not really worried about the raw speed of Nim with any backend.
15:30:28FromDiscord<lqdev> @flywind it's used for the --nimVersion flag
15:30:29FromDiscord<mratsim> 4 actually
15:30:39FromGitter<HJarausch_gitlab> @flywind Thanks!
15:30:45FromDiscord<flywind> np
15:32:03FromDiscord<flywind> I see, thanks
15:33:42narimirancurrently we have less votes than last year, so we're waiting a bit more
15:59:51*hnOsmium0001 joined #nim
16:00:28Araqlol I'm so stupid
16:00:43Araqguess what... if you load a .nim file as .rod file it cannot work.
16:00:52Araqone is a text file, the other an optimized binary format
16:00:57AraqXD
16:01:00FromDiscord<Rika> we all have our moments
16:01:42Araqand here I am ... hunting for mysterious "corruptions" that don't cause crashes
16:04:37*MyMind joined #nim
16:06:59*rockcavera joined #nim
16:07:56*Sembei quit (Ping timeout: 240 seconds)
16:10:58FromDiscord<mratsim> is .rod the mysterious Nim IR?
16:16:09FromDiscord<Randall> @mratsim "We split the Nim compiler into a frontend and a backend.↡The frontend produces a set of `.rod` files. Every `.nim` module↡produces its own `.rod` file."↡`compiler/ic/design.rst`
16:16:18FromDiscord<shadow.> what's the typical rand() function in random? like standard random flaot
16:16:19FromDiscord<shadow.> (edit) "flaot" => "float"
16:16:21*Tlangir quit (Remote host closed the connection)
16:16:31FromDiscord<mratsim> rand()
16:16:37FromDiscord<shadow.> with no arguments?
16:16:44FromDiscord<haxscramper> Why nightly builds are not available on playground?
16:16:46FromDiscord<mratsim> with a max value
16:16:57FromDiscord<mratsim> rand(1.0) if you want between 0 and 1
16:17:01FromDiscord<shadow.> kk thanks
16:17:16FromDiscord<mratsim> if the documentation is unclear, PR something better
16:17:39FromDiscord<shadow.> nah its good im just dum
16:19:02FromDiscord<mratsim> if at one point you do multithreading, don't use the default RNG, create one RNG per thread.
16:24:53*habamax joined #nim
16:27:13leorizehaxscramper: PMunch uses the nim docker images for the playground and nightlies don't build them
16:27:20Araqmratsim: pretty much, yes. I even dream about a backend that takes a set of .rod files and produces the C/LLVM code from it.
16:27:55FromDiscord<mratsim> you don't happen to use CPS as your IR btw? I heard that's the IR of functional languages πŸ˜‰
16:28:14Araqno, I use good old ASTs
16:28:23Araqread the book about CPS
16:28:29Araq*I read
16:28:39Araqyeah, the physical one, old school.
16:29:06disruptekwhat kinda dinosaur are you?
16:29:10FromDiscord<mratsim> the IR would be nice to produce cuda code
16:29:17disrupteki think i may be a stegasaurus.
16:29:35Araqit's great for async but already CSE is harder with CPS
16:30:06Araq(Common subexpression elimination. There is nothing "common" among expression, they all have different continuations)
16:30:39FromDiscord<mratsim> I've seen an article that did CSE that were "revealed" by CPS
16:30:45FromDiscord<mratsim> or maybe it was constant folding
16:32:00disruptekwe have a cps test that is like 20 lines of nim or less. and it generates like 15k lines of code.
16:33:19FromDiscord<mratsim> I have a concept that generate 200k lines of code in 10 lines
16:34:17FromDiscord<mratsim> https://github.com/nim-lang/Nim/issues/13982#issuecomment-614081693
16:34:19disbotβž₯ Concepts building on each other: duplicated procs in C codegen ; snippet at 12https://play.nim-lang.org/#ix=2y08
16:34:23disruptekah, it's only 9147 lines.
16:34:30FromDiscord<mratsim> I think this is the same rootcause
16:34:36FromDiscord<mratsim> concepts instantiation is not cached
16:34:48*lritter joined #nim
16:34:51FromDiscord<mratsim> so you have one proc per call site :/
16:34:58FromDiscord<lqdev> yeah that sucks
16:35:14FromDiscord<lqdev> i wish concepts had more care put into them
16:35:24*Vladar quit (Quit: Leaving)
16:35:29disruptekhave you tried the new impl?
16:35:35FromDiscord<lqdev> not yet
16:35:49FromDiscord<lqdev> is the new impl faster to compile?
16:36:00Araqshould be
16:36:10Araqbut the new impl comes with new syntax too
16:36:17disrupteki have no idea. i don't feel like rewriting all my concepts to use a new syntax, or omitting all code that may use the old syntax.
16:36:19Araqso you need to patch your code
16:36:19FromDiscord<lqdev> yeah that's one of my concerns
16:36:34FromDiscord<mratsim> the new impl of CPS or of concepts?
16:36:36FromDiscord<lqdev> the new syntax is a bit more limited and wouldn't work with fields
16:37:12FromDiscord<mratsim> it took me hours to get co-recursive concepts working across the generics typesystem :/
16:37:23FromDiscord<lqdev> right now if i declare a rule `x.width is Natural` it doesn't matter if width is a field or a proc, and i like that
16:37:33disruptekme too.
16:37:38FromDiscord<Rika> me three
16:37:43disrupteki'm all about natural width.
16:37:43FromDiscord<lqdev> it makes retro-fitting code much easier
16:37:43FromDiscord<mratsim> I have yet to fix the mess of Travis CI, I don't want to spend hours fixing concepts again
16:37:59FromDiscord<lqdev> well it should be positive width but you get the idea
16:38:17disrupteknimph-2.0 is blocked by concepts being so broken that they literally cannot be reasoned about.
16:38:54*Vladar joined #nim
16:39:06FromDiscord<lqdev> one other thing i wish was more stable is typed macros but opposed to concepts these are at least workable without that many major bugs. just small annoyances
16:39:13*hmmm joined #nim
16:39:24Araqaccepting fields would be rather easy to add for the new concepts
16:39:26disruptekit's hard to have a bug when you don't have a spec.
16:39:29greenforkhi, is it possible to have a sequence of static strings? this doesn't work: `const strs: seq[static string] = @["a", "b"]`
16:39:33FromDiscord<mratsim> "small annoyances", begone unbeliever
16:39:48FromDiscord<lqdev> greenfork: remove the static
16:39:49FromDiscord<mratsim> @greenfork use a static seq[string]
16:39:58FromDiscord<mratsim> const don't need static
16:40:03FromDiscord<lqdev> and then it's a static seq[string] implicitly because it's a const
16:40:09disruptekmratsim: have you done any testing of typed cps?
16:40:21FromDiscord<lqdev> wdym
16:40:24FromDiscord<mratsim> my fork is building on typed CPS
16:40:35greenforkmratsim, static seq[string] throws invalid type: 'static[seq[string]](["a", "b"])' for const
16:40:42FromDiscord<mratsim> https://github.com/nim-lang/RFCs/issues/44 @lqdev
16:40:43disbotβž₯ [RFC] Working with types in macro is difficult.
16:40:51FromDiscord<lqdev> greenfork: remove the static.
16:41:14greenforklqdev, unfortunately it is not a static string, and I want to use it with `scanf` and `scanf` requires a static string
16:41:18FromDiscord<mratsim> even in the past week I have been fighting against compiler bugs with types in amcro
16:41:32FromDiscord<lqdev> greenfork: sounds like a bug
16:41:40FromDiscord<lqdev> everything in a const should be static
16:41:55FromDiscord<lqdev> maybe you're indexing it at runtime?
16:42:14FromDiscord<mratsim> generic sandwiches are a pain: https://github.com/status-im/nimbus-eth2/commit/3366b75236badeb1438244ec2e7404e7fbedbed7
16:42:15*hmmm quit (Client Quit)
16:42:21FromDiscord<lqdev> or try wrapping your expression in static(), like static(strs[0])
16:42:36greenforkI do indexing a sequence at runtime but the string itself should still be static nevertheless
16:42:38FromDiscord<mratsim> you need dumb workaround like this for types in macro: https://github.com/status-im/nimbus-eth2/commit/ce0f7af862a5319a49e74ef3539d9ad8016e181d#diff-87fccb357b8ac917d13b924edd97ae5ce2d9ae2075c800754a5e7110ca92ef7cR165
16:42:42disruptekmratsim: where is your fork?
16:42:55Araqgreenfork, that's not how scanf works... or the language
16:43:13FromDiscord<mratsim> this one @disruptek: https://github.com/disruptek/cps/tree/mratsim-public-api-proposal
16:43:13FromDiscord<lqdev> greenfork: well the parameter must be static but indexing at runtime is not static
16:43:19disruptekoh.
16:43:23FromDiscord<lqdev> static means compile-time
16:43:37disruptekyeah, it's a complete non-starter imo.
16:44:13FromDiscord<lqdev> @mratsim i only really found typedesc[T] was getting in my way but other than that i haven't run into any of the issues mentioned in your rfc
16:44:18greenforklqdev Araq, yeah I think I know what you mean, thanks!
16:44:45Araq[RFC] Junk is broken is not an RFC btw. Usually RFCs have some vague ideas how to improve the situation
16:45:09disruptekat least.
16:46:12FromDiscord<mratsim> Well, you said that it's too hard to improve
16:46:58FromDiscord<mratsim> I ask for a way to convert NimNode to type/typedesc but the request was closed
16:47:06FromDiscord<mratsim> rudely I might say
16:47:20FromDiscord<mratsim> https://github.com/nim-lang/Nim/issues/6785
16:47:27Araqsorry about that, that was long ago though
16:47:54FromDiscord<mratsim> it was not you there
16:49:10AraqI'm sorry anyway
16:49:41Araqgeneric sandwiches ... had a solution for these
16:49:44disruptekmratsim: Error: node has no type
16:49:50disruptekare you sure this is based on typed?
16:50:04Araqrequires IC, more or less
16:51:06FromDiscord<mratsim> @disruptek are you talking about CPS?
16:51:15Araqbbl
16:51:19disruptekyes?
16:51:53FromDiscord<mratsim> it's unclear because it's there as well: https://github.com/nim-lang/RFCs/issues/44#issuecomment-385484106
16:51:53disbotβž₯ [RFC] Working with types in macro is difficult.
16:52:03FromDiscord<mratsim> where do you get this node has no type?
16:53:24disrupteki think it's ex06.
16:54:02*tane joined #nim
16:54:47disruptekare there tests or just these few examples?
16:54:49FromDiscord<mratsim> works for me https://media.discordapp.net/attachments/371759389889003532/796783913304588308/unknown.png
16:55:09FromDiscord<mratsim> those are examples to make sure that what I propose isn't just hot air
16:55:24FromDiscord<mratsim> it even works on v1.4.2
16:55:34disruptekrm the : int; that's the whole idea.
16:55:59FromDiscord<lqdev> btw i was browsing through old forum posts the other day and it's kinda weird to see araq being so warm, kind, and welcoming to everyone
16:56:02disruptekanyway, i'm just not willing to use a cps in which i cannot return an arbitrary continuation.
16:56:26FromDiscord<mratsim> you can
16:56:30disruptektry rebasing to get "node has no type" fix.
16:56:33FromDiscord<mratsim> "bindCallerContinuation" gives you that
16:56:37FromDiscord<lqdev> the 2020 araq feels like more of a down-to-earth technicalist
16:57:08FromDiscord<mratsim> ah I see
16:57:11FromDiscord<lqdev> which is not a bad thing ofc
16:57:17FromDiscord<mratsim> yeah I didn't work on CPS the past week
16:57:18disruptekalso, what's the point of all these files and directories with nothing in them?
16:57:28FromDiscord<mratsim> what "all"?
16:57:42disruptek ξ‚  mratsim-public-ap…posal *+1/-1 $2 ξ‚° cps ξ‚° cat core.nim Thu 11:57
16:57:42FromDiscord<mratsim> only stdlib has only a readme
16:57:45disruptekimport core/public_api
16:57:47disruptekexport public_api
16:58:02disruptekthat shit is just annoying.
16:58:17FromDiscord<mratsim> well, why do you mix scheduling with cps transformation
16:58:21FromDiscord<mratsim> that shit is just annoying
16:58:24FromDiscord<mratsim> there I said it
16:58:31disruptekbecause it's hard to demo cps without a scheduler.
16:58:33FromDiscord<Meowz> @lqdev At some point the community gets at that point aswell. Just like the cpp boomers. "Hey how does print work", RTFM YOU FCKING PIECE OF !
16:58:42FromDiscord<lqdev> yeeeeah
16:58:50disruptekwhere do we mix scheduling with the transform?
16:58:57greenforkmore on static strings, can I ask compiler to unroll the "for loop" for me and use static strings? https://play.nim-lang.org/#ix=2Lby
16:58:57FromDiscord<lqdev> i think i experienced that myself
16:59:00FromDiscord<mratsim> eventqueue
16:59:10FromDiscord<mratsim> and semaphores
16:59:10disruptekwell, duh.
16:59:13disruptekit's a scheduler.
16:59:22disruptekgreenfork: for loops are already unrolled.
16:59:24FromDiscord<lqdev> like, back in the day i was so much more enthusiastic about my stuff, now all i see is the bad sides.
16:59:27disruptekthat's their defining characteristic.
16:59:41greenforkdisruptek, so should my example compile? https://play.nim-lang.org/#ix=2Lby
17:00:34FromDiscord<mratsim> schedulers are separate from CPS, what we want to say is, here is CPS, it's just 2-3 files.↡Here is an example scheduler, but it can also be asyncdispatch or chronos
17:01:03disruptekwe've said that numerous times in the README.
17:01:17FromDiscord<mratsim> But I want to show that in the code structure as well
17:01:19disruptekwhen it's working, we'll move the scheduler out.
17:01:28disrupteki dunno what that statement means.
17:01:31FromDiscord<haxscramper> greenfork: not it should not, but you can do `for ch in fields(("a", "hay$i")):` to make `ch` a compile-time constant too
17:01:58FromDiscord<haxscramper> In your example you have regular `for` loop that of course loses `static` qualifier on variable of iteration
17:02:06FromDiscord<haxscramper> `fields()` on the other hand unrolls the loop
17:02:11FromDiscord<lqdev> slick tricks in the Nim programming language
17:02:19FromDiscord<lqdev> somebody needs to make a book out of this
17:02:39disrupteknim obfuscation?
17:02:48FromDiscord<mratsim> here is a compile-time loop unroller @greenfork: https://github.com/mratsim/constantine/blob/master/helpers/static_for.nim#L22-L50
17:03:34*letto quit (Quit: Konversation terminated!)
17:03:35FromDiscord<mratsim> one is for ranges and the overs is for an array of enums.
17:03:40FromDiscord<mratsim> other
17:04:02greenforkhaxscramper, yeah this works for tuples, good enough, thanks!
17:04:36FromDiscord<haxscramper> we have https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features
17:04:47FromDiscord<haxscramper> Yeah, I should add this one
17:05:19*letto joined #nim
17:05:42FromDiscord<haxscramper> greenfork: for the record - what was your use case with scanf?
17:05:47greenforkmratsim, this one is cool, thanks!
17:06:17disruptekZevv: had some bandwidth issues last night, but yes, the codegen is not ideal.
17:06:37disruptekwill probably fix it with a move today.
17:08:10greenforkhaxscramper, I parse different errors from c2nim and comment the line in C code, then run c2nim again and again. currently these errors seem fixable just by commenting the line: "Error: expected ';'" and "Error: did not expect {"
17:08:35FromDiscord<Randall> Is it possible to create a module (namespace really) using a macro?
17:09:28disruptekonly by statically creating a file and then importing it.
17:10:26FromDiscord<Randall> Hmm so if module A creates module B, would it be easy for module C to reference B?
17:11:35disruptekas easy as any other module reference.
17:11:42disruptekmodules are files.
17:11:49disruptek.nim files are modules.
17:12:10disrupteki think i'm going to need coffee to continue with this.
17:13:02FromDiscord<haxscramper> ~features
17:13:03disbotfeatures: 11begin in the unfortunate state of /unimplemented/
17:13:11FromDiscord<mratsim> lol
17:20:04*Jesin quit (Quit: Leaving)
17:20:28FromDiscord<haxscramper> Araq: I made PR with fusion commit hash fix (CI all green), can you merge it now?
17:24:32*taprack joined #nim
17:26:33*Jesin joined #nim
17:47:03*nekits07 joined #nim
18:04:11greenforkc2nim converts C structs to Nim types with {.bycopy.} pragma. how can it be dangerous to remove this pragma? I assume that procs with {.importc.} already do everything by value as a common sense of interfacing with C
18:09:41FromDiscord<shadow.> @ElegantBeef
18:09:48FromDiscord<shadow.> your constructor fixes this right?
18:09:48FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Lc3
18:10:19FromDiscord<shadow.> !repo constructor
18:10:20disbothttps://github.com/beef331/constructor -- 9constructor: 11Nim macros to aid in object construction including event programming, and constructors. 15 3⭐ 0🍴 7& 2 more...
18:10:22FromDiscord<shadow.> fun
18:11:58FromDiscord<mratsim> It's dangerous because when parameter passing Nim pass by hidden reference large structs (more than 3 pointer sizes)
18:12:25FromDiscord<mratsim> for FFI you want to use exactly what the C/C++ proc expects
18:14:02greenforkmratsim, I see I see
18:14:57FromDiscord<shadow.> @ElegantBeef one thing i found
18:15:09FromDiscord<shadow.> it seems to not recognize y and z
18:15:11FromDiscord<shadow.> unless i put them on dif lines
18:15:12FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Lc6
18:15:13FromDiscord<shadow.> using constructor
18:15:41FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Lc7
18:18:05FromDiscord<exelotl> I really like the way ooc-lang did constructors, but I guess it's not really applicable to Nim
18:19:23*leorize quit (Ping timeout: 240 seconds)
18:21:18FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2Lc9
18:24:50*leorize joined #nim
18:26:53*nyaa8 quit (Quit: Ping timeout (120 seconds))
18:27:06*nyaa8 joined #nim
18:46:36FromDiscord<treeform> I never understood why nim's default constructor used : instead of =
18:47:00FromDiscord<treeform> `Point(x:1, y:2)` vs `Point(x=1, y=2)`
18:47:46FromDiscord<treeform> I also never understood why I can't just create `proc Point(...)`
18:47:48greenforksame, I frequently confuse it
18:47:59FromDiscord<haxscramper> Because it would require semantic information to differentiate between type constructor and function call?
18:48:51FromDiscord<treeform> I wish nim allowed function names be same as type names.
18:48:57FromDiscord<shadow.> hmm
18:49:01FromDiscord<shadow.> wouldn't that allow identifier names to be the same?
18:49:11FromDiscord<shadow.> and then you could do `var Point: Point` and such?
18:49:17FromDiscord<shadow.> which might be
18:49:17FromDiscord<shadow.> bad
18:49:19FromDiscord<haxscramper> This would certainly compilate things beyond measure
18:49:53FromDiscord<haxscramper> Now you can't even know if you are constructing an object or calling function without previously compiling all code above
18:50:10Oddmongermarshaling in nim doesn't save the object definition ?
18:50:21FromDiscord<treeform> But constructing an object is calling function (at some level)?
18:52:27FromDiscord<shadow.> im tryna recreate `erand48(xi)` in nim, would `randomize(); rand(1.0)` do the same?
18:52:35FromDiscord<shadow.> (edit) "im tryna recreate ... `erand48(xi)`" added "cpp's"
18:53:17FromDiscord<shadow.> im translating a raytracer and im not sure if xi is a seed or something more relevant
18:53:50FromDiscord<Daniel> Is there usable Glade for nim?
18:58:01FromDiscord<Meowz> How can I return early from an iterator if `return` is not not be used?
18:58:12FromDiscord<Meowz> (edit) "is not" => "can"
18:58:19FromDiscord<haxscramper> `break` out of the loop
18:58:53*pixtum[m] left #nim ("User left")
18:59:45FromDiscord<Meowz> I actually want that the iterator yields nothing on a specific condition
19:00:56disruptekuse the `not` operator.
19:08:36*habamax quit (Ping timeout: 240 seconds)
19:19:03ForumUpdaterBotNew post on r/nim by comsiccuttlefish: Are there no good Vim plugins for Nim?, see https://www.reddit.com/r/nim/comments/kskezq/are_there_no_good_vim_plugins_for_nim/
19:22:34*hmmm joined #nim
19:23:41reversem3https://play.nim-lang.org/#ix=2LcA -- Getting Errno 9 'Bad File Description'
19:31:20FromDiscord<shadow.> `Warning: JSON processing failed: cannot open: C:\Users\shado\Desktop\nim\Nimpaca\main.nim`
19:31:22FromDiscord<shadow.> why does this happen
19:31:23FromDiscord<shadow.> every time i go
19:31:25FromDiscord<shadow.> to compile anything
19:31:27FromDiscord<shadow.> πŸ’€
19:31:39disruptekyou're on windows.
19:31:45FromDiscord<shadow.> ok.
19:31:52FromDiscord<shadow.> @Quibono i blame you
19:32:14FromDiscord<Quibono> Nim’s feeling cheated on with all the rust you’ve been doing.
19:32:28greenforkcan I have a converter with type unions? converter intToUint8InColor*(self: tuple[r,g,b,a: int | int32]): Color = (self.r.uint8, self.g.uint8, self.b.uint8, self.a.uint8)
19:33:05disruptekwhat does the compiler say?
19:33:14greenforkin some cases I get (int32, int32, int32, literal int) tuples and Nim can't translate the last one to int32 to apply the correct converter
19:33:48disruptekobviously, that doesn't match the signature you pasted.
19:33:49*narimiran quit (Ping timeout: 264 seconds)
19:34:10greenforkError: type mismatch: got <int or int32> but expected 'uint8' -- compiler error
19:34:37disruptek~disrupstyle
19:34:38disbotdisrupstyle: 11tips for writing code that won't provoke 😠 rants 🀬 on irc: https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d -- disruptek
19:34:47greenforkdisruptek, why doesn't it match? last "literal int" is "int" so all types will be of "int | int32" type
19:35:12*narimiran joined #nim
19:35:14disruptekr,g,b,a are of the same type in your signature.
19:35:20disruptekint and int32 are not the same type.
19:35:54greenforkI see, let me try to fix it
19:38:06FromDiscord<exelotl> In my GBA lib I use int everywhere for convenience, and just assume the code will never run on a non-32-bit platform
19:39:03FromDiscord<shadow.> if the if fails then it would be returned?
19:39:12FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LcG
19:39:17FromDiscord<shadow.> (edit) "returned?" => "returned right?"
19:40:47FromDiscord<shadow.> nvm ill write it out
19:41:24greenforkdisruptek, so here is still not compiling example, am I doing something wrong? https://play.nim-lang.org/#ix=2LcH
19:42:24disruptekyes, you're using a converter and you're defining a tuple type.
19:42:33greenforkexelotl, I do interfacing with C and sadly have to work with int32 because it is a standard `int` in C
19:43:01greenforkdisruptek, am I punished for using Nim features?
19:43:10disruptekby me? yes.
19:43:22greenforkmercy
19:43:24disrupteksadly, i'm not the arbiter of compiler features.
19:44:02FromDiscord<shadow.> any way i can pass a literal as a view
19:44:21FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LcI
19:45:25FromDiscord<exelotl> I don't think there's any other way than that
19:46:12FromDiscord<lqdev> ptr?
19:46:35FromDiscord<lqdev> that's the only way i can think of but it's not idiomatic
19:47:07FromDiscord<shadow.> ah fair fair
19:47:44FromDiscord<exelotl> It would be unreliable right? Constants don't have addresses in Nim, so you presumably can't take a pointer to a constant literal
19:48:30FromDiscord<lqdev> everything must have an address in C tho which is why it would work with ptr
19:48:40FromDiscord<shadow.> fair enough
19:48:54FromDiscord<lqdev> &1 works fine in C if you're passing to a function
19:49:03FromDiscord<lqdev> tho i'm not sure how codegen would handle it
19:49:45FromDiscord<mratsim> constants are for most of them inlined at usage site
19:50:53FromDiscord<shadow.> im just passing 0
19:50:59FromDiscord<shadow.> i dont care abt mutation bc the only mutation is recursive
19:51:00FromDiscord<shadow.> but its fine lol
19:51:02FromDiscord<shadow.> ill just do
19:51:04FromDiscord<shadow.> `var depth = 0`
19:51:13FromDiscord<shadow.> https://media.discordapp.net/attachments/371759389889003532/796828305877368863/unknown.png
19:51:15FromDiscord<shadow.> wow my raytracer
19:51:17FromDiscord<shadow.> is working so beautifully
19:51:24FromDiscord<shadow.> lol
19:51:32FromDiscord<mratsim> Fade in black
19:51:37FromDiscord<shadow.> lmao
19:51:39disruptekit's probably night where you are.
19:51:46FromDiscord<shadow.> of course
19:51:48FromDiscord<mratsim> it happened to me when I was rebounding infinity rays
19:51:48FromDiscord<shadow.> its 2:51pm
19:51:49FromDiscord<exelotl> Sounds like you're misusing var params?
19:51:55FromDiscord<shadow.> eh there's prolly just
19:51:57FromDiscord<shadow.> some miscalculation
19:51:59FromDiscord<shadow.> somewhere
19:52:00FromDiscord<shadow.> some mistype lol
19:52:22FromDiscord<exelotl> sent a code paste, see https://paste.rs/JLV
19:52:26FromDiscord<shadow.> im prolly messing up `^` operator precedence or something
19:52:39FromDiscord<lqdev> fade to gray, colorblind ~~nobody will get that reference but i had to say that~~
19:55:02FromDiscord<shadow.> i basically just translated smallpt to nim lol
19:55:13FromDiscord<shadow.> idk why its just black
19:55:23FromDiscord<mratsim> smallpt is unreadable
19:55:27FromDiscord<shadow.> yep.
19:55:35FromDiscord<mratsim> there are a couple of warnings I noted in my own translation
19:56:00FromDiscord<mratsim> number one: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L27-L30
19:56:25FromDiscord<mratsim> number two: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L205
19:56:34FromDiscord<mratsim> lost a hour easy on that
19:56:42FromDiscord<shadow.> oh damn lemme look at that
19:56:52FromDiscord<shadow.> ah fuck that's it.
19:56:56FromDiscord<shadow.> the normalize thing is part of it
19:57:04FromDiscord<shadow.> bc im just using glm
19:57:08FromDiscord<shadow.> which prolly doesnt mutate
19:57:56FromDiscord<mratsim> number 3: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L176-L181
19:58:13FromDiscord<mratsim> C++ resolves from right to left and makes a complex one-liner that depends on it
19:58:42FromDiscord<shadow.> the only part that the normalizing matters is on d rihgt?
19:58:46FromDiscord<shadow.> the rest are all temporary
19:59:04FromDiscord<shadow.> nvm
19:59:06FromDiscord<shadow.> i got it
19:59:09FromDiscord<mratsim> I did that 8 months ago
19:59:12FromDiscord<shadow.> rip
19:59:22FromDiscord<shadow.> wait so
19:59:29FromDiscord<shadow.> i should make it mutate in place?
19:59:48FromDiscord<mratsim> I don't use in-place mutation, I just reorganized the code
19:59:54FromDiscord<mratsim> not here at least
20:00:07FromDiscord<shadow.> ohh
20:00:08FromDiscord<shadow.> i see
20:00:13FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LcN
20:02:38FromDiscord<mratsim> so it's not black anymore?
20:02:55FromDiscord<mratsim> you can temporarily remove the glass spheres to avoid all black
20:03:26FromDiscord<shadow.> lemme check
20:03:50FromDiscord<shadow.> how many samples do i need
20:03:52FromDiscord<shadow.> for it to be not black
20:04:26greenforkdisruptek, btw interesting notes on the Nim style. I disagree with half of it but interesting nonetheless
20:04:29FromDiscord<shadow.> hmm well
20:04:31FromDiscord<shadow.> we have a slight issue
20:04:38FromDiscord<shadow.> my c++ doesnt have erand48 lol
20:04:41FromDiscord<shadow.> im guessing it's posix or something?
20:05:05FromDiscord<mratsim> no
20:05:06FromDiscord<mratsim> https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L104-L112
20:05:14FromDiscord<mratsim> C++ stdlib.h
20:05:43FromDiscord<shadow.> ohhh i see
20:05:55FromDiscord<shadow.> i just used rand(1.0) that definitely is not working πŸ’€
20:06:00FromDiscord<shadow.> lmfaoo
20:06:03FromDiscord<shadow.> time to use erand
20:06:35FromDiscord<lqdev> greenfork: tbh only thing i disagree on is calling procs with one param. it works for some cases but for others it just looks eh
20:06:41FromDiscord<lqdev> i use it for system procs only
20:07:29greenforkyou have a lot of in common in terms of style then :)
20:07:39greenforka rare thing in software engineering
20:13:49FromDiscord<lqdev> i mean there isn't much you can mess up wrt stylng in nim
20:14:05FromDiscord<lqdev> though some users just won't follow commonly accepted guidelines
20:15:34FromDiscord<mratsim> you can create a macro that secretly tag wrong calls as raises:[] or nosideeffect so that they don't compile.
20:15:39FromDiscord<Meowz> Hey whats wrong with `"config.json".write_file((% s).pretty())`
20:16:04greenforkit is a lot of preferences. one style is good for cooperation I would agree, we have something like this called NEP1, but it's a lot more permissive https://nim-lang.org/docs/nep1.html
20:16:58FromDiscord<lqdev> what pisses me off more is weird spacing around : and =
20:17:21FromDiscord<lqdev> `a :int, b :int` come on...
20:17:29FromDiscord<mratsim> what?
20:17:33FromDiscord<mratsim> I've never seen that
20:17:40greenforkeyes hurt
20:17:43FromDiscord<lqdev> i did see some code in the wild that does that
20:17:53FromDiscord<Meowz> o_O
20:17:58disruptekblame beef.
20:18:12FromDiscord<mratsim> !repo beef
20:18:13disbothttps://github.com/beefproject/beef -- 9beef: 11The Browser Exploitation Framework Project 15 5440⭐ 1307🍴 7& 29 more...
20:18:14disrupteklqdev: which single-param calls don't you agree with?
20:18:24FromDiscord<haxscramper> Looks like lisp property list
20:18:28FromDiscord<lqdev> disruptek: `thing x`
20:18:37FromDiscord<haxscramper> I bet someone is was very high on LISP and the came to nim
20:18:43disrupteklike what in particular?
20:18:47FromDiscord<lqdev> i don't use them because my editor ext is too simplistic to be able to highlight them
20:18:52disruptekahh.
20:19:04FromDiscord<lqdev> so i do `thing(x)` like it's 2018 or something
20:19:15disruptekhighlighting calls versus vars is a big help.
20:19:18disruptekhighly recommended.
20:19:44FromDiscord<lqdev> difficult to do with lite's limited highlighting engine
20:19:54disrupteknot my problem.
20:19:58FromDiscord<lqdev> though i guess i could substitute it with my own... πŸ€”
20:20:09FromDiscord<lqdev> gotta make a nim parser in lua
20:20:15FromDiscord<mratsim> and call it light
20:21:24FromDiscord<shadow.> `undefined reference to erand48`
20:21:28*aenesidemus_ quit (Read error: Connection reset by peer)
20:21:49FromDiscord<shadow.> yikey
20:23:17FromDiscord<shadow.> i can prolly use uniform_real_distribution right
20:23:40FromDiscord<shadow.> you said remove glass to debug?
20:24:07leorize[m]@lqdev just ask nimsuggest to highlight it
20:24:43leorize[m]or if you end up writing one let me know, I may use it for the lua port of nim.nvim :p
20:24:57FromDiscord<lqdev> and wait 10 seconds until it gets highlighted? no thanks
20:25:26FromDiscord<lqdev> until nimsuggest receives the promised perf boosts from IC i'm not touching it with a ten foot pole
20:25:56FromDiscord<lqdev> my rather simplistic highlighting plugin is good for now
20:26:29leorize[m]you can give it some basic coloring then just have nimsuggest fill in when it has the highlights
20:26:45leorize[m]that's what nim.nvim do for the most part
20:26:57FromDiscord<lqdev> still would feel too sluggish for my taste
20:26:57FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LcX
20:27:25FromDiscord<mratsim> @shadow. yeah raytracing monte carlo doesn't care that much about the rng quality
20:27:39FromDiscord<shadow.> wait so
20:27:42FromDiscord<shadow.> why cant i use rand(1.0)?
20:27:45FromDiscord<Meowz> Could I code stuff in Nim for windows' kernel mode? What I'm interested for is: https://github.com/Zer0Mem0ry/KernelReadWriteMemory
20:27:49FromDiscord<mratsim> you can still view bad rng use artifacts though, see the 2 pictures: https://github.com/mratsim/weave/tree/master/demos/raytracing
20:28:10FromDiscord<shadow.> is rand(1.0) not uniform distribution?
20:28:21FromDiscord<mratsim> @Meowz basic rule is if you can do it in C you can do it in Nim
20:28:59FromDiscord<Meowz> mkay, but I guess no one tried that yet. And I'm a nim newbie ;D
20:29:10FromDiscord<mratsim> maybe look into this repo https://github.com/byt3bl33d3r/OffensiveNim
20:29:38*superbia joined #nim
20:30:20FromDiscord<mratsim> sent a long message, see http://ix.io/2Ld1
20:30:26FromDiscord<shadow.> lol i swear you've written everything into weave
20:30:33FromDiscord<mratsim> it's just a matter of finding where they hide in Microsoft documentation
20:30:34FromDiscord<shadow.> weave is just nim by example on steroids
20:31:01FromDiscord<shadow.> so do you think rand(1.0) could work?
20:31:09FromDiscord<shadow.> or does xi have some important relevance?
20:31:13FromDiscord<mratsim> Note that sometimes Windows doc lie about what dll provides what
20:31:15FromDiscord<mratsim> nop
20:31:21FromDiscord<mratsim> xi is just the RNG state
20:31:24FromDiscord<shadow.> ohh right
20:31:26FromDiscord<mratsim> rand1.0 would work
20:31:27FromDiscord<shadow.> so like instead of something like
20:31:29FromDiscord<shadow.> time(0)
20:31:29FromDiscord<shadow.> lol ye
20:31:41FromDiscord<shadow.> should i randomize(y ^ 3) or nah
20:31:46FromDiscord<mratsim> a scheduler is a laaaaarrggeee piece of code if you want it general enough
20:31:57FromDiscord<mratsim> or you can make just a queue if you want but that doesn't scale
20:32:09FromDiscord<mratsim> works fine if your tasks are in the 200ms though
20:32:58FromDiscord<shadow.> nvm i get what u mean
20:33:00FromDiscord<shadow.> kk ima try it
20:34:52FromDiscord<shadow.> still black ;-;
20:37:27FromDiscord<mratsim> good luck have fun πŸ˜‰
20:37:30FromDiscord<shadow.> lmfaooo
20:37:39*Gustavo6046 quit (Quit: ZNC 1.7.5 - https://znc.in)
20:37:47FromDiscord<mratsim> debugging raytracing is tough because it's hard to make test for graphics rendering
20:37:57FromDiscord<mratsim> I'm not even sure how to setup a raytracer CI
20:45:53FromDiscord<Vindaar> produce a result, check it by eye, store the png / whatever, compute result on CI, check difference of CI produced and expected. That's what I do for ggplotnim for a part of the CI
20:46:44FromDiscord<Vindaar> of course for the CI it needs to be low number of rays
20:47:48FromDiscord<shadow.> well im guessing i just have something flipped or something
20:47:56FromDiscord<shadow.> like a negative simple or + vs idek
20:56:29FromDiscord<shadow.> oh i think i know why
20:56:38FromDiscord<shadow.> @mratsim mult() is a dot product and not a
20:56:42FromDiscord<shadow.> and i acted as if it was
20:56:43FromDiscord<shadow.> lol
20:57:47FromDiscord<shadow.> wait nvm idek
20:57:52FromDiscord<shadow.> dot and should be the same thing on a vec
20:58:02*Gustavo6046 joined #nim
20:58:19FromDiscord<shadow.> wait
20:58:20FromDiscord<shadow.> im not sure
21:00:06*superbia quit (Quit: WeeChat 3.0)
21:00:17FromDiscord<shadow.> yep its dot not mult
21:01:29FromDiscord<shadow.> nvm im just being dumb lol ima shut up for now and figure this out πŸ’€
21:08:41FromDiscord<shadow.> this is gonna be a long trek.
21:09:02FromDiscord<mratsim> but with ray tracing you can't trust your eye
21:09:23FromDiscord<mratsim> if your shadow is wrong, you need to be trained to find that out
21:09:54FromDiscord<mratsim> and look at glass reflection https://media.discordapp.net/attachments/371759389889003532/796848101842354186/book1_animation.png
21:10:12FromDiscord<mratsim> https://raw.githubusercontent.com/mratsim/trace-of-radiance/master/media/book1_animation.gif
21:12:36FromDiscord<shadow.> i mean
21:12:43FromDiscord<shadow.> for me if its not black ima call it a day
21:12:44FromDiscord<shadow.> πŸ’€
21:13:27FromDiscord<shadow.> how do i run it in your multithreaded mode in your example?
21:19:51FromDiscord<mratsim> you pick a threadpool, you split your loop into your number of threads and off you go
21:20:21FromDiscord<mratsim> that will likely run in load balance issue because raytracing is heavily imbalancer but that's the first step
21:20:31FromDiscord<Vindaar> @mratsim but that's a problem of testing iin general and not the actual CI part
21:20:49FromDiscord<mratsim> CI doesn't have eyes
21:21:04*narimiran quit (Ping timeout: 260 seconds)
21:21:14FromDiscord<mratsim> and I don't trust mine for raytracing problems
21:21:20FromDiscord<Vindaar> of course not, haha. But if you have verified that it does work and you rely on CI for regression tests, this is a decent approach.
21:21:30FromDiscord<Vindaar> yeah, I probably wouldn't either
21:26:05*Gustavo6046 quit (Quit: ZNC 1.7.5 - https://znc.in)
21:33:24*Gustavo6046 joined #nim
21:33:49FromDiscord<inv> That's it, just to compare Rust and Nim πŸ™‚ https://github.com/inv2004/coinbase-pro-nim
21:36:15disrupteklqdev: if you think you have a good argument to change my style doc, i will try to adopt your style.
21:36:34disruptekpoor syntax highlighting isn't a very compelling argument though, i have to say.
21:36:50disruptekbut maybe there's a better reason to do it differently.
21:37:58disruptekinv: silly package name.
21:43:17disruptektreeform: i can reproduce your jsony benchmark with benchy, but not with criterion.
21:43:48disrupteki looked at benchy and i don't trust it. criterion uses a barried to ensure you're not cheating with the cache. 🀷
21:43:54disruptekbarrier, too.
21:44:07disrupteki will stick with criterion until i see something superior.
21:44:54*Vladar quit (Quit: Leaving)
21:49:42*hmmm quit (Quit: WeeChat 3.0)
21:49:57*xace quit (Ping timeout: 260 seconds)
21:49:59*D_ quit (Ping timeout: 256 seconds)
21:50:34*xace joined #nim
21:51:24FromDiscord<mratsim> the hell is this https://media.discordapp.net/attachments/371759389889003532/796858546805407784/unknown.png
21:51:40FromDiscord<mratsim> ambiguous identifier jason, use jason.jason :/
21:53:32disruptekdon't ask me.
21:55:25FromDiscord<Vindaar> gotta go an endless recursive `jason.jason.jason.…` surely!
21:55:37FromDiscord<mratsim> I'm not asking
21:55:40disruptektry: jaason.
21:55:42FromDiscord<Vindaar> needs to be more precise
21:55:48FromDiscord<mratsim> it's Nim import that leads to collision
21:55:50disruptekif that doesn't work, jaaaason might work.
21:56:16FromDiscord<mratsim> what was the syntax, from something import Json as JJson?
21:56:29disruptekwhat?
21:58:11FromDiscord<Randall> Jason sounds familiar https://hexdocs.pm/jason/readme.html
21:59:26FromDiscord<mratsim> I want to rename an imported symbol
22:02:08FromDiscord<dom96> @mratsim you're naming your function the same as the module?
22:02:15FromDiscord<dom96> Surely that's the problem here, no?
22:02:35FromDiscord<mratsim> nah it works, and it's disruptek's macro
22:02:47FromDiscord<mratsim> my issue is adding nim-json-serialization to treeform benchmark
22:03:11FromDiscord<mratsim> but there is a Json coming from Jason, one from jsony and one from nim-json-serialization
22:03:29FromDiscord<mratsim> and then I tried to qualify "jason.Json"
22:03:34FromDiscord<mratsim> and all hell broke loose
22:03:37disruptekeh jsony and jason don't clash.
22:03:56disruptekbenchmark here:
22:03:58disruptek!repo jason
22:03:59disbothttps://github.com/disruptek/jason -- 9jason: 11JSON done right 🀦 15 39⭐ 1🍴
22:03:59FromDiscord<mratsim> nim-json-serialization clashes with both
22:04:23FromDiscord<mratsim> and I need to rename Nim-json-serialization "Kson" type to something
22:04:28FromDiscord<mratsim> Json
22:04:32FromDiscord<mratsim> to avoid that clash
22:04:37disruptekmaybe i will rename the type and call it v1.
22:04:46disruptekJason should be pretty safe.
22:05:06FromDiscord<mratsim> Json is fine, it's Nim import that needs more flexibility.
22:06:12FromDiscord<mratsim> One thing is, if you use "bind Json" in your macro that would avoid Nim trying to look into other json symbols
22:06:19FromDiscord<mratsim> or something in that vein
22:06:27FromDiscord<treeform> @disruptek Thats a great find! I will look into criterion and adding barriers to benchy. Do you have the benchmark code and your criterion results?
22:06:37disruptekit's on my readme.
22:06:49*greenfork quit (Ping timeout: 264 seconds)
22:06:57FromDiscord<treeform> I forgot which one we are benchmarking json or flatty?
22:07:02disruptekjson.
22:07:14disruptekfrosty is cps-based now. 😈
22:07:14FromDiscord<treeform> I though we were on flatty
22:07:34FromDiscord<treeform> child protective services?
22:07:37FromDiscord<mratsim> ooooh made it compile
22:07:53disruptekmratsim: the problem is that i need people to be able to use the type whatfer broken concepts reasons.
22:08:02FromDiscord<mratsim> apparently "except" is not a full gatekeeper you can do qualified imports
22:08:04disruptekbut, yeah, i can make more use of bind.
22:08:12FromDiscord<mratsim> nope it's fine
22:08:13disruptekyeah, except never was.
22:08:19FromDiscord<mratsim> no need to change anything
22:08:21disruptekthat's how `except nil` works.
22:08:38FromDiscord<mratsim> https://media.discordapp.net/attachments/371759389889003532/796862884755144742/unknown.png
22:08:52FromDiscord<mratsim> nim-json-serialization is 2.5x faster than jsony
22:09:06disruptekyeah, i don't care; it's too expensive an import.
22:09:10disruptekwhatfer status reasons.
22:09:34disrupteki really just need to not do runtime serialization, period.
22:09:45*taprack quit (Ping timeout: 240 seconds)
22:10:02FromDiscord<dom96> anyone tried a C-based implementation as a comparison for these benchmarks?
22:10:22disruptekthere's a C version that mops the floor with everything.
22:10:27disrupteksimd-based iirc.
22:10:44disruptekbut i'm pretty much done with wrappers.
22:10:47FromDiscord<mratsim> simdjson is C++
22:10:58disrupteki can't count the hours i've wasted on libgit2.
22:11:09FromDiscord<mratsim> but it wouldn't parse into a Nim ref tree
22:12:29FromDiscord<mratsim> @disruptek, the import tree is a bug
22:12:43FromDiscord<mratsim> https://github.com/status-im/nim-json-serialization/issues/25
22:12:43disruptekwhat?
22:12:44disbotβž₯ Strange dependency tree
22:12:57disruptekyeah, i don't care. πŸ˜‰
22:13:05FromDiscord<mratsim> I'm pretty sure it's due to nimble not having fine-grained per-task dependencies though
22:13:05FromDiscord<dom96> I also wonder how Araq's packedjson compares
22:13:13disruptekbenchmarks on my readme.
22:13:16FromDiscord<dom96> Why is everybody writing json libraries lol
22:13:23FromDiscord<mratsim> there is a dependenncy on chronos but I think it's just for testing
22:13:34disrupteki dunno why treeform keeps reimpl my shit.
22:13:40FromDiscord<mratsim> why is Nim json so slow :/
22:14:24FromDiscord<treeform> @dom96, its disruptek fault
22:15:18disrupteki PR'd some "fixes" to std/json to slow it down. πŸ˜„
22:15:43FromDiscord<mratsim> @treeform FYI storing the changes here: https://gist.github.com/mratsim/927f7ce70607074b76e00dfe557e45f6
22:16:11FromDiscord<treeform> @disruptek https://github.com/disruptek/jason/blob/master/tests/sonny.nim#L39 why do you discard the output, doesn't the compiler optimize the whole function out? And also toJson returns a string, why do you cast it to a string again?
22:16:25FromDiscord<dom96> You should all be writing HTTP servers that beat the competition. The TechEmpower benchmarks are far more visible than any JSON benchmarks
22:16:32disruptekit's harmless; when i wrote the bench i had no idea what jsony returned.
22:16:46disruptekyou can remove the conversion if you think it will help (it won't).
22:17:05disruptekdom96: none of us need http servers.
22:17:10FromDiscord<treeform> @dom96, I deal with like 1 request per minute at work, but parse terrabytes of json.
22:17:20disruptekthis.
22:17:22FromDiscord<treeform> Yeah I don't need HTTP serers
22:17:29FromDiscord<mratsim> actually we need one at Status.
22:17:30FromDiscord<treeform> All my servers are websocket based
22:17:35disruptek!repo quic
22:17:35FromDiscord<treeform> or UDP based
22:17:36disbothttps://github.com/status-im/nim-quic -- 9nim-quic: 11QUIC for Nim 15 21⭐ 0🍴 7& 8 more...
22:17:40disruptekit's otw.
22:17:57FromDiscord<treeform> @mratsim what changes are you making?
22:18:10FromDiscord<mratsim> 6 lines
22:18:27FromDiscord<mratsim> import serialization, import json_serialization except Json, toJson
22:18:31FromDiscord<treeform> oh you added status!
22:18:31FromDiscord<mratsim> and the timeit
22:18:33FromDiscord<treeform> got it
22:18:58FromDiscord<treeform> I was not able to have std/json and packedjson work in the same file
22:19:16FromDiscord<treeform> they I think they conflict because they generate procs that are named the same
22:19:20FromDiscord<treeform> do you know a way around it?
22:20:27FromDiscord<mratsim> use "except"
22:20:37FromDiscord<mratsim> that doesn't prevent qualified import
22:20:40FromDiscord<treeform> but they are generated by a macro?
22:20:51FromDiscord<mratsim> ah
22:21:05FromDiscord<treeform> packedjson/deserialiser
22:21:18FromDiscord<mratsim> no idea, I don't care enough about json at the moment
22:21:30FromDiscord<treeform> @mratsim what package do I need to install to make your code work?
22:21:37FromDiscord<mratsim> when I'm back with dealing with GB of json i'll look into that
22:21:57FromDiscord<mratsim> json_serialization, serialization, chronos, bearssl
22:22:08FromDiscord<mratsim> don't ask me why about the dependencies
22:22:48FromDiscord<treeform> thanks!
22:24:00FromDiscord<treeform> good job yours is are faster! https://gist.github.com/treeform/5b19460fbc81ef71bc506fbac5253f77
22:24:11FromDiscord<treeform> I will be taking more look at your code.
22:25:28FromDiscord<mratsim> the speed is likely not in the parser but more in faststreams
22:25:38FromDiscord<mratsim> it's zero-copy streams
22:26:09disruptekthat was my analysis, too.
22:26:58FromDiscord<mratsim> aka, once again, it's memory that is the bottleneck, not the CPU
22:27:22FromDiscord<mratsim> and most perf problem can be summarized as how to bring the data fast enough to the CPU
22:30:09FromDiscord<treeform> Yes
22:30:24FromDiscord<treeform> What do you mean by zero-copy stream?
22:30:51FromDiscord<mratsim> better read the readme, I didn't write or study the library: https://github.com/status-im/nim-faststreams#what-does-zero-overhead-mean
22:31:03FromDiscord<treeform> thanks!
22:31:56FromDiscord<mratsim> there are links to Microsoft articles just above
22:32:16FromDiscord<mratsim> going to sleep
22:35:13*taprack joined #nim
22:50:59FromDiscord<treeform> @disruptek encode_jason_integer is taking 6cycles. I don't think that could be right. Thats too fast. I think its optimizing the code a way. I made it in a `for 0 .. 1000` and it was also 6 cycles. I think on my machine and with my compiler `criterion` the stuff gets optimized a way to nothing. So it's not actually benchmarking anything. https://gist.github.com/treeform/3fabb3fd630e21fbd3c1a948445f7a92 Could you help me with this?
22:57:47*tane quit (Quit: Leaving)
22:59:20FromDiscord<Avatarfighter> omg we have quic but in nim
23:03:42*D_ joined #nim
23:03:51FromDiscord<treeform> @disruptek I was able to make encode_jason_integer go from 5 cycles to 808'929cycles by changing the input data from `const` to a `var`. Compiler basically ran the benchmark at compile time and just outputed results.
23:04:13disruptekthat's the goal.
23:04:27disruptek808,929 cycles?
23:04:34FromDiscord<treeform> do it compile time?
23:04:59disruptekit's literally the first line of text in the readme.
23:05:12FromDiscord<treeform> which readme?
23:05:17disruptekthe one for the project.
23:05:39FromDiscord<treeform> criterion?
23:05:50disruptek!repo jason
23:05:50disbothttps://github.com/disruptek/jason -- 9jason: 11JSON done right 🀦 15 39⭐ 1🍴
23:05:56disruptekjason is the project you're testing, right?
23:06:03disruptekam i high right now?
23:06:23FromDiscord<treeform> "mostly compile-time JSON encoding"
23:06:59FromDiscord<treeform> I though this means it will generate the serialized at compile time, not serialize at compile time.
23:07:15disruptekwhat's the point of that?
23:07:28FromDiscord<treeform> I don't know? You wrote it.
23:07:43disruptekanyway, i just s/const thing/const thing2/ and add `var thing = thing2` and now:
23:07:52disruptekBenchmark: encode_jason_integer -> () Cycles: 41cycles Β± 5cycles
23:08:12disruptekit's obviously going to be slower to serialize stuff at runtime.
23:08:19disruptekwhy would you want to do that if you don't have to?
23:08:33disruptekto save a couple bytes of memory?
23:08:47FromDiscord<treeform> Because my data is dynamic?
23:09:16disruptekwell, what can i say. it's still faster than jsony.
23:09:23disruptekBenchmark: encode_jsony_integer -> () Cycles: 298cycles Β± 168cycles
23:09:34disruptekyou don't have to use jason, though.
23:09:54FromDiscord<treeform> yes your code is still faster
23:10:03FromDiscord<treeform> you are able to turn integer into string faster them I am
23:10:05FromDiscord<treeform> I want to know how
23:10:17disruptekit's just a macro.
23:10:46FromDiscord<treeform> Right now you are benchmarking this: https://gist.github.com/treeform/f49ce8132f5be7bb3ce5daaac849adab
23:10:55FromDiscord<treeform> And yeah I can't win vs a constant πŸ™‚
23:11:12FromDiscord<treeform> Unless I output a constant myself
23:11:13disruptekyou're not supposed to win.
23:11:16FromDiscord<treeform> (edit) "Unless I output a ... constant" added "compile"
23:11:23disruptekthe whole idea of jason is to not do any work.
23:11:45disruptekthere's more to do, also.
23:12:02*D_ quit (Remote host closed the connection)
23:12:55disrupteki don't fold all constants, for example. i don't pre-serialize entire arrays or objects, etc.
23:13:10FromDiscord<treeform> but why benchmark then stuff you do fold?
23:13:22disruptekto make sure i don't fuck up.
23:13:34FromDiscord<treeform> ok
23:13:36disruptekit's hard to believe, but even disruptek makes errors.
23:13:47FromDiscord<zetashift> I don't believe that, lies.
23:14:11disruptekzeta you chucklehead, you starred my disruptek/README.
23:15:07disruptektreeform: a lot of my json use is constants for api calls and stuff.
23:15:22disruptekcoupled with carnac, it cuts my runtime dramatically.
23:17:45FromDiscord<treeform> Yeah its neat, its a dimension I did not consider.
23:17:55FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=2LdX
23:18:03FromDiscord<treeform> We both can do it, its just jason does it in more places. While mine reaches for the dynamic stuff.
23:19:18FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=2LdY
23:19:19FromDiscord<treeform> `thing.sheep.jason.string` is still a constant
23:19:24FromDiscord<treeform> while mine is not a constant
23:19:34FromDiscord<treeform> fascinating...
23:20:21disruptekjason was really a poc for frosty.
23:22:55*D_ joined #nim
23:25:15*D_ quit (Remote host closed the connection)
23:25:26*D_ joined #nim
23:35:05FromDiscord<treeform> @disruptek I figured out how to do the same trick you are doing. This is pretty cool. Thanks!
23:35:22FromDiscord<treeform> Just had to add `template toJson[T](v: static[T]): static[string] =`
23:35:56FromDiscord<treeform> You give me a static thing, you get a static string back... beautiful πŸ™‚
23:36:24FromDiscord<sealmove> is it possible to download content of a site in Nim? get it as a nim string for example?
23:36:54FromDiscord<treeform> @sealmove https://nim-lang.org/docs/httpclient.html
23:38:11FromDiscord<ElegantBeef> @shadow. ah didnt ever test that case
23:38:40FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2Le1
23:40:09disrupteki wonder what that means.
23:40:37FromDiscord<sealmove> ah nevermind, it works with -d:ssl, I had it at the end of the command which doesn't work
23:40:48FromDiscord<sealmove> thanks treefrom, awesome :)