00:01:00 | FromGitter | <alehander92> disruptek i just dont come in often now |
00:03:23 | * | Guest25945 quit (Ping timeout: 272 seconds) |
00:06:01 | leorize[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:58 | disruptek | alehander92: 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:09 | FromDiscord | <shadow.> are there any packages for vector math? |
02:44:23 | FromDiscord | <shadow.> basically like yk a (T, T, T) |
02:44:27 | FromDiscord | <shadow.> with operator overloads and |
02:44:38 | FromDiscord | <shadow.> other operations like normalizing and stuff? |
02:45:15 | FromDiscord | <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:32 | ForumUpdaterBot | New 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:24 | adnan338 | Hello, 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:07 | FromDiscord | <ElegantBeef> You're locking the thread so it should be safe afaik |
03:30:46 | adnan338 | Is it somehow possible to somehow prevent the usage of this `Data` outside a `withLock` block? |
03:31:39 | adnan338 | So I don't mistakenly just use it without the lock |
03:32:05 | FromDiscord | <ElegantBeef> I'm uncertain |
03:32:36 | disruptek | why are you "forced to use globally mutable variables"? |
03:32:43 | FromDiscord | <Filipe Duarte> https://github.com/mratsim/Arraymancer |
03:32:43 | disruptek | this seems to be exactly what you don't want. |
03:33:06 | FromDiscord | <Quibono> https://github.com/stavenko/nim-glm |
03:33:07 | disruptek | otherwise, you could use a macro to lock the data automatically. |
03:33:58 | FromDiscord | <Quibono> @shadow. |
03:37:39 | adnan338 | disruptek: 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:41 | adnan338 | o API does not define the args to be of var type. |
03:38:19 | disruptek | fix the api? |
03:39:20 | adnan338 | disruptek: Even so, doesn't embedding data into UI sound like a bad practice? (I know global mutables are also bad) |
03:40:23 | adnan338 | For example, https://gitlab.com/9898287/invoicer/-/blob/master/src/frontend/ui.nim#L290 |
03:40:47 | adnan338 | here 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:23 | FromDiscord | <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:36 | FromDiscord | <shadow.> but ig arraymancer is optimized to bits anyways lol |
03:53:14 | disruptek | adnan338: 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:25 | disruptek | but i'd rather fix the api. |
04:00:40 | * | Guest25945 quit (Quit: Guest25945) |
04:00:48 | FromDiscord | <Filipe Duarte> Fast and easy to use |
04:01:05 | disruptek | like my ex-gf. |
04:01:26 | * | Guest25945 joined #nim |
04:08:07 | FromDiscord | <shadow.> fair enough |
04:08:23 | FromDiscord | <ElegantBeef> Well you also have nim-glm |
04:08:31 | FromDiscord | <ElegantBeef> Which does stack allocated types |
04:08:45 | FromDiscord | <Quibono> Which I linked to. :p |
04:08:48 | FromDiscord | <ElegantBeef> Although for most of the things you'll do the heap isnt going to be that slow |
04:08:58 | FromDiscord | <ElegantBeef> Yep i was just pointing it out since they seemed to ignor you |
04:09:04 | FromDiscord | <shadow.> well im making a raytracer |
04:09:06 | FromDiscord | <Quibono> Haha thanks beef |
04:09:09 | FromDiscord | <Quibono> hug |
04:09:23 | FromDiscord | <ElegantBeef> Nah you seem to not talk a lot about Nim π |
04:09:28 | FromDiscord | <shadow.> lol who |
04:09:38 | FromDiscord | <ElegantBeef> Qui asking about other languages in #offtopic a fair bit π |
04:09:40 | FromDiscord | <shadow.> qui talks abt zig πβ |
04:09:45 | FromDiscord | <shadow.> EXACTLY |
04:09:57 | FromDiscord | <ElegantBeef> Did you ever get it on par with Nim/Rust? |
04:09:58 | FromDiscord | <Quibono> Lol guy asks about zig once and you just remember that. |
04:10:10 | FromDiscord | <shadow.> lmaoo |
04:10:23 | FromDiscord | <shadow.> uhh i think qui dropped it lol |
04:10:35 | FromDiscord | <shadow.> u never ran the example the guy sent u |
04:10:47 | FromDiscord | <Quibono> Yeah thatβs true. |
04:11:33 | saem | Yay, nimsuggest patch went in. |
04:11:48 | FromDiscord | <shadow.> so for like a raytracer w the typical things ill need (operators, scalars, normalizing) what do you think would be best? |
04:11:51 | FromDiscord | <ElegantBeef> Nice now you gotta work on the vscode extension? π |
04:11:51 | saem | Now to fix another thing and update the extension slightly. |
04:12:04 | FromDiscord | <shadow.> arraymancer or glm |
04:12:35 | FromDiscord | <ElegantBeef> Isnt arraymancer a GPU based abstraction, so would give you SPEEEED |
04:12:41 | FromDiscord | <shadow.> speeeed |
04:12:50 | FromDiscord | <shadow.> also has multicore iirc? |
04:13:08 | FromDiscord | <shadow.> but stack go brr and heap go "hm where is free" |
04:13:10 | FromDiscord | <Quibono> Just benchmark them |
04:13:14 | FromDiscord | <Quibono> :p |
04:13:24 | FromDiscord | <shadow.> at least according to zig bc of how overblown they make it :shade |
04:13:27 | FromDiscord | <shadow.> lolll |
04:13:28 | FromDiscord | <ElegantBeef> The data you have will mostly be sequential data, no? |
04:13:36 | FromDiscord | <shadow.> wdym? |
04:13:50 | FromDiscord | <ElegantBeef> Most of the data will be allocated in sequences and not be thrown around the heap |
04:13:57 | FromDiscord | <shadow.> ah true yeah |
04:14:06 | FromDiscord | <shadow.> arraymancer prolly makes more sense |
04:14:17 | FromDiscord | <shadow.> ill try benching basic operations w them |
04:20:36 | ForumUpdaterBot | New thread by Foldl: Zig-style async/await, see https://forum.nim-lang.org/t/7347 |
04:21:28 | FromDiscord | <shadow.> @Quibono ay you been waiting for this one? |
04:21:46 | FromDiscord | <Quibono> Lool |
04:22:03 | FromDiscord | <Quibono> if Nim and zig would have a baby thatβs fine by me |
04:22:23 | FromDiscord | <Quibono> Iβd happily scavenge each of them for their good points. |
04:27:56 | FromDiscord | <Rika> oh my god i thought someone implemented it its just someone asking if it exists |
04:28:15 | FromDiscord | <Quibono> Lol Rika got excited for a hot minute |
04:28:38 | * | spiderstew_ joined #nim |
04:29:54 | FromDiscord | <shadow.> yk i can think of some very bad names for nim and zig's baby π |
04:30:05 | FromDiscord | <shadow.> lets just go with zim. |
04:31:17 | * | spiderstew quit (Ping timeout: 272 seconds) |
04:31:17 | FromDiscord | <Rika> its not hard to think of bad names for nim and zig's baby |
04:31:25 | FromDiscord | <Rika> also zim is already a common name |
04:32:11 | FromDiscord | <Quibono> Mizig |
04:32:19 | FromDiscord | <Rika> nizim |
04:32:30 | FromDiscord | <Rika> ziming |
04:32:32 | FromDiscord | <ElegantBeef> Mig |
04:32:40 | FromDiscord | <Rika> oh shit a jet plane |
04:32:42 | FromDiscord | <Quibono> Lol mig would rock |
04:32:49 | FromDiscord | <Quibono> Lol literally logo already figured |
04:35:22 | FromDiscord | <ElegantBeef> Now what does Zig do better than Nim? |
04:35:44 | FromDiscord | <ElegantBeef> We've got metaprogramming, easier to add it than merge the two π |
04:36:38 | FromDiscord | <Quibono> Easy manual memory management would be cool. |
04:36:42 | FromDiscord | <Rika> zig and nim have completely inverse goals |
04:36:48 | FromDiscord | <Quibono> That too. |
04:36:51 | FromDiscord | <Quibono> Lol |
04:37:28 | FromDiscord | <Quibono> What specifically do you see as the goals of the two rika? |
04:37:34 | leorize | manual memory management in nim is super easy nowadays :P |
04:38:08 | leorize | zig proclaims itself as "not magic" in anything, so no operator overloads, no macros, etc. |
04:38:27 | leorize | basically zig is like an antithesis for nim :P |
04:38:46 | FromDiscord | <shadow.> yeahh |
04:38:48 | disruptek | it's a great c. |
04:39:24 | FromDiscord | <shadow.> zig is pretty bare bones which is good for some things |
04:39:45 | FromDiscord | <shadow.> but nim certainly has a better writing speed at least for me |
04:39:46 | leorize | to this day I'm still not sure what that is :P |
04:39:57 | leorize | well maybe static analysis since you don't have to parse magic |
04:40:27 | FromDiscord | <shadow.> zig stl is sadly undocumented which is a big issue to achieve popularity im guessing |
04:40:28 | FromDiscord | <ElegantBeef> Hence why i'm asking what Zigs does better than Nim π |
04:40:47 | FromDiscord | <ElegantBeef> There has to be a reason to want a merge of the two |
04:40:50 | FromDiscord | <Rika> zig does the C look better than nim xdddd |
04:40:57 | disruptek | i like how seamless compile-time is. |
04:40:58 | FromDiscord | <ElegantBeef> Yea i cannot think of anything actual |
04:41:10 | FromDiscord | <Rika> wdym disruptek |
04:42:05 | FromDiscord | <Quibono> Beef defer and errdefer are nice. |
04:42:20 | FromDiscord | <shadow.> nim has defer just not errdefer |
04:42:23 | FromDiscord | <shadow.> iirc |
04:42:34 | FromDiscord | <ElegantBeef> We've got defer |
04:42:37 | FromDiscord | <Rika> nim defer isnt the exact same i believe |
04:42:46 | FromDiscord | <ElegantBeef> `// defer will execute an expression at the end of the current scope.` |
04:42:46 | FromDiscord | <shadow.> ig nim doesnt need it as much bc we dont needa manually free shit π |
04:42:52 | FromDiscord | <Quibono> Also like just general Zig does errors really nicely. |
04:42:57 | FromDiscord | <Quibono> Lol thatβs fair shadow. |
04:43:16 | FromDiscord | <Rika> especially when arc becomes widely used loooo |
04:43:39 | FromDiscord | <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:45 | FromDiscord | <Quibono> Legit question, why isnβt arc the default? |
04:43:59 | FromDiscord | <ElegantBeef> Cyclical |
04:44:02 | FromDiscord | <Rika> not as stable yet as refc im guessing |
04:44:07 | mipri | it's new, it changes semantics, not everything's compatible with it. |
04:44:16 | FromDiscord | <Rika> beef that just changes the question to why is orc not default |
04:44:26 | FromDiscord | <ElegantBeef> It will be |
04:44:31 | mipri | and the default doesn't matter that much. saying --gc:orc draws attention to the new stuff, as well. |
04:44:33 | FromDiscord | <Rika> yet i mean |
04:44:36 | disruptek | orc will be the default. |
04:44:49 | disruptek | too easy for people to complain about leaks when they use arc. |
04:45:07 | FromDiscord | <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:21 | leorize | `{.raises: [].}` |
04:45:46 | FromDiscord | <Rika> its possible but he asks if its feasible |
04:45:51 | FromDiscord | <Rika> if its sensible |
04:46:04 | leorize | yes, status does it for their nimbus project |
04:46:26 | FromDiscord | <Quibono> Like is the Nim compiler aware of the types of errors a specific function could throw? |
04:46:34 | leorize | yes |
04:46:37 | FromDiscord | <shadow.> yes |
04:46:42 | FromDiscord | <ElegantBeef> sey |
04:46:44 | FromDiscord | <shadow.> static typing go brr |
04:46:51 | leorize | you can even see them in the documentation |
04:46:58 | FromDiscord | <shadow.> yep |
04:47:02 | FromDiscord | <Quibono> Then +1 for that being a thing automatically lol |
04:47:07 | FromDiscord | <shadow.> loll |
04:47:14 | FromDiscord | <Quibono> Because when I heard about it in zig I was impressed. |
04:47:50 | FromDiscord | <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:15 | FromDiscord | <shadow.> obvi easier said than done but i wouldnt call it revolutionary for zig |
04:54:53 | FromDiscord | <shadow.> idk if theres any language i would say comes close to having features i miss in nim id say rust lol |
04:54:57 | FromDiscord | <shadow.> ownership is cool |
04:55:30 | FromDiscord | <shadow.> the implicit copying in nim kinda flies past me sometimes when its prolly more efficient to not copy |
04:55:30 | disruptek | i don't program so i can solve ownership puzzles. |
04:55:39 | FromDiscord | <shadow.> fair |
04:56:10 | FromDiscord | <shadow.> if nim somehow had like ownership as a no-gc mode my life would be complete |
04:56:28 | leorize | views are an experimental feature atm |
04:56:33 | FromDiscord | <shadow.> like nim c file -d:owner |
04:56:41 | FromDiscord | <shadow.> oh yeah i saw those |
04:56:48 | FromDiscord | <shadow.> --gc:owner |
04:56:55 | leorize | not that it's working very well since 4raq said the analysis is flawed |
04:57:28 | leorize | why should --gc:owner even be a thing :P |
04:57:57 | FromDiscord | <shadow.> hmm |
04:58:15 | leorize | views is the feature that rust do well and nim doesn't |
04:58:23 | FromDiscord | <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:29 | FromDiscord | <shadow.> yeah i agree |
04:58:46 | FromDiscord | <shadow.> i just find views make sense as a workflow in my mind but ofc everyones different |
04:59:07 | leorize | not sure what rust's ownership system get you that arc doesn't |
04:59:21 | FromDiscord | <shadow.> removes implicit copies |
04:59:38 | disruptek | it's tighter more of the time. |
04:59:38 | FromDiscord | <shadow.> which is a curse and a blessing lol |
04:59:40 | leorize | that's auto borrowing and is the problem views are supposed to tackle |
04:59:59 | FromDiscord | <shadow.> in nim if i pass a big object it's copied right? |
05:00:02 | leorize | rust's ownership system usually refers to it's implementation of heap-based memory management |
05:00:05 | FromDiscord | <ElegantBeef> Nope |
05:00:08 | leorize | shadow. no |
05:00:15 | FromDiscord | <ElegantBeef> Nim sends by reference when it needs to |
05:00:18 | FromDiscord | <shadow.> oh hm |
05:00:27 | FromDiscord | <shadow.> lemme think of a better example lol |
05:00:41 | FromDiscord | <shadow.> i mean yeah im interested to see how views turn out |
05:00:43 | leorize | there is a reason why you gotta perform shadowing yourself if you want to modify the proc params :P |
05:00:51 | FromDiscord | <shadow.> ye true |
05:01:01 | * | Guest25945 quit (Quit: Guest25945) |
05:01:15 | FromDiscord | <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:38 | FromDiscord | <ElegantBeef> Both are scoped based memory management with ownership |
05:01:48 | FromDiscord | <ElegantBeef> Just we dont have to be so frigging annoying with annotating the lifetime |
05:02:10 | FromDiscord | <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:18 | leorize | afaict lifetimes is kinda like trying to reason the heap in terms of the stack :P |
05:02:47 | FromDiscord | <ElegantBeef> I just cant wait for views so we can stop doing copies for things like sequtils/strutils |
05:02:53 | FromDiscord | <shadow.> ah yeah |
05:02:54 | FromDiscord | <ElegantBeef> Also first class iterators would be nice |
05:02:58 | FromDiscord | <shadow.> yepp |
05:03:05 | FromDiscord | <shadow.> and more closure usage |
05:03:17 | leorize | we do have first class iterators, just that they suck and disruptek's cps will fix that |
05:03:29 | FromDiscord | <shadow.> i should really look at zero_functional lol |
05:05:11 | FromDiscord | <ElegantBeef> Well we have the issue that things like `toSeq` have to be used like C |
05:05:25 | FromDiscord | <ElegantBeef> afaik first class iterators would resolve that issue |
05:06:02 | leorize | nim's closure iterators semantics are very weird :P |
05:06:03 | disruptek | what do you mean, "used like C"? |
05:06:35 | FromDiscord | <ElegantBeef> They break UFCS |
05:06:47 | disruptek | oh, who cares. |
05:06:52 | FromDiscord | <ElegantBeef> Me |
05:07:02 | FromDiscord | <ElegantBeef> I always forget what the U stands for |
05:07:14 | FromDiscord | <ElegantBeef> Occasional? |
05:07:20 | disruptek | that must be it. |
05:08:05 | disruptek | zevv's cps tests are green as of today. |
05:08:33 | FromDiscord | <ElegantBeef> Nice |
05:08:43 | leorize | it's more of an issue with iterators sharing the same namespace as procs |
05:08:48 | disruptek | might have shims working tomorrow, i dunno. |
05:09:06 | FromDiscord | <ElegantBeef> Do you mean not sharing, leorize? |
05:09:20 | FromDiscord | <ElegantBeef> Atleast as i read up on it they didnt share name space |
05:09:44 | leorize | they do share the namespace in a very weird manner, at least for the first class ones |
05:10:20 | disruptek | it might be a problem for cps, too. |
05:11:01 | leorize | currently I'm just concerned about the correctness of destructors |
05:11:24 | disruptek | as usual, the users are being asked to debug the software. |
05:11:57 | leorize | yea, nim-sys will have to grow some correctness checking code for testing |
05:12:52 | leorize | how terrible would it be to add a flag to an object that doesn't exist in the release version? :P |
05:13:29 | disruptek | i do it all the time. |
05:13:53 | FromDiscord | <ElegantBeef> Also what's considered a first class iterator? |
05:13:55 | disruptek | it's annoying when the damn .booldefine can't be used to `when` in type sections, though. |
05:14:04 | disruptek | beef: something you can advance manually. |
05:14:13 | FromDiscord | <ElegantBeef> So closures? |
05:14:29 | disruptek | we don't really want a limited set of semantics. |
05:15:01 | disruptek | if you look at cps, you can inject new data, yield values, perform arbitrary manipulation, stash the object, etc. |
05:15:45 | disruptek | continuations are what you want. cps just takes your "normal" control flow and rewrites it to give you that. |
05:16:27 | disruptek | mratsim has some syntax you can play with, but i wouldn't get too attached to the impl. π |
05:17:15 | FromDiscord | <Anonymous Poet> does anyone know where the tests for the asynchttpserver are in the main repo? |
05:17:23 | FromDiscord | <Anonymous Poet> i wouldve expected tests/pure but theres no such folder |
05:17:56 | leorize | it's in tests/stdlib/tasynchttpserver.nim |
05:17:57 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/Nim/blob/662c5080755eb5a42df2c3acb84c044876571a46/tests/stdlib/tasynchttpserver.nim |
05:19:20 | FromDiscord | <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:38 | saem | Wow, I can't brain concepts tonight. |
05:57:08 | FromDiscord | <ElegantBeef> What's the problem? |
05:58:37 | saem | It 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:41 | saem | https://github.com/saem/vscode-nim/blob/main/src/nimvscode/flatdbtablenode.nim |
05:58:58 | saem | That way I can get rid of a bunch of slowness. |
06:01:18 | saem | I instance one of those for these two types: https://github.com/saem/vscode-nim/blob/main/src/nimvscode/nimIndexer.nim#L28 |
06:01:18 | saem | I get I'm tired right now... but I _thought_ I understood concepts better than this. :/ |
06:05:52 | FromDiscord | <Anonymous Poet> anyone here familiar with the async dispatcher? |
06:06:01 | FromDiscord | <Anonymous Poet> i cant get the code from nim master to compile on mac os π¦ |
06:06:10 | * | greenfork joined #nim |
06:06:16 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2L8t |
06:07:34 | FromDiscord | <ElegantBeef> Saem does this help any? https://play.nim-lang.org/#ix=2L8u |
06:07:52 | FromDiscord | <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:06 | FromDiscord | <Anonymous Poet> im going to try working off of my local nim lib file and see if that works in the meantime |
06:09:17 | saem | ElegantBeef I did get that far, it was the constraining of generic type params where I'm hitting errors. |
06:10:22 | FromDiscord | <ElegantBeef> I havent used concepts much isnt it just `thingy[T: IdedObj]`? |
06:10:25 | FromDiscord | <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:37 | FromDiscord | <ElegantBeef> Saem where is your usecase? |
06:16:21 | saem | I tried to show my use case. π |
06:16:49 | FromDiscord | <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:32 | FromDiscord | <ElegantBeef> You do know concepts are compile time only, so you can only add one type to the seqs/tables |
06:17:41 | saem | Oh yeah |
06:17:47 | saem | I instantiate two _separate_ ones |
06:17:49 | saem | One for files |
06:17:52 | saem | one for types |
06:18:09 | saem | No mingling of the two. |
06:20:10 | FromDiscord | <ElegantBeef> Sorry, i cannot see/understand the issue |
06:20:35 | saem | Let me make a playground and send it over. |
06:29:35 | saem | It doesn't work, but you can at least see my thinking: https://play.nim-lang.org/#ix=2L8y |
06:36:58 | saem | OMG... what was I even thinking/ |
06:37:10 | FromDiscord | <ElegantBeef> idk |
06:37:12 | saem | I should stop. |
06:41:05 | adnan338 | Is #nim-offtopic down? |
06:43:50 | Zevv | no |
06:43:54 | Zevv | "down" does not exist in irc |
06:45:46 | disruptek | rdr2 makes me homesick for the west. |
06:49:26 | Zevv | i finished a few weeks ago. that made me sad |
06:49:47 | Zevv | now 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:38 | disruptek | it really feels like northern california or western colorado. |
06:51:32 | Zevv | I 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:42 | adnan338 | Zevv: 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:47 | adnan338 | ah well |
06:51:57 | Zevv | adnan338: use another server |
06:52:02 | disruptek | well, don't share it here. |
06:52:09 | disruptek | this is the rdr2 channel. |
06:52:15 | Zevv | right so |
06:52:21 | disruptek | did you play rdr1? |
06:52:27 | Zevv | yeah |
06:52:31 | adnan338 | What is an rdr2? |
06:52:43 | disruptek | it's a video-game. |
06:52:44 | Zevv | so, wait, you get sponsor money and suddenly you have a PS4 - right?! |
06:52:48 | FromDiscord | <ElegantBeef> Read dead redemption the second |
06:52:50 | Zevv | this was for /drugs/ |
06:53:07 | adnan338 | oh hahah |
06:53:11 | disruptek | i think i'm gonna have to grow my own here. |
06:53:13 | FromDiscord | <ElegantBeef> I mean he needed the ketamine and did under the table favours and got both |
06:53:57 | disruptek | rdr1 was ps3. |
06:54:06 | Zevv | yeah I know |
06:54:24 | Zevv | it's plugged in in my study, but don't tell the kids |
06:54:43 | disruptek | this game looks good at 4k but the framerate is absolute dogshit on this panel. |
06:56:43 | disruptek | yeah, more california than colorado. |
06:56:57 | disruptek | man, i gotta get some fucking work. |
07:00:35 | * | letto_ quit (Quit: Konversation terminated!) |
07:01:43 | * | letto joined #nim |
07:04:45 | disruptek | this is awesome. |
07:05:09 | disruptek | URLs on the forum require a trailing slash in order to render as links... the trailing slash is not part of the link. |
07:05:44 | disruptek | i swear this was intentional, just to fuck with us. |
07:07:45 | Prestige | That's awesome. |
07:09:23 | disruptek | Zevv: 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:37 | Zevv | wah, how can you not know: 2 ginseng, 2 carrots and 2 shrooms |
07:12:57 | disruptek | i'm not wasting shrooms on a fucking horse. |
07:13:09 | Zevv | there you go |
07:13:32 | disruptek | i got it to go again with ctrl-alt-del. |
07:13:43 | disruptek | shoulda been the first thing i tried. |
07:13:45 | saem | That'll learn it |
07:15:09 | * | opal joined #nim |
07:18:08 | Zevv | my iterator has a one-off |
07:18:23 | disruptek | a what? |
07:18:40 | Zevv | off-by-one |
07:18:44 | Zevv | https://en.wikipedia.org/wiki/Off-by-one_error |
07:18:51 | Zevv | "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:01 | Zevv | "It often occurs in computer programming when an iterative loop iterates one time too many or too few." |
07:19:14 | disruptek | you keep that shit queued up for 'splaining what off-by-one errors are? |
07:19:25 | Zevv | I got more where that came from |
07:19:36 | disruptek | i pity your peers. |
07:19:50 | Zevv | what makes a peer |
07:20:05 | Zevv | should I pity you? |
07:20:08 | disruptek | where there's smoke, there's fire. |
07:20:29 | disruptek | is it bad that i murder everyone i see? |
07:20:33 | disruptek | i feel like that's bad. |
07:21:16 | Zevv | let's see how long you keep that up |
07:23:45 | disruptek | i lasso'd a bighorn sheep. |
07:23:51 | disruptek | then i didn't know how to do. |
07:26:51 | disruptek | you ever lasso a squirrel? |
07:32:37 | disruptek | what this game gets wrong is that it never rains. |
07:32:45 | Zevv | it's in a days work |
07:33:30 | Zevv | oh it rains, allright. pouring down. |
07:33:51 | Zevv | https://youtu.be/I0QnV1x2Lhk?t=200 |
07:36:51 | * | muffindrake quit (Ping timeout: 272 seconds) |
07:37:52 | disruptek | no, 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:28 | disruptek | Zevv: you call your iterator 7 times and you discard the first value; what do you expect it to output? |
08:01:20 | Zevv | Did I say off-by-ones also are highly correlated with typing before coffee? |
08:01:46 | Zevv | joking aside, in 0.0.13, the semantics were different |
08:02:05 | disruptek | really? |
08:02:12 | Zevv | the first call "primed" the iterator, but not resume it before calling it the first time |
08:02:34 | disruptek | that was a weird idea. |
08:02:42 | Zevv | well, no, yes |
08:02:48 | Zevv | who changed this code, let me blame |
08:03:00 | Zevv | oh it was me |
08:03:53 | disruptek | the idea of embedding a trampoline anywhere in cps seems a little mad to me, now. |
08:04:12 | Zevv | ha, i'm just making a mess, sorry mate |
08:04:13 | disruptek | but i'm not 100% sure how we will do result. i think [] is a trampoline or something. |
08:04:39 | disruptek | no, i thought it made sense at some point. |
08:04:52 | * | clemens3 joined #nim |
08:04:58 | Zevv | 't is all right |
08:04:58 | disruptek | but it works the way you want now, right? |
08:05:06 | Zevv | yeah |
08:05:14 | disruptek | i think it's good. |
08:06:21 | disruptek | are any of these other files supposed to work? |
08:06:36 | Zevv | goto works again |
08:06:52 | Zevv | getting echo_server_client up would be nice |
08:07:27 | disruptek | hmm. |
08:08:50 | disruptek | it's so old. |
08:09:30 | Zevv | yeah but it was nice because real and standalone |
08:12:28 | disruptek | Nim closure iterators are 1.715483009230006 times faster |
08:13:02 | Zevv | shaame |
08:13:36 | disruptek | seems odd. |
08:15:09 | disruptek | the codegen looks really good. |
08:21:19 | * | Tanger quit (Quit: Leaving) |
08:25:03 | * | greenfork quit (Remote host closed the connection) |
08:25:12 | disruptek | looks like 50% slower at best, i guess due to alloc. panics helps a lot. |
08:25:49 | disruptek | i guess because we have more gratuitous proc calls. |
08:26:16 | disruptek | maybe rvo issue too. |
08:26:18 | Zevv | hm but closure iterators make one call per iteration as well |
08:26:40 | Zevv | can you push |
08:27:09 | disruptek | pushed. |
08:27:24 | disruptek | added a hash to make sure no one optimizes out. |
08:30:03 | disruptek | i thought this test used to show us only 10-15% off pace. π€ͺ |
08:31:05 | Zevv | did you look at the actual C codegen? |
08:46:11 | Oddmonger | are there limitation of regex when parsing a buffer with a CR in it ? https://play.nim-lang.org/#ix=2L8O |
08:46:21 | Oddmonger | the above was working with only one line |
08:47:09 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2L8P |
08:47:57 | FromDiscord | <haxscramper> Not responding on forum because message parser can't handle backquotes on message, or something like that |
08:49:01 | FromDiscord | <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:48 | FromDiscord | <haxscramper> But first solution incurs overhead in form of calling closure and generally directed towards qt/ |
08:50:10 | FromDiscord | <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:43 | FromDiscord | <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:16 | FromDiscord | <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:54 | FromDiscord | <haxscramper> That is for the second idea/example I pasted above |
08:56:28 | Araq | nimcache is available at compile-time |
08:58:43 | FromDiscord | <haxscramper> Can you give and example on how one can access it? |
08:59:00 | FromDiscord | <haxscramper> (edit) "and" => "an" |
09:04:45 | FromDiscord | <mratsim> sent a long message, see https://paste.rs/5JK |
09:05:12 | * | NimBot joined #nim |
09:05:45 | FromDiscord | <mratsim> If we write to the disk it's through a DB. Otherwise it's config files at startup. |
09:05:54 | FromDiscord | <mratsim> @leorize ^ |
09:06:25 | Araq | import compilesettings |
09:06:31 | FromDiscord | <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:39 | Araq | echo querySetting(nimcacheDir) |
09:07:22 | FromDiscord | <mratsim> yes that was what I was thinking |
09:07:35 | FromDiscord | <mratsim> I don't need methods or virtual function thankfully |
09:07:54 | FromDiscord | <haxscramper> good for you |
09:08:16 | FromDiscord | <haxscramper> I wanted to leverage all information that I gathered when wrapping C++ code and make it accessible to nim compile-time |
09:08:34 | FromDiscord | <haxscramper> To provide additional functionality/wrapper correctness checking, like override etc. |
09:08:59 | FromDiscord | <haxscramper> Or `{.requiresinit.}` annotations for non default-constructible classes |
09:09:42 | FromDiscord | <haxscramper> But in the end this all will revolve around `cxxClass NewCxx of CppDerived:`, just additional information |
09:10:46 | FromDiscord | <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:39 | FromDiscord | <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:05 | ForumUpdaterBot | New 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:27 | FromDiscord | <Enimatek> what is the difference between `proc foo[T](bar: var T)` and `proc foo[T](bar: T)` ? |
09:43:09 | FromDiscord | <Enimatek> in both cases i seem to have access to al data in T |
09:43:20 | Zevv | yes but only in the latter you can modify T |
09:43:21 | FromDiscord | <ElegantBeef> `var` is mutable |
09:43:28 | FromDiscord | <Enimatek> ah ok |
09:43:30 | Zevv | unless T is a ref type, then they behave the same |
09:43:39 | PMunch | Not quite |
09:43:52 | PMunch | When a ref type is a var you're able to update the original reference |
09:44:00 | FromDiscord | <mratsim> unless you use strictFunc :p |
09:44:00 | FromDiscord | <ElegantBeef> Zevv you said latter you meant former |
09:44:21 | Zevv | "almost the same" |
09:44:31 | FromDiscord | <mratsim> the devil is in the details |
09:44:33 | Zevv | "for most practical reasons" |
09:44:44 | Zevv | "and regular, non-pedantic folks" |
09:44:47 | Zevv | pfff, these people here |
09:44:58 | FromDiscord | <mratsim> regular Nim folks are pedantic π |
09:44:59 | FromDiscord | <ElegantBeef> Eh i'm just correcting your sentence which was misleading π |
09:45:04 | PMunch | @mratsim, for strictFunc to matter they need to be funcs and not procs ;) |
09:45:20 | FromDiscord | <mratsim> I prefer funk |
09:45:21 | PMunch | I think |
09:45:57 | FromDiscord | <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:15 | FromDiscord | <mratsim> depends if T has ref semantics or value semantics |
09:46:18 | PMunch | If T is a ref object, yes |
09:46:24 | PMunch | Otherwise it will return a copy |
09:46:25 | FromDiscord | <Enimatek> yes ref object |
09:46:26 | FromDiscord | <mratsim> if T has value semantics it will be copied |
09:47:33 | FromDiscord | <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:54 | Zevv | https://play.nim-lang.org/#ix=2L95 |
09:50:08 | FromDiscord | <Enimatek> ok thnx, that is a nice way to check all the outcomes π |
09:52:29 | FromDiscord | <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:54 | FromDiscord | <bark> how mature are concepts in nim right now? |
09:56:49 | * | hmmm joined #nim |
09:57:52 | * | xet7 joined #nim |
10:00:21 | FromDiscord | <ElegantBeef> They're usable and accessible without the experimental flag, but will be going through a change soon TM |
10:01:55 | FromDiscord | <mratsim> change? |
10:02:04 | FromDiscord | <mratsim> concepts work fine |
10:02:25 | FromDiscord | <mratsim> main issue is that they aren't cached like generics so might lead to increased compilation time |
10:02:36 | FromDiscord | <mratsim> still way better than C++ templates though. |
10:02:40 | greenfork | is 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:54 | FromDiscord | <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:09 | FromDiscord | <mratsim> The concept as is work fine for me, I just want VTable |
10:06:21 | FromDiscord | <bark> VTable? |
10:06:51 | FromDiscord | <mratsim> storing instances of the same concept in the same collection like a seq |
10:07:16 | FromDiscord | <bark> but wouldn't that mean size clashes? |
10:07:30 | FromDiscord | <bark> wouldn't that kill lookup time in seq's |
10:08:33 | FromDiscord | <bark> unless they were ref π€ |
10:10:58 | FromDiscord | <mratsim> heterogeneous seq imply boxing/ref-ing yes |
10:11:40 | FromDiscord | <ElegantBeef> Yea a vtable would be niice |
10:12:56 | FromDiscord | <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:51 | FromDiscord | <flywind> now we have https://github.com/yglukhov/iface |
10:15:14 | FromDiscord | <ElegantBeef> Oh never seen iface before |
10:15:27 | FromDiscord | <ElegantBeef> I had seen interfaced before |
10:17:35 | FromDiscord | <flywind> yeah, it is very new |
10:17:55 | FromDiscord | <ElegantBeef> Ah didnt notice |
10:21:04 | * | abm joined #nim |
10:55:17 | ForumUpdaterBot | New 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:09 | PMunch | Where did libssl go in the Windows DLL collection? |
11:45:38 | PMunch | And can you download the DLL collection for older Nim versions? |
12:07:26 | ForumUpdaterBot | New 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:31 | FromDiscord | <shadow.> does `float` default to `float64?` |
12:46:33 | FromDiscord | <shadow.> (edit) "`float64?`" => "`float64`?" |
12:46:39 | FromDiscord | <shadow.> only asking bc int is int64 for me |
12:46:43 | FromDiscord | <shadow.> wait i can just print sizeof |
12:47:13 | FromDiscord | <shadow.> yep float64 |
12:47:33 | narimiran | yes, see: https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L30 |
12:49:24 | FromDiscord | <shadow.> ah yeah |
12:50:04 | PMunch | int is defined to be the same size as a pointer on your device |
12:50:12 | PMunch | So it'll be int32 on a 32 bit machine |
12:50:36 | FromDiscord | <shadow.> ahh that makes sense |
12:50:51 | FromDiscord | <shadow.> is there a zeros function in arraymancer? |
12:51:01 | FromDiscord | <shadow.> trying to avoid `0.repeat(n).toTensor()` |
12:51:06 | PMunch | reset? |
12:51:28 | FromDiscord | <shadow.> ohh wait |
12:51:31 | FromDiscord | <shadow.> does a tensor default to 0's |
12:51:32 | FromDiscord | <shadow.> im dumb |
12:51:34 | FromDiscord | <shadow.> lmao |
12:51:44 | PMunch | Everything in Nim defaults to 0's |
12:52:06 | FromDiscord | <shadow.> yeah i had forgotten abt how nice that was |
12:52:33 | FromDiscord | <shadow.> i am now realizing how much more i enjoy nim after coming back from a rust attempt |
12:52:34 | FromDiscord | <shadow.> lmao |
12:53:05 | PMunch | Haha, yeah you really start missing things when you realise they are gone |
12:53:38 | FromDiscord | <shadow.> like i started to go "hmm i kinda like ownership" and then i tried orc again and i was like "oh." |
12:54:21 | FromDiscord | <shadow.> lol |
12:56:19 | FromDiscord | <shadow.> time to go look at that nim tricks thing bc i have a fat result field assignment block lol |
12:56:43 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2L9Y |
12:57:09 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2L9Z |
13:01:02 | FromDiscord | <Enimatek> yay my first package for nimble, yet another orm, but this one is mine π https://github.com/cybertim/torm |
13:03:45 | FromDiscord | <mratsim> it's called zeros. |
13:04:35 | FromDiscord | <shadow.> c++ has `INFINITY` which is `((float)(1e+300 1e+300))`. is there an equivalent value in nim? |
13:04:39 | FromDiscord | <shadow.> ah that would make sense lol |
13:04:39 | FromDiscord | <shadow.> thx |
13:04:58 | FromDiscord | <hugogranstrom> We have `Inf` |
13:04:59 | FromDiscord | <mratsim> use "inf" |
13:05:14 | FromDiscord | <mratsim> it's described in the module fenv of Nim stdlib |
13:05:32 | FromDiscord | <shadow.> kk ty |
13:05:37 | FromDiscord | <mratsim> if you do raytracing don't use Arraymancer btw |
13:05:53 | FromDiscord | <mratsim> it's way too heavy an abstraction, and the incorrect one. |
13:06:41 | FromDiscord | <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:14 | FromDiscord | <mratsim> well raytracing or raster graphics |
13:07:41 | FromDiscord | <mratsim> you can however represent the final image as a tensor and do machine learning on it |
13:08:08 | FromDiscord | <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:59 | FromDiscord | <shadow.> ah rip |
13:09:04 | FromDiscord | <shadow.> do you think nim-glm would make sense? |
13:09:32 | FromDiscord | <mratsim> sure |
13:09:58 | FromDiscord | <shadow.> kk |
13:10:00 | FromDiscord | <mratsim> I didn't use it though |
13:10:04 | FromDiscord | <shadow.> fair enough |
13:10:07 | FromDiscord | <mratsim> I just reimplement math myself: https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/primitives/vec3s.nim |
13:10:16 | FromDiscord | <shadow.> yeah fair enough |
13:11:00 | FromDiscord | <mratsim> ultimately if you want speed you need to reorg your data anyway, see @planetis post on ECS |
13:11:14 | FromDiscord | <mratsim> but get a PoC out and then worry about data movement. |
13:11:19 | FromDiscord | <mratsim> be prepared to break everything |
13:11:53 | FromDiscord | <mratsim> it's the struct of arrays vs arrays of struct |
13:13:54 | FromDiscord | <exelotl> cool, nice one! |
13:15:02 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2La7 |
13:15:03 | FromDiscord | <shadow.> sphere is just a value object so |
13:15:07 | FromDiscord | <shadow.> i dont think i can use nil |
13:15:12 | FromDiscord | <shadow.> could i use like an option or something? |
13:18:18 | FromDiscord | <exelotl> yeah Option[Sphere] is probably good |
13:18:21 | FromDiscord | <mratsim> https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/physics/hittables/hittables_lists.nim#L48-L55 |
13:18:51 | FromDiscord | <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:34 | FromDiscord | <mratsim> bench: https://github.com/nim-lang/Nim/pull/14417 |
13:19:34 | disbot | β₯ The whole options module should be inline |
13:19:50 | FromDiscord | <mratsim> though that might have changed since https://github.com/nim-lang/Nim/pull/14442 |
13:19:51 | disbot | β₯ make get for options use lent T |
13:20:11 | FromDiscord | <shadow.> so then what should i use here? |
13:20:20 | FromDiscord | <shadow.> a pointer? |
13:20:48 | FromDiscord | <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:56 | FromDiscord | <mratsim> you can use option for starter |
13:21:17 | FromDiscord | <mratsim> otherwise like me, a var float64 and you return a bool to tell if you have a hit or not |
13:21:23 | FromDiscord | <shadow.> hmm |
13:21:24 | FromDiscord | <exelotl> soo ptr? |
13:21:24 | FromDiscord | <shadow.> i see |
13:21:30 | FromDiscord | <exelotl> oops I didn't mean to send that |
13:21:32 | FromDiscord | <shadow.> lmao |
13:21:39 | FromDiscord | <exelotl> yeah use a bool xD |
13:21:41 | FromDiscord | <shadow.> we were thinking it internally π |
13:22:22 | FromDiscord | <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:34 | FromDiscord | <mratsim> I don't like to introduce mutation if we can avoid it. |
13:23:11 | * | abm quit (Quit: Leaving) |
13:25:05 | FromDiscord | <mratsim> and here is another implementation: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L93-L102 |
13:25:45 | FromDiscord | <shadow.> hmm |
13:25:49 | FromDiscord | <shadow.> so just use a var to keep track? |
13:26:20 | FromDiscord | <shadow.> or should i just do `for sphere in spheres:` |
13:26:24 | FromDiscord | <shadow.> and use the bool |
13:26:25 | FromDiscord | <shadow.> like you said |
13:26:31 | FromDiscord | <mratsim> as you wish |
13:26:37 | FromDiscord | <shadow.> kk |
13:26:56 | FromDiscord | <mratsim> make sure to use latest Nim as well because "for sphere in spheres" used to introduce unnecessary copies as well |
13:27:02 | FromDiscord | <mratsim> was also a bottleneck |
13:27:29 | FromDiscord | <mratsim> https://github.com/nim-lang/Nim/issues/14421 |
13:27:32 | disbot | β₯ `items` is 20%~30% slower than iteration via an index ; snippet at 12https://play.nim-lang.org/#ix=2J0N |
13:27:57 | FromDiscord | <shadow.> im on devel 1.5.1 |
13:28:07 | FromDiscord | <shadow.> should i update to latest commit? |
13:28:57 | FromDiscord | <mratsim> it's fixed in 1.4 |
13:28:59 | FromDiscord | <mratsim> so you're good |
13:29:37 | * | leorize joined #nim |
13:29:57 | FromDiscord | <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:52 | Araq | reminds me ... I still need to benchmark --exceptions:goto vs Option[T] |
13:35:07 | FromDiscord | <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:38 | ForumUpdaterBot | New 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:12 | FromDiscord | <shadow.> eek |
13:59:16 | FromDiscord | <shadow.> this is gonna be annoying to translate |
13:59:17 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Lag |
14:00:49 | FromDiscord | <mratsim> it's just `var image = newSeq[Vec3f](width height); let pixel = cast[ptr UncheckedArray[Vec3f](image[0].addr)` |
14:00:56 | FromDiscord | <shadow.> ohhh |
14:01:05 | FromDiscord | <shadow.> well pixel changes |
14:02:15 | FromDiscord | <shadow.> would this not work? |
14:02:18 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Laj |
14:02:22 | FromDiscord | <shadow.> oh wait |
14:02:23 | FromDiscord | <shadow.> i see |
14:02:28 | FromDiscord | <shadow.> would it be image[0].addr maybe? |
14:04:18 | FromDiscord | <shadow.> wait nvm |
14:04:27 | FromDiscord | <shadow.> not sure i understand what the cpp is doing lol |
14:06:03 | FromDiscord | <mratsim> image.addr takes the address of the seq |
14:06:04 | FromDiscord | <shadow.> (edit) would it be image[0][0].addr maybe? |
14:06:07 | FromDiscord | <shadow.> yeah |
14:06:11 | FromDiscord | <mratsim> you want the address of the buffer |
14:06:11 | FromDiscord | <shadow.> image[0][0].addr would |
14:06:14 | FromDiscord | <shadow.> take a pointer to the first one |
14:06:15 | FromDiscord | <shadow.> right |
14:06:15 | FromDiscord | <mratsim> no |
14:06:16 | FromDiscord | <shadow.> (edit) "right" => "right?" |
14:06:17 | FromDiscord | <shadow.> ah |
14:06:18 | FromDiscord | <shadow.> lol |
14:06:21 | FromDiscord | <mratsim> only one [0] |
14:06:27 | FromDiscord | <shadow.> oh right it's 1d |
14:06:30 | FromDiscord | <shadow.> whoops |
14:06:36 | FromDiscord | <mratsim> [0][0] is looking into random memory |
14:06:40 | FromDiscord | <shadow.> yep |
14:06:41 | FromDiscord | <shadow.> lmao |
14:06:51 | FromDiscord | <shadow.> so why wouldnt image[0].addr work? |
14:06:55 | FromDiscord | <shadow.> why the `cast[ptr UncheckedArray[Vec3f](image[0].addr)` |
14:07:05 | FromDiscord | <shadow.> (edit) "UncheckedArray[Vec3f](image[0].addr)`" => "UncheckedArray[Vec3f]](image[0].addr)`" |
14:07:25 | * | adnan338 quit (Ping timeout: 240 seconds) |
14:07:34 | FromDiscord | <mratsim> well, first of all, I'm just naively translating the C code |
14:07:51 | FromDiscord | <mratsim> not sure why they want that image pointer |
14:08:00 | FromDiscord | <mratsim> or pixel pointer |
14:08:07 | FromDiscord | <mratsim> in nim you can just do image[i] |
14:08:13 | FromDiscord | <mratsim> no need for that pixel stuff |
14:08:18 | FromDiscord | <shadow.> yeah hm |
14:08:34 | FromDiscord | <mratsim> second, if you take a pointer, for indexing, a ptr UncheckedArray is what you want |
14:08:36 | FromDiscord | <shadow.> they're never even reassigning pixel? |
14:08:39 | FromDiscord | <shadow.> so wouldnt it only point |
14:08:41 | FromDiscord | <shadow.> to the first element? |
14:08:51 | FromDiscord | <shadow.> oh nvm |
14:08:54 | FromDiscord | <shadow.> ++pixel in the loop |
14:08:58 | FromDiscord | <shadow.> yeah im just gonna do indexing lmfao |
14:09:28 | FromDiscord | <shadow.> `M_PI 0.5 fov / 180.` is that just `radians(fov) / 2`? |
14:09:59 | * | vindaar[m] joined #nim |
14:12:46 | FromDiscord | <mratsim> looks like it |
14:13:00 | FromDiscord | <mratsim> I just create deg_to_rad and distinct types for those |
14:13:18 | FromDiscord | <mratsim> otherwise you can crash a space shuttle |
14:13:30 | FromDiscord | <shadow.> wdym |
14:13:53 | FromDiscord | <mratsim> https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/primitives/safe_math.nim#L21-L29 |
14:14:16 | FromDiscord | <mratsim> iirc one of the space shuttle crash was because someone though kilometres were miles |
14:14:24 | FromDiscord | <mratsim> and that threw computation of |
14:14:30 | FromDiscord | <mratsim> off |
14:14:34 | FromDiscord | <shadow.> jeez |
14:14:35 | FromDiscord | <shadow.> lmao |
14:14:56 | FromDiscord | <mratsim> https://www.simscale.com/blog/2017/12/nasa-mars-climate-orbiter-metric/ |
14:15:06 | FromDiscord | <shadow.> yikes |
14:15:07 | FromDiscord | <shadow.> `image[y width + x]` |
14:15:10 | FromDiscord | <shadow.> i think this should work |
14:15:12 | FromDiscord | <shadow.> instead of pixel |
14:16:06 | PMunch | That was an embarrassing mistake.. |
14:16:12 | FromDiscord | <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:12 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Laq |
14:16:21 | FromDiscord | <shadow.> yike |
14:16:48 | FromDiscord | <mratsim> hence the US never received a reference to establish what a meter is |
14:16:55 | FromDiscord | <mratsim> before it was too late |
14:17:03 | FromDiscord | <shadow.> shouldnt nasa be expected to at least know how long a meter is π |
14:17:14 | PMunch | mratsim, huh TIL |
14:17:18 | PMunch | Do you have a source for that? |
14:17:28 | PMunch | @shadow. they have switched to use metric only now |
14:17:41 | FromDiscord | <shadow.> good lol |
14:17:58 | PMunch | It's funny how a lot of the US stuff is just really old European customs |
14:18:12 | FromDiscord | <mratsim> https://www.nist.gov/blogs/taking-measure/pirates-caribbean-metric-edition |
14:18:12 | PMunch | Like switching your fork back and forth while you eat |
14:18:32 | FromDiscord | <shadow.> hm |
14:18:35 | FromDiscord | <shadow.> i might just use ppm for now i guess |
14:20:54 | FromDiscord | <shadow.> are there docs for nimpng? |
14:20:56 | FromDiscord | <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:05 | FromDiscord | <shadow.> https://github.com/jangko/nimPNG/blob/master/apidoc.md |
14:21:06 | FromDiscord | <shadow.> spicy |
14:21:14 | FromDiscord | <shadow.> found the seq[uint8] docs |
14:21:19 | FromDiscord | <shadow.> wait |
14:21:21 | FromDiscord | <shadow.> uint8 |
14:21:27 | FromDiscord | <shadow.> isnt it uint32 for png pixels? |
14:21:32 | FromDiscord | <shadow.> rgba |
14:21:36 | FromDiscord | <shadow.> not png pixels lol |
14:21:42 | FromDiscord | <mratsim> uint8 because each r g b a is 8 bit |
14:21:54 | FromDiscord | <shadow.> ah yeah |
14:22:00 | FromDiscord | <shadow.> hm |
14:22:21 | FromDiscord | <shadow.> is there anywhere i can read just how to turn my sequence of rgb vectors into an image? |
14:22:29 | FromDiscord | <shadow.> shouldn't be too out of the ordinary right? |
14:22:49 | FromDiscord | <mratsim> it is an image |
14:22:53 | FromDiscord | <shadow.> wdym |
14:23:04 | FromDiscord | <shadow.> well yeah but |
14:23:09 | FromDiscord | <shadow.> how can i save it to a png in storage lol |
14:23:12 | FromDiscord | <shadow.> im use to ppm / bitmap bc |
14:23:22 | FromDiscord | <shadow.> i can write a ppm / bitmap writer myself in under 50 lines lol |
14:23:28 | kinkinkijkin | hey, 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:41 | FromDiscord | <mratsim> use nimpng or stdimage |
14:24:04 | kinkinkijkin | how is it that im "supposed" to do this? |
14:24:23 | kinkinkijkin | i can't find anything saying this approach is wrong except the commpiler so there's gotta be something i wrote wrong |
14:25:09 | FromDiscord | <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:10 | FromDiscord | <shadow.> yeah im using nimpng currently i just cant find docs |
14:26:02 | FromDiscord | <mratsim> write_png(filepath, width, height, num_colors, openarray[uint8]) |
14:26:08 | FromDiscord | <mratsim> for stb_image |
14:26:11 | FromDiscord | <shadow.> ohh ok |
14:26:13 | FromDiscord | <shadow.> that's pretty simple |
14:26:28 | FromDiscord | <shadow.> lemme check |
14:26:40 | FromDiscord | <shadow.> https://nimble.directory/pkg/stbimage |
14:26:41 | FromDiscord | <shadow.> this one? |
14:27:07 | FromDiscord | <shadow.> and would numcolors just be `0xffffff`? |
14:27:20 | * | leorize joined #nim |
14:27:22 | FromDiscord | <mratsim> it would be 3 |
14:27:30 | FromDiscord | <mratsim> you have RGB in your stuff |
14:28:09 | FromDiscord | <shadow.> ah |
14:28:10 | FromDiscord | <shadow.> 3 |
14:28:13 | FromDiscord | <shadow.> lmao |
14:28:15 | FromDiscord | <shadow.> i thought it meant color range |
14:28:47 | FromDiscord | <shadow.> stbimage it is |
14:29:36 | FromDiscord | <exelotl> For nimpng you have to make an encoder object and call `encodePNG` |
14:30:00 | FromDiscord | <exelotl> Example: https://github.com/exelotl/trick/blob/master/src/trick/gfxconvert.nim#L224 |
14:30:09 | FromDiscord | <shadow.> ah i see |
14:30:13 | FromDiscord | <shadow.> i only need lightweight stuff so |
14:30:17 | FromDiscord | <shadow.> stbimage makes more sense i think |
14:30:32 | FromDiscord | <exelotl> Yeah probs |
14:30:46 | FromDiscord | <shadow.> ima just do jpg |
14:30:48 | FromDiscord | <shadow.> i dont need alpha |
14:37:56 | FromDiscord | <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:29 | FromDiscord | <shadow.> nvm i think i got it |
14:56:15 | FromDiscord | <lqdev> theres savePNG24 and savePNG32 tho so making an encoder is overkill |
14:56:37 | FromDiscord | <exelotl> aha |
14:57:09 | * | abm joined #nim |
15:04:34 | * | waleee-cl joined #nim |
15:04:56 | FromDiscord | <shadow.> ah wait a minute |
15:05:01 | FromDiscord | <shadow.> my rgb is in float64 form lol |
15:05:07 | FromDiscord | <shadow.> im guessing stb wants it as 0-255? |
15:05:14 | FromDiscord | <shadow.> uint8? |
15:05:39 | FromDiscord | <shadow.> `(unsigned char)(std::min(float(1), image[i].x) 255)` |
15:05:41 | FromDiscord | <shadow.> im guessing that's that part |
15:06:34 | * | PMunch quit (Quit: leaving) |
15:08:19 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/796757107767640084/unknown.png |
15:08:21 | FromDiscord | <shadow.> ok so i dont think it worked. |
15:08:29 | FromDiscord | <shadow.> lmfaoo |
15:08:33 | * | BT40 joined #nim |
15:10:04 | BT40 | Hi. 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:29 | FromDiscord | <shadow.> you mean like straight from nim to machine code? |
15:10:32 | FromDiscord | <shadow.> not that i know of |
15:10:46 | FromDiscord | <shadow.> tho i find c compilation at least more of a blessing than a downfall |
15:10:54 | FromDiscord | <shadow.> you get the power of c plus ffi and other cool stuff |
15:11:44 | qwr | default 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:44 | FromDiscord | <shadow.> (edit) removed "at least" |
15:12:16 | qwr | s/if/unless/ |
15:13:16 | narimiran | Quick reminder: if you haven't already, please fill our annual community survey: https://forms.gle/kEWvEeVyfxSHq9Uj8 |
15:15:46 | BT40 | thanks |
15:15:47 | * | BT40 quit (Remote host closed the connection) |
15:22:57 | FromDiscord | <shadow.> rip |
15:22:59 | FromDiscord | <shadow.> raytracer is dying |
15:23:02 | FromDiscord | <shadow.> must fix |
15:23:21 | FromDiscord | <shadow.> lol |
15:23:45 | * | hmmm quit (Quit: WeeChat 3.0) |
15:24:20 | FromDiscord | <mratsim> @BT40 you can use nlvm to compile directly to LLVM IR |
15:24:38 | FromDiscord | <shadow.> how complete is nlvm? |
15:24:44 | FromDiscord | <shadow.> and how efficient vs c backend? |
15:26:35 | FromGitter | <HJarausch_gitlab> A dump question. What to put into my local nim.cfg file to make all nimble-installed packages *importable* |
15:27:03 | FromDiscord | <lqdev> narimiran: when are the test results gonna be announced? |
15:27:06 | FromDiscord | <Rika> ? all nimble (locally) installed packages should be importable |
15:28:09 | FromDiscord | <mratsim> It works except for importc and emit. |
15:28:15 | FromDiscord | <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:17 | FromDiscord | <shadow.> fair enogu h |
15:28:19 | FromDiscord | <shadow.> (edit) "enogu h" => "enough" |
15:28:19 | FromGitter | <HJarausch_gitlab> ``nim dump`` doesn't show these and I cannot import these. E.g., I had nimble install ``fusion@#master`` but |
15:28:32 | FromDiscord | <mratsim> not sure about the speed, we mostly benchmarked code size for codegolfing WASM compilation, not speed |
15:28:38 | FromDiscord | <shadow.> ohh fair enough |
15:28:41 | FromGitter | <HJarausch_gitlab> but ``import astdsl`` fails |
15:29:05 | FromDiscord | <flywind> !eval import fusion/astdsl |
15:29:08 | NimBot | <no output> |
15:29:16 | FromDiscord | <mratsim> I think it's fast, because we can model more closely nim semantics (let vs var for example) |
15:29:46 | FromDiscord | <shadow.> ah yeah fair |
15:29:55 | narimiran | @lqdev depends on when we decide "ok, that's enough votes" |
15:30:19 | FromDiscord | <flywind> you need to use `fusion` prefix |
15:30:22 | FromDiscord | <mratsim> After 3 years of usage, I'm not really worried about the raw speed of Nim with any backend. |
15:30:28 | FromDiscord | <lqdev> @flywind it's used for the --nimVersion flag |
15:30:29 | FromDiscord | <mratsim> 4 actually |
15:30:39 | FromGitter | <HJarausch_gitlab> @flywind Thanks! |
15:30:45 | FromDiscord | <flywind> np |
15:32:03 | FromDiscord | <flywind> I see, thanks |
15:33:42 | narimiran | currently we have less votes than last year, so we're waiting a bit more |
15:59:51 | * | hnOsmium0001 joined #nim |
16:00:28 | Araq | lol I'm so stupid |
16:00:43 | Araq | guess what... if you load a .nim file as .rod file it cannot work. |
16:00:52 | Araq | one is a text file, the other an optimized binary format |
16:00:57 | Araq | XD |
16:01:00 | FromDiscord | <Rika> we all have our moments |
16:01:42 | Araq | and 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:58 | FromDiscord | <mratsim> is .rod the mysterious Nim IR? |
16:16:09 | FromDiscord | <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:18 | FromDiscord | <shadow.> what's the typical rand() function in random? like standard random flaot |
16:16:19 | FromDiscord | <shadow.> (edit) "flaot" => "float" |
16:16:21 | * | Tlangir quit (Remote host closed the connection) |
16:16:31 | FromDiscord | <mratsim> rand() |
16:16:37 | FromDiscord | <shadow.> with no arguments? |
16:16:44 | FromDiscord | <haxscramper> Why nightly builds are not available on playground? |
16:16:46 | FromDiscord | <mratsim> with a max value |
16:16:57 | FromDiscord | <mratsim> rand(1.0) if you want between 0 and 1 |
16:17:01 | FromDiscord | <shadow.> kk thanks |
16:17:16 | FromDiscord | <mratsim> if the documentation is unclear, PR something better |
16:17:39 | FromDiscord | <shadow.> nah its good im just dum |
16:19:02 | FromDiscord | <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:13 | leorize | haxscramper: PMunch uses the nim docker images for the playground and nightlies don't build them |
16:27:20 | Araq | mratsim: 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:55 | FromDiscord | <mratsim> you don't happen to use CPS as your IR btw? I heard that's the IR of functional languages π |
16:28:14 | Araq | no, I use good old ASTs |
16:28:23 | Araq | read the book about CPS |
16:28:29 | Araq | *I read |
16:28:39 | Araq | yeah, the physical one, old school. |
16:29:06 | disruptek | what kinda dinosaur are you? |
16:29:10 | FromDiscord | <mratsim> the IR would be nice to produce cuda code |
16:29:17 | disruptek | i think i may be a stegasaurus. |
16:29:35 | Araq | it's great for async but already CSE is harder with CPS |
16:30:06 | Araq | (Common subexpression elimination. There is nothing "common" among expression, they all have different continuations) |
16:30:39 | FromDiscord | <mratsim> I've seen an article that did CSE that were "revealed" by CPS |
16:30:45 | FromDiscord | <mratsim> or maybe it was constant folding |
16:32:00 | disruptek | we have a cps test that is like 20 lines of nim or less. and it generates like 15k lines of code. |
16:33:19 | FromDiscord | <mratsim> I have a concept that generate 200k lines of code in 10 lines |
16:34:17 | FromDiscord | <mratsim> https://github.com/nim-lang/Nim/issues/13982#issuecomment-614081693 |
16:34:19 | disbot | β₯ Concepts building on each other: duplicated procs in C codegen ; snippet at 12https://play.nim-lang.org/#ix=2y08 |
16:34:23 | disruptek | ah, it's only 9147 lines. |
16:34:30 | FromDiscord | <mratsim> I think this is the same rootcause |
16:34:36 | FromDiscord | <mratsim> concepts instantiation is not cached |
16:34:48 | * | lritter joined #nim |
16:34:51 | FromDiscord | <mratsim> so you have one proc per call site :/ |
16:34:58 | FromDiscord | <lqdev> yeah that sucks |
16:35:14 | FromDiscord | <lqdev> i wish concepts had more care put into them |
16:35:24 | * | Vladar quit (Quit: Leaving) |
16:35:29 | disruptek | have you tried the new impl? |
16:35:35 | FromDiscord | <lqdev> not yet |
16:35:49 | FromDiscord | <lqdev> is the new impl faster to compile? |
16:36:00 | Araq | should be |
16:36:10 | Araq | but the new impl comes with new syntax too |
16:36:17 | disruptek | i 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:19 | Araq | so you need to patch your code |
16:36:19 | FromDiscord | <lqdev> yeah that's one of my concerns |
16:36:34 | FromDiscord | <mratsim> the new impl of CPS or of concepts? |
16:36:36 | FromDiscord | <lqdev> the new syntax is a bit more limited and wouldn't work with fields |
16:37:12 | FromDiscord | <mratsim> it took me hours to get co-recursive concepts working across the generics typesystem :/ |
16:37:23 | FromDiscord | <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:33 | disruptek | me too. |
16:37:38 | FromDiscord | <Rika> me three |
16:37:43 | disruptek | i'm all about natural width. |
16:37:43 | FromDiscord | <lqdev> it makes retro-fitting code much easier |
16:37:43 | FromDiscord | <mratsim> I have yet to fix the mess of Travis CI, I don't want to spend hours fixing concepts again |
16:37:59 | FromDiscord | <lqdev> well it should be positive width but you get the idea |
16:38:17 | disruptek | nimph-2.0 is blocked by concepts being so broken that they literally cannot be reasoned about. |
16:38:54 | * | Vladar joined #nim |
16:39:06 | FromDiscord | <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:24 | Araq | accepting fields would be rather easy to add for the new concepts |
16:39:26 | disruptek | it's hard to have a bug when you don't have a spec. |
16:39:29 | greenfork | hi, is it possible to have a sequence of static strings? this doesn't work: `const strs: seq[static string] = @["a", "b"]` |
16:39:33 | FromDiscord | <mratsim> "small annoyances", begone unbeliever |
16:39:48 | FromDiscord | <lqdev> greenfork: remove the static |
16:39:49 | FromDiscord | <mratsim> @greenfork use a static seq[string] |
16:39:58 | FromDiscord | <mratsim> const don't need static |
16:40:03 | FromDiscord | <lqdev> and then it's a static seq[string] implicitly because it's a const |
16:40:09 | disruptek | mratsim: have you done any testing of typed cps? |
16:40:21 | FromDiscord | <lqdev> wdym |
16:40:24 | FromDiscord | <mratsim> my fork is building on typed CPS |
16:40:35 | greenfork | mratsim, static seq[string] throws invalid type: 'static[seq[string]](["a", "b"])' for const |
16:40:42 | FromDiscord | <mratsim> https://github.com/nim-lang/RFCs/issues/44 @lqdev |
16:40:43 | disbot | β₯ [RFC] Working with types in macro is difficult. |
16:40:51 | FromDiscord | <lqdev> greenfork: remove the static. |
16:41:14 | greenfork | lqdev, unfortunately it is not a static string, and I want to use it with `scanf` and `scanf` requires a static string |
16:41:18 | FromDiscord | <mratsim> even in the past week I have been fighting against compiler bugs with types in amcro |
16:41:32 | FromDiscord | <lqdev> greenfork: sounds like a bug |
16:41:40 | FromDiscord | <lqdev> everything in a const should be static |
16:41:55 | FromDiscord | <lqdev> maybe you're indexing it at runtime? |
16:42:14 | FromDiscord | <mratsim> generic sandwiches are a pain: https://github.com/status-im/nimbus-eth2/commit/3366b75236badeb1438244ec2e7404e7fbedbed7 |
16:42:15 | * | hmmm quit (Client Quit) |
16:42:21 | FromDiscord | <lqdev> or try wrapping your expression in static(), like static(strs[0]) |
16:42:36 | greenfork | I do indexing a sequence at runtime but the string itself should still be static nevertheless |
16:42:38 | FromDiscord | <mratsim> you need dumb workaround like this for types in macro: https://github.com/status-im/nimbus-eth2/commit/ce0f7af862a5319a49e74ef3539d9ad8016e181d#diff-87fccb357b8ac917d13b924edd97ae5ce2d9ae2075c800754a5e7110ca92ef7cR165 |
16:42:42 | disruptek | mratsim: where is your fork? |
16:42:55 | Araq | greenfork, that's not how scanf works... or the language |
16:43:13 | FromDiscord | <mratsim> this one @disruptek: https://github.com/disruptek/cps/tree/mratsim-public-api-proposal |
16:43:13 | FromDiscord | <lqdev> greenfork: well the parameter must be static but indexing at runtime is not static |
16:43:19 | disruptek | oh. |
16:43:23 | FromDiscord | <lqdev> static means compile-time |
16:43:37 | disruptek | yeah, it's a complete non-starter imo. |
16:44:13 | FromDiscord | <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:18 | greenfork | lqdev Araq, yeah I think I know what you mean, thanks! |
16:44:45 | Araq | [RFC] Junk is broken is not an RFC btw. Usually RFCs have some vague ideas how to improve the situation |
16:45:09 | disruptek | at least. |
16:46:12 | FromDiscord | <mratsim> Well, you said that it's too hard to improve |
16:46:58 | FromDiscord | <mratsim> I ask for a way to convert NimNode to type/typedesc but the request was closed |
16:47:06 | FromDiscord | <mratsim> rudely I might say |
16:47:20 | FromDiscord | <mratsim> https://github.com/nim-lang/Nim/issues/6785 |
16:47:27 | Araq | sorry about that, that was long ago though |
16:47:54 | FromDiscord | <mratsim> it was not you there |
16:49:10 | Araq | I'm sorry anyway |
16:49:41 | Araq | generic sandwiches ... had a solution for these |
16:49:44 | disruptek | mratsim: Error: node has no type |
16:49:50 | disruptek | are you sure this is based on typed? |
16:50:04 | Araq | requires IC, more or less |
16:51:06 | FromDiscord | <mratsim> @disruptek are you talking about CPS? |
16:51:15 | Araq | bbl |
16:51:19 | disruptek | yes? |
16:51:53 | FromDiscord | <mratsim> it's unclear because it's there as well: https://github.com/nim-lang/RFCs/issues/44#issuecomment-385484106 |
16:51:53 | disbot | β₯ [RFC] Working with types in macro is difficult. |
16:52:03 | FromDiscord | <mratsim> where do you get this node has no type? |
16:53:24 | disruptek | i think it's ex06. |
16:54:02 | * | tane joined #nim |
16:54:47 | disruptek | are there tests or just these few examples? |
16:54:49 | FromDiscord | <mratsim> works for me https://media.discordapp.net/attachments/371759389889003532/796783913304588308/unknown.png |
16:55:09 | FromDiscord | <mratsim> those are examples to make sure that what I propose isn't just hot air |
16:55:24 | FromDiscord | <mratsim> it even works on v1.4.2 |
16:55:34 | disruptek | rm the : int; that's the whole idea. |
16:55:59 | FromDiscord | <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:02 | disruptek | anyway, i'm just not willing to use a cps in which i cannot return an arbitrary continuation. |
16:56:26 | FromDiscord | <mratsim> you can |
16:56:30 | disruptek | try rebasing to get "node has no type" fix. |
16:56:33 | FromDiscord | <mratsim> "bindCallerContinuation" gives you that |
16:56:37 | FromDiscord | <lqdev> the 2020 araq feels like more of a down-to-earth technicalist |
16:57:08 | FromDiscord | <mratsim> ah I see |
16:57:11 | FromDiscord | <lqdev> which is not a bad thing ofc |
16:57:17 | FromDiscord | <mratsim> yeah I didn't work on CPS the past week |
16:57:18 | disruptek | also, what's the point of all these files and directories with nothing in them? |
16:57:28 | FromDiscord | <mratsim> what "all"? |
16:57:42 | disruptek | ξ mratsim-public-apβ¦posal *+1/-1 $2 ξ° cps ξ° cat core.nim Thu 11:57 |
16:57:42 | FromDiscord | <mratsim> only stdlib has only a readme |
16:57:45 | disruptek | import core/public_api |
16:57:47 | disruptek | export public_api |
16:58:02 | disruptek | that shit is just annoying. |
16:58:17 | FromDiscord | <mratsim> well, why do you mix scheduling with cps transformation |
16:58:21 | FromDiscord | <mratsim> that shit is just annoying |
16:58:24 | FromDiscord | <mratsim> there I said it |
16:58:31 | disruptek | because it's hard to demo cps without a scheduler. |
16:58:33 | FromDiscord | <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:42 | FromDiscord | <lqdev> yeeeeah |
16:58:50 | disruptek | where do we mix scheduling with the transform? |
16:58:57 | greenfork | more 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:57 | FromDiscord | <lqdev> i think i experienced that myself |
16:59:00 | FromDiscord | <mratsim> eventqueue |
16:59:10 | FromDiscord | <mratsim> and semaphores |
16:59:10 | disruptek | well, duh. |
16:59:13 | disruptek | it's a scheduler. |
16:59:22 | disruptek | greenfork: for loops are already unrolled. |
16:59:24 | FromDiscord | <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:27 | disruptek | that's their defining characteristic. |
16:59:41 | greenfork | disruptek, so should my example compile? https://play.nim-lang.org/#ix=2Lby |
17:00:34 | FromDiscord | <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:03 | disruptek | we've said that numerous times in the README. |
17:01:17 | FromDiscord | <mratsim> But I want to show that in the code structure as well |
17:01:19 | disruptek | when it's working, we'll move the scheduler out. |
17:01:28 | disruptek | i dunno what that statement means. |
17:01:31 | FromDiscord | <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:58 | FromDiscord | <haxscramper> In your example you have regular `for` loop that of course loses `static` qualifier on variable of iteration |
17:02:06 | FromDiscord | <haxscramper> `fields()` on the other hand unrolls the loop |
17:02:11 | FromDiscord | <lqdev> slick tricks in the Nim programming language |
17:02:19 | FromDiscord | <lqdev> somebody needs to make a book out of this |
17:02:39 | disruptek | nim obfuscation? |
17:02:48 | FromDiscord | <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:35 | FromDiscord | <mratsim> one is for ranges and the overs is for an array of enums. |
17:03:40 | FromDiscord | <mratsim> other |
17:04:02 | greenfork | haxscramper, yeah this works for tuples, good enough, thanks! |
17:04:36 | FromDiscord | <haxscramper> we have https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features |
17:04:47 | FromDiscord | <haxscramper> Yeah, I should add this one |
17:05:19 | * | letto joined #nim |
17:05:42 | FromDiscord | <haxscramper> greenfork: for the record - what was your use case with scanf? |
17:05:47 | greenfork | mratsim, this one is cool, thanks! |
17:06:17 | disruptek | Zevv: had some bandwidth issues last night, but yes, the codegen is not ideal. |
17:06:37 | disruptek | will probably fix it with a move today. |
17:08:10 | greenfork | haxscramper, 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:35 | FromDiscord | <Randall> Is it possible to create a module (namespace really) using a macro? |
17:09:28 | disruptek | only by statically creating a file and then importing it. |
17:10:26 | FromDiscord | <Randall> Hmm so if module A creates module B, would it be easy for module C to reference B? |
17:11:35 | disruptek | as easy as any other module reference. |
17:11:42 | disruptek | modules are files. |
17:11:49 | disruptek | .nim files are modules. |
17:12:10 | disruptek | i think i'm going to need coffee to continue with this. |
17:13:02 | FromDiscord | <haxscramper> ~features |
17:13:03 | disbot | features: 11begin in the unfortunate state of /unimplemented/ |
17:13:11 | FromDiscord | <mratsim> lol |
17:20:04 | * | Jesin quit (Quit: Leaving) |
17:20:28 | FromDiscord | <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:11 | greenfork | c2nim 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:41 | FromDiscord | <shadow.> @ElegantBeef |
18:09:48 | FromDiscord | <shadow.> your constructor fixes this right? |
18:09:48 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Lc3 |
18:10:19 | FromDiscord | <shadow.> !repo constructor |
18:10:20 | disbot | https://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:22 | FromDiscord | <shadow.> fun |
18:11:58 | FromDiscord | <mratsim> It's dangerous because when parameter passing Nim pass by hidden reference large structs (more than 3 pointer sizes) |
18:12:25 | FromDiscord | <mratsim> for FFI you want to use exactly what the C/C++ proc expects |
18:14:02 | greenfork | mratsim, I see I see |
18:14:57 | FromDiscord | <shadow.> @ElegantBeef one thing i found |
18:15:09 | FromDiscord | <shadow.> it seems to not recognize y and z |
18:15:11 | FromDiscord | <shadow.> unless i put them on dif lines |
18:15:12 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Lc6 |
18:15:13 | FromDiscord | <shadow.> using constructor |
18:15:41 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Lc7 |
18:18:05 | FromDiscord | <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:18 | FromDiscord | <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:36 | FromDiscord | <treeform> I never understood why nim's default constructor used : instead of = |
18:47:00 | FromDiscord | <treeform> `Point(x:1, y:2)` vs `Point(x=1, y=2)` |
18:47:46 | FromDiscord | <treeform> I also never understood why I can't just create `proc Point(...)` |
18:47:48 | greenfork | same, I frequently confuse it |
18:47:59 | FromDiscord | <haxscramper> Because it would require semantic information to differentiate between type constructor and function call? |
18:48:51 | FromDiscord | <treeform> I wish nim allowed function names be same as type names. |
18:48:57 | FromDiscord | <shadow.> hmm |
18:49:01 | FromDiscord | <shadow.> wouldn't that allow identifier names to be the same? |
18:49:11 | FromDiscord | <shadow.> and then you could do `var Point: Point` and such? |
18:49:17 | FromDiscord | <shadow.> which might be |
18:49:17 | FromDiscord | <shadow.> bad |
18:49:19 | FromDiscord | <haxscramper> This would certainly compilate things beyond measure |
18:49:53 | FromDiscord | <haxscramper> Now you can't even know if you are constructing an object or calling function without previously compiling all code above |
18:50:10 | Oddmonger | marshaling in nim doesn't save the object definition ? |
18:50:21 | FromDiscord | <treeform> But constructing an object is calling function (at some level)? |
18:52:27 | FromDiscord | <shadow.> im tryna recreate `erand48(xi)` in nim, would `randomize(); rand(1.0)` do the same? |
18:52:35 | FromDiscord | <shadow.> (edit) "im tryna recreate ... `erand48(xi)`" added "cpp's" |
18:53:17 | FromDiscord | <shadow.> im translating a raytracer and im not sure if xi is a seed or something more relevant |
18:53:50 | FromDiscord | <Daniel> Is there usable Glade for nim? |
18:58:01 | FromDiscord | <Meowz> How can I return early from an iterator if `return` is not not be used? |
18:58:12 | FromDiscord | <Meowz> (edit) "is not" => "can" |
18:58:19 | FromDiscord | <haxscramper> `break` out of the loop |
18:58:53 | * | pixtum[m] left #nim ("User left") |
18:59:45 | FromDiscord | <Meowz> I actually want that the iterator yields nothing on a specific condition |
19:00:56 | disruptek | use the `not` operator. |
19:08:36 | * | habamax quit (Ping timeout: 240 seconds) |
19:19:03 | ForumUpdaterBot | New 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:41 | reversem3 | https://play.nim-lang.org/#ix=2LcA -- Getting Errno 9 'Bad File Description' |
19:31:20 | FromDiscord | <shadow.> `Warning: JSON processing failed: cannot open: C:\Users\shado\Desktop\nim\Nimpaca\main.nim` |
19:31:22 | FromDiscord | <shadow.> why does this happen |
19:31:23 | FromDiscord | <shadow.> every time i go |
19:31:25 | FromDiscord | <shadow.> to compile anything |
19:31:27 | FromDiscord | <shadow.> π |
19:31:39 | disruptek | you're on windows. |
19:31:45 | FromDiscord | <shadow.> ok. |
19:31:52 | FromDiscord | <shadow.> @Quibono i blame you |
19:32:14 | FromDiscord | <Quibono> Nimβs feeling cheated on with all the rust youβve been doing. |
19:32:28 | greenfork | can 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:05 | disruptek | what does the compiler say? |
19:33:14 | greenfork | in 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:48 | disruptek | obviously, that doesn't match the signature you pasted. |
19:33:49 | * | narimiran quit (Ping timeout: 264 seconds) |
19:34:10 | greenfork | Error: type mismatch: got <int or int32> but expected 'uint8' -- compiler error |
19:34:37 | disruptek | ~disrupstyle |
19:34:38 | disbot | disrupstyle: 11tips for writing code that won't provoke π rants π€¬ on irc: https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d -- disruptek |
19:34:47 | greenfork | disruptek, 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:14 | disruptek | r,g,b,a are of the same type in your signature. |
19:35:20 | disruptek | int and int32 are not the same type. |
19:35:54 | greenfork | I see, let me try to fix it |
19:38:06 | FromDiscord | <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:03 | FromDiscord | <shadow.> if the if fails then it would be returned? |
19:39:12 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LcG |
19:39:17 | FromDiscord | <shadow.> (edit) "returned?" => "returned right?" |
19:40:47 | FromDiscord | <shadow.> nvm ill write it out |
19:41:24 | greenfork | disruptek, so here is still not compiling example, am I doing something wrong? https://play.nim-lang.org/#ix=2LcH |
19:42:24 | disruptek | yes, you're using a converter and you're defining a tuple type. |
19:42:33 | greenfork | exelotl, I do interfacing with C and sadly have to work with int32 because it is a standard `int` in C |
19:43:01 | greenfork | disruptek, am I punished for using Nim features? |
19:43:10 | disruptek | by me? yes. |
19:43:22 | greenfork | mercy |
19:43:24 | disruptek | sadly, i'm not the arbiter of compiler features. |
19:44:02 | FromDiscord | <shadow.> any way i can pass a literal as a view |
19:44:21 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LcI |
19:45:25 | FromDiscord | <exelotl> I don't think there's any other way than that |
19:46:12 | FromDiscord | <lqdev> ptr? |
19:46:35 | FromDiscord | <lqdev> that's the only way i can think of but it's not idiomatic |
19:47:07 | FromDiscord | <shadow.> ah fair fair |
19:47:44 | FromDiscord | <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:30 | FromDiscord | <lqdev> everything must have an address in C tho which is why it would work with ptr |
19:48:40 | FromDiscord | <shadow.> fair enough |
19:48:54 | FromDiscord | <lqdev> &1 works fine in C if you're passing to a function |
19:49:03 | FromDiscord | <lqdev> tho i'm not sure how codegen would handle it |
19:49:45 | FromDiscord | <mratsim> constants are for most of them inlined at usage site |
19:50:53 | FromDiscord | <shadow.> im just passing 0 |
19:50:59 | FromDiscord | <shadow.> i dont care abt mutation bc the only mutation is recursive |
19:51:00 | FromDiscord | <shadow.> but its fine lol |
19:51:02 | FromDiscord | <shadow.> ill just do |
19:51:04 | FromDiscord | <shadow.> `var depth = 0` |
19:51:13 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/796828305877368863/unknown.png |
19:51:15 | FromDiscord | <shadow.> wow my raytracer |
19:51:17 | FromDiscord | <shadow.> is working so beautifully |
19:51:24 | FromDiscord | <shadow.> lol |
19:51:32 | FromDiscord | <mratsim> Fade in black |
19:51:37 | FromDiscord | <shadow.> lmao |
19:51:39 | disruptek | it's probably night where you are. |
19:51:46 | FromDiscord | <shadow.> of course |
19:51:48 | FromDiscord | <mratsim> it happened to me when I was rebounding infinity rays |
19:51:48 | FromDiscord | <shadow.> its 2:51pm |
19:51:49 | FromDiscord | <exelotl> Sounds like you're misusing var params? |
19:51:55 | FromDiscord | <shadow.> eh there's prolly just |
19:51:57 | FromDiscord | <shadow.> some miscalculation |
19:51:59 | FromDiscord | <shadow.> somewhere |
19:52:00 | FromDiscord | <shadow.> some mistype lol |
19:52:22 | FromDiscord | <exelotl> sent a code paste, see https://paste.rs/JLV |
19:52:26 | FromDiscord | <shadow.> im prolly messing up `^` operator precedence or something |
19:52:39 | FromDiscord | <lqdev> fade to gray, colorblind ~~nobody will get that reference but i had to say that~~ |
19:55:02 | FromDiscord | <shadow.> i basically just translated smallpt to nim lol |
19:55:13 | FromDiscord | <shadow.> idk why its just black |
19:55:23 | FromDiscord | <mratsim> smallpt is unreadable |
19:55:27 | FromDiscord | <shadow.> yep. |
19:55:35 | FromDiscord | <mratsim> there are a couple of warnings I noted in my own translation |
19:56:00 | FromDiscord | <mratsim> number one: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L27-L30 |
19:56:25 | FromDiscord | <mratsim> number two: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L205 |
19:56:34 | FromDiscord | <mratsim> lost a hour easy on that |
19:56:42 | FromDiscord | <shadow.> oh damn lemme look at that |
19:56:52 | FromDiscord | <shadow.> ah fuck that's it. |
19:56:56 | FromDiscord | <shadow.> the normalize thing is part of it |
19:57:04 | FromDiscord | <shadow.> bc im just using glm |
19:57:08 | FromDiscord | <shadow.> which prolly doesnt mutate |
19:57:56 | FromDiscord | <mratsim> number 3: https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L176-L181 |
19:58:13 | FromDiscord | <mratsim> C++ resolves from right to left and makes a complex one-liner that depends on it |
19:58:42 | FromDiscord | <shadow.> the only part that the normalizing matters is on d rihgt? |
19:58:46 | FromDiscord | <shadow.> the rest are all temporary |
19:59:04 | FromDiscord | <shadow.> nvm |
19:59:06 | FromDiscord | <shadow.> i got it |
19:59:09 | FromDiscord | <mratsim> I did that 8 months ago |
19:59:12 | FromDiscord | <shadow.> rip |
19:59:22 | FromDiscord | <shadow.> wait so |
19:59:29 | FromDiscord | <shadow.> i should make it mutate in place? |
19:59:48 | FromDiscord | <mratsim> I don't use in-place mutation, I just reorganized the code |
19:59:54 | FromDiscord | <mratsim> not here at least |
20:00:07 | FromDiscord | <shadow.> ohh |
20:00:08 | FromDiscord | <shadow.> i see |
20:00:13 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LcN |
20:02:38 | FromDiscord | <mratsim> so it's not black anymore? |
20:02:55 | FromDiscord | <mratsim> you can temporarily remove the glass spheres to avoid all black |
20:03:26 | FromDiscord | <shadow.> lemme check |
20:03:50 | FromDiscord | <shadow.> how many samples do i need |
20:03:52 | FromDiscord | <shadow.> for it to be not black |
20:04:26 | greenfork | disruptek, btw interesting notes on the Nim style. I disagree with half of it but interesting nonetheless |
20:04:29 | FromDiscord | <shadow.> hmm well |
20:04:31 | FromDiscord | <shadow.> we have a slight issue |
20:04:38 | FromDiscord | <shadow.> my c++ doesnt have erand48 lol |
20:04:41 | FromDiscord | <shadow.> im guessing it's posix or something? |
20:05:05 | FromDiscord | <mratsim> no |
20:05:06 | FromDiscord | <mratsim> https://github.com/mratsim/weave/blob/master/demos/raytracing/smallpt.nim#L104-L112 |
20:05:14 | FromDiscord | <mratsim> C++ stdlib.h |
20:05:43 | FromDiscord | <shadow.> ohhh i see |
20:05:55 | FromDiscord | <shadow.> i just used rand(1.0) that definitely is not working π |
20:06:00 | FromDiscord | <shadow.> lmfaoo |
20:06:03 | FromDiscord | <shadow.> time to use erand |
20:06:35 | FromDiscord | <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:41 | FromDiscord | <lqdev> i use it for system procs only |
20:07:29 | greenfork | you have a lot of in common in terms of style then :) |
20:07:39 | greenfork | a rare thing in software engineering |
20:13:49 | FromDiscord | <lqdev> i mean there isn't much you can mess up wrt stylng in nim |
20:14:05 | FromDiscord | <lqdev> though some users just won't follow commonly accepted guidelines |
20:15:34 | FromDiscord | <mratsim> you can create a macro that secretly tag wrong calls as raises:[] or nosideeffect so that they don't compile. |
20:15:39 | FromDiscord | <Meowz> Hey whats wrong with `"config.json".write_file((% s).pretty())` |
20:16:04 | greenfork | it 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:58 | FromDiscord | <lqdev> what pisses me off more is weird spacing around : and = |
20:17:21 | FromDiscord | <lqdev> `a :int, b :int` come on... |
20:17:29 | FromDiscord | <mratsim> what? |
20:17:33 | FromDiscord | <mratsim> I've never seen that |
20:17:40 | greenfork | eyes hurt |
20:17:43 | FromDiscord | <lqdev> i did see some code in the wild that does that |
20:17:53 | FromDiscord | <Meowz> o_O |
20:17:58 | disruptek | blame beef. |
20:18:12 | FromDiscord | <mratsim> !repo beef |
20:18:13 | disbot | https://github.com/beefproject/beef -- 9beef: 11The Browser Exploitation Framework Project 15 5440β 1307π΄ 7& 29 more... |
20:18:14 | disruptek | lqdev: which single-param calls don't you agree with? |
20:18:24 | FromDiscord | <haxscramper> Looks like lisp property list |
20:18:28 | FromDiscord | <lqdev> disruptek: `thing x` |
20:18:37 | FromDiscord | <haxscramper> I bet someone is was very high on LISP and the came to nim |
20:18:43 | disruptek | like what in particular? |
20:18:47 | FromDiscord | <lqdev> i don't use them because my editor ext is too simplistic to be able to highlight them |
20:18:52 | disruptek | ahh. |
20:19:04 | FromDiscord | <lqdev> so i do `thing(x)` like it's 2018 or something |
20:19:15 | disruptek | highlighting calls versus vars is a big help. |
20:19:18 | disruptek | highly recommended. |
20:19:44 | FromDiscord | <lqdev> difficult to do with lite's limited highlighting engine |
20:19:54 | disruptek | not my problem. |
20:19:58 | FromDiscord | <lqdev> though i guess i could substitute it with my own... π€ |
20:20:09 | FromDiscord | <lqdev> gotta make a nim parser in lua |
20:20:15 | FromDiscord | <mratsim> and call it light |
20:21:24 | FromDiscord | <shadow.> `undefined reference to erand48` |
20:21:28 | * | aenesidemus_ quit (Read error: Connection reset by peer) |
20:21:49 | FromDiscord | <shadow.> yikey |
20:23:17 | FromDiscord | <shadow.> i can prolly use uniform_real_distribution right |
20:23:40 | FromDiscord | <shadow.> you said remove glass to debug? |
20:24:07 | leorize[m] | @lqdev just ask nimsuggest to highlight it |
20:24:43 | leorize[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:57 | FromDiscord | <lqdev> and wait 10 seconds until it gets highlighted? no thanks |
20:25:26 | FromDiscord | <lqdev> until nimsuggest receives the promised perf boosts from IC i'm not touching it with a ten foot pole |
20:25:56 | FromDiscord | <lqdev> my rather simplistic highlighting plugin is good for now |
20:26:29 | leorize[m] | you can give it some basic coloring then just have nimsuggest fill in when it has the highlights |
20:26:45 | leorize[m] | that's what nim.nvim do for the most part |
20:26:57 | FromDiscord | <lqdev> still would feel too sluggish for my taste |
20:26:57 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2LcX |
20:27:25 | FromDiscord | <mratsim> @shadow. yeah raytracing monte carlo doesn't care that much about the rng quality |
20:27:39 | FromDiscord | <shadow.> wait so |
20:27:42 | FromDiscord | <shadow.> why cant i use rand(1.0)? |
20:27:45 | FromDiscord | <Meowz> Could I code stuff in Nim for windows' kernel mode? What I'm interested for is: https://github.com/Zer0Mem0ry/KernelReadWriteMemory |
20:27:49 | FromDiscord | <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:10 | FromDiscord | <shadow.> is rand(1.0) not uniform distribution? |
20:28:21 | FromDiscord | <mratsim> @Meowz basic rule is if you can do it in C you can do it in Nim |
20:28:59 | FromDiscord | <Meowz> mkay, but I guess no one tried that yet. And I'm a nim newbie ;D |
20:29:10 | FromDiscord | <mratsim> maybe look into this repo https://github.com/byt3bl33d3r/OffensiveNim |
20:29:38 | * | superbia joined #nim |
20:30:20 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2Ld1 |
20:30:26 | FromDiscord | <shadow.> lol i swear you've written everything into weave |
20:30:33 | FromDiscord | <mratsim> it's just a matter of finding where they hide in Microsoft documentation |
20:30:34 | FromDiscord | <shadow.> weave is just nim by example on steroids |
20:31:01 | FromDiscord | <shadow.> so do you think rand(1.0) could work? |
20:31:09 | FromDiscord | <shadow.> or does xi have some important relevance? |
20:31:13 | FromDiscord | <mratsim> Note that sometimes Windows doc lie about what dll provides what |
20:31:15 | FromDiscord | <mratsim> nop |
20:31:21 | FromDiscord | <mratsim> xi is just the RNG state |
20:31:24 | FromDiscord | <shadow.> ohh right |
20:31:26 | FromDiscord | <mratsim> rand1.0 would work |
20:31:27 | FromDiscord | <shadow.> so like instead of something like |
20:31:29 | FromDiscord | <shadow.> time(0) |
20:31:29 | FromDiscord | <shadow.> lol ye |
20:31:41 | FromDiscord | <shadow.> should i randomize(y ^ 3) or nah |
20:31:46 | FromDiscord | <mratsim> a scheduler is a laaaaarrggeee piece of code if you want it general enough |
20:31:57 | FromDiscord | <mratsim> or you can make just a queue if you want but that doesn't scale |
20:32:09 | FromDiscord | <mratsim> works fine if your tasks are in the 200ms though |
20:32:58 | FromDiscord | <shadow.> nvm i get what u mean |
20:33:00 | FromDiscord | <shadow.> kk ima try it |
20:34:52 | FromDiscord | <shadow.> still black ;-; |
20:37:27 | FromDiscord | <mratsim> good luck have fun π |
20:37:30 | FromDiscord | <shadow.> lmfaooo |
20:37:39 | * | Gustavo6046 quit (Quit: ZNC 1.7.5 - https://znc.in) |
20:37:47 | FromDiscord | <mratsim> debugging raytracing is tough because it's hard to make test for graphics rendering |
20:37:57 | FromDiscord | <mratsim> I'm not even sure how to setup a raytracer CI |
20:45:53 | FromDiscord | <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:44 | FromDiscord | <Vindaar> of course for the CI it needs to be low number of rays |
20:47:48 | FromDiscord | <shadow.> well im guessing i just have something flipped or something |
20:47:56 | FromDiscord | <shadow.> like a negative simple or + vs idek |
20:56:29 | FromDiscord | <shadow.> oh i think i know why |
20:56:38 | FromDiscord | <shadow.> @mratsim mult() is a dot product and not a |
20:56:42 | FromDiscord | <shadow.> and i acted as if it was |
20:56:43 | FromDiscord | <shadow.> lol |
20:57:47 | FromDiscord | <shadow.> wait nvm idek |
20:57:52 | FromDiscord | <shadow.> dot and should be the same thing on a vec |
20:58:02 | * | Gustavo6046 joined #nim |
20:58:19 | FromDiscord | <shadow.> wait |
20:58:20 | FromDiscord | <shadow.> im not sure |
21:00:06 | * | superbia quit (Quit: WeeChat 3.0) |
21:00:17 | FromDiscord | <shadow.> yep its dot not mult |
21:01:29 | FromDiscord | <shadow.> nvm im just being dumb lol ima shut up for now and figure this out π |
21:08:41 | FromDiscord | <shadow.> this is gonna be a long trek. |
21:09:02 | FromDiscord | <mratsim> but with ray tracing you can't trust your eye |
21:09:23 | FromDiscord | <mratsim> if your shadow is wrong, you need to be trained to find that out |
21:09:54 | FromDiscord | <mratsim> and look at glass reflection https://media.discordapp.net/attachments/371759389889003532/796848101842354186/book1_animation.png |
21:10:12 | FromDiscord | <mratsim> https://raw.githubusercontent.com/mratsim/trace-of-radiance/master/media/book1_animation.gif |
21:12:36 | FromDiscord | <shadow.> i mean |
21:12:43 | FromDiscord | <shadow.> for me if its not black ima call it a day |
21:12:44 | FromDiscord | <shadow.> π |
21:13:27 | FromDiscord | <shadow.> how do i run it in your multithreaded mode in your example? |
21:19:51 | FromDiscord | <mratsim> you pick a threadpool, you split your loop into your number of threads and off you go |
21:20:21 | FromDiscord | <mratsim> that will likely run in load balance issue because raytracing is heavily imbalancer but that's the first step |
21:20:31 | FromDiscord | <Vindaar> @mratsim but that's a problem of testing iin general and not the actual CI part |
21:20:49 | FromDiscord | <mratsim> CI doesn't have eyes |
21:21:04 | * | narimiran quit (Ping timeout: 260 seconds) |
21:21:14 | FromDiscord | <mratsim> and I don't trust mine for raytracing problems |
21:21:20 | FromDiscord | <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:30 | FromDiscord | <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:49 | FromDiscord | <inv> That's it, just to compare Rust and Nim π https://github.com/inv2004/coinbase-pro-nim |
21:36:15 | disruptek | lqdev: if you think you have a good argument to change my style doc, i will try to adopt your style. |
21:36:34 | disruptek | poor syntax highlighting isn't a very compelling argument though, i have to say. |
21:36:50 | disruptek | but maybe there's a better reason to do it differently. |
21:37:58 | disruptek | inv: silly package name. |
21:43:17 | disruptek | treeform: i can reproduce your jsony benchmark with benchy, but not with criterion. |
21:43:48 | disruptek | i looked at benchy and i don't trust it. criterion uses a barried to ensure you're not cheating with the cache. π€· |
21:43:54 | disruptek | barrier, too. |
21:44:07 | disruptek | i 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:24 | FromDiscord | <mratsim> the hell is this https://media.discordapp.net/attachments/371759389889003532/796858546805407784/unknown.png |
21:51:40 | FromDiscord | <mratsim> ambiguous identifier jason, use jason.jason :/ |
21:53:32 | disruptek | don't ask me. |
21:55:25 | FromDiscord | <Vindaar> gotta go an endless recursive `jason.jason.jason.β¦` surely! |
21:55:37 | FromDiscord | <mratsim> I'm not asking |
21:55:40 | disruptek | try: jaason. |
21:55:42 | FromDiscord | <Vindaar> needs to be more precise |
21:55:48 | FromDiscord | <mratsim> it's Nim import that leads to collision |
21:55:50 | disruptek | if that doesn't work, jaaaason might work. |
21:56:16 | FromDiscord | <mratsim> what was the syntax, from something import Json as JJson? |
21:56:29 | disruptek | what? |
21:58:11 | FromDiscord | <Randall> Jason sounds familiar https://hexdocs.pm/jason/readme.html |
21:59:26 | FromDiscord | <mratsim> I want to rename an imported symbol |
22:02:08 | FromDiscord | <dom96> @mratsim you're naming your function the same as the module? |
22:02:15 | FromDiscord | <dom96> Surely that's the problem here, no? |
22:02:35 | FromDiscord | <mratsim> nah it works, and it's disruptek's macro |
22:02:47 | FromDiscord | <mratsim> my issue is adding nim-json-serialization to treeform benchmark |
22:03:11 | FromDiscord | <mratsim> but there is a Json coming from Jason, one from jsony and one from nim-json-serialization |
22:03:29 | FromDiscord | <mratsim> and then I tried to qualify "jason.Json" |
22:03:34 | FromDiscord | <mratsim> and all hell broke loose |
22:03:37 | disruptek | eh jsony and jason don't clash. |
22:03:56 | disruptek | benchmark here: |
22:03:58 | disruptek | !repo jason |
22:03:59 | disbot | https://github.com/disruptek/jason -- 9jason: 11JSON done right π€¦ 15 39β 1π΄ |
22:03:59 | FromDiscord | <mratsim> nim-json-serialization clashes with both |
22:04:23 | FromDiscord | <mratsim> and I need to rename Nim-json-serialization "Kson" type to something |
22:04:28 | FromDiscord | <mratsim> Json |
22:04:32 | FromDiscord | <mratsim> to avoid that clash |
22:04:37 | disruptek | maybe i will rename the type and call it v1. |
22:04:46 | disruptek | Jason should be pretty safe. |
22:05:06 | FromDiscord | <mratsim> Json is fine, it's Nim import that needs more flexibility. |
22:06:12 | FromDiscord | <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:19 | FromDiscord | <mratsim> or something in that vein |
22:06:27 | FromDiscord | <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:37 | disruptek | it's on my readme. |
22:06:49 | * | greenfork quit (Ping timeout: 264 seconds) |
22:06:57 | FromDiscord | <treeform> I forgot which one we are benchmarking json or flatty? |
22:07:02 | disruptek | json. |
22:07:14 | disruptek | frosty is cps-based now. π |
22:07:14 | FromDiscord | <treeform> I though we were on flatty |
22:07:34 | FromDiscord | <treeform> child protective services? |
22:07:37 | FromDiscord | <mratsim> ooooh made it compile |
22:07:53 | disruptek | mratsim: the problem is that i need people to be able to use the type whatfer broken concepts reasons. |
22:08:02 | FromDiscord | <mratsim> apparently "except" is not a full gatekeeper you can do qualified imports |
22:08:04 | disruptek | but, yeah, i can make more use of bind. |
22:08:12 | FromDiscord | <mratsim> nope it's fine |
22:08:13 | disruptek | yeah, except never was. |
22:08:19 | FromDiscord | <mratsim> no need to change anything |
22:08:21 | disruptek | that's how `except nil` works. |
22:08:38 | FromDiscord | <mratsim> https://media.discordapp.net/attachments/371759389889003532/796862884755144742/unknown.png |
22:08:52 | FromDiscord | <mratsim> nim-json-serialization is 2.5x faster than jsony |
22:09:06 | disruptek | yeah, i don't care; it's too expensive an import. |
22:09:10 | disruptek | whatfer status reasons. |
22:09:34 | disruptek | i really just need to not do runtime serialization, period. |
22:09:45 | * | taprack quit (Ping timeout: 240 seconds) |
22:10:02 | FromDiscord | <dom96> anyone tried a C-based implementation as a comparison for these benchmarks? |
22:10:22 | disruptek | there's a C version that mops the floor with everything. |
22:10:27 | disruptek | simd-based iirc. |
22:10:44 | disruptek | but i'm pretty much done with wrappers. |
22:10:47 | FromDiscord | <mratsim> simdjson is C++ |
22:10:58 | disruptek | i can't count the hours i've wasted on libgit2. |
22:11:09 | FromDiscord | <mratsim> but it wouldn't parse into a Nim ref tree |
22:12:29 | FromDiscord | <mratsim> @disruptek, the import tree is a bug |
22:12:43 | FromDiscord | <mratsim> https://github.com/status-im/nim-json-serialization/issues/25 |
22:12:43 | disruptek | what? |
22:12:44 | disbot | β₯ Strange dependency tree |
22:12:57 | disruptek | yeah, i don't care. π |
22:13:05 | FromDiscord | <mratsim> I'm pretty sure it's due to nimble not having fine-grained per-task dependencies though |
22:13:05 | FromDiscord | <dom96> I also wonder how Araq's packedjson compares |
22:13:13 | disruptek | benchmarks on my readme. |
22:13:16 | FromDiscord | <dom96> Why is everybody writing json libraries lol |
22:13:23 | FromDiscord | <mratsim> there is a dependenncy on chronos but I think it's just for testing |
22:13:34 | disruptek | i dunno why treeform keeps reimpl my shit. |
22:13:40 | FromDiscord | <mratsim> why is Nim json so slow :/ |
22:14:24 | FromDiscord | <treeform> @dom96, its disruptek fault |
22:15:18 | disruptek | i PR'd some "fixes" to std/json to slow it down. π |
22:15:43 | FromDiscord | <mratsim> @treeform FYI storing the changes here: https://gist.github.com/mratsim/927f7ce70607074b76e00dfe557e45f6 |
22:16:11 | FromDiscord | <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:25 | FromDiscord | <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:32 | disruptek | it's harmless; when i wrote the bench i had no idea what jsony returned. |
22:16:46 | disruptek | you can remove the conversion if you think it will help (it won't). |
22:17:05 | disruptek | dom96: none of us need http servers. |
22:17:10 | FromDiscord | <treeform> @dom96, I deal with like 1 request per minute at work, but parse terrabytes of json. |
22:17:20 | disruptek | this. |
22:17:22 | FromDiscord | <treeform> Yeah I don't need HTTP serers |
22:17:29 | FromDiscord | <mratsim> actually we need one at Status. |
22:17:30 | FromDiscord | <treeform> All my servers are websocket based |
22:17:35 | disruptek | !repo quic |
22:17:35 | FromDiscord | <treeform> or UDP based |
22:17:36 | disbot | https://github.com/status-im/nim-quic -- 9nim-quic: 11QUIC for Nim 15 21β 0π΄ 7& 8 more... |
22:17:40 | disruptek | it's otw. |
22:17:57 | FromDiscord | <treeform> @mratsim what changes are you making? |
22:18:10 | FromDiscord | <mratsim> 6 lines |
22:18:27 | FromDiscord | <mratsim> import serialization, import json_serialization except Json, toJson |
22:18:31 | FromDiscord | <treeform> oh you added status! |
22:18:31 | FromDiscord | <mratsim> and the timeit |
22:18:33 | FromDiscord | <treeform> got it |
22:18:58 | FromDiscord | <treeform> I was not able to have std/json and packedjson work in the same file |
22:19:16 | FromDiscord | <treeform> they I think they conflict because they generate procs that are named the same |
22:19:20 | FromDiscord | <treeform> do you know a way around it? |
22:20:27 | FromDiscord | <mratsim> use "except" |
22:20:37 | FromDiscord | <mratsim> that doesn't prevent qualified import |
22:20:40 | FromDiscord | <treeform> but they are generated by a macro? |
22:20:51 | FromDiscord | <mratsim> ah |
22:21:05 | FromDiscord | <treeform> packedjson/deserialiser |
22:21:18 | FromDiscord | <mratsim> no idea, I don't care enough about json at the moment |
22:21:30 | FromDiscord | <treeform> @mratsim what package do I need to install to make your code work? |
22:21:37 | FromDiscord | <mratsim> when I'm back with dealing with GB of json i'll look into that |
22:21:57 | FromDiscord | <mratsim> json_serialization, serialization, chronos, bearssl |
22:22:08 | FromDiscord | <mratsim> don't ask me why about the dependencies |
22:22:48 | FromDiscord | <treeform> thanks! |
22:24:00 | FromDiscord | <treeform> good job yours is are faster! https://gist.github.com/treeform/5b19460fbc81ef71bc506fbac5253f77 |
22:24:11 | FromDiscord | <treeform> I will be taking more look at your code. |
22:25:28 | FromDiscord | <mratsim> the speed is likely not in the parser but more in faststreams |
22:25:38 | FromDiscord | <mratsim> it's zero-copy streams |
22:26:09 | disruptek | that was my analysis, too. |
22:26:58 | FromDiscord | <mratsim> aka, once again, it's memory that is the bottleneck, not the CPU |
22:27:22 | FromDiscord | <mratsim> and most perf problem can be summarized as how to bring the data fast enough to the CPU |
22:30:09 | FromDiscord | <treeform> Yes |
22:30:24 | FromDiscord | <treeform> What do you mean by zero-copy stream? |
22:30:51 | FromDiscord | <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:03 | FromDiscord | <treeform> thanks! |
22:31:56 | FromDiscord | <mratsim> there are links to Microsoft articles just above |
22:32:16 | FromDiscord | <mratsim> going to sleep |
22:35:13 | * | taprack joined #nim |
22:50:59 | FromDiscord | <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:20 | FromDiscord | <Avatarfighter> omg we have quic but in nim |
23:03:42 | * | D_ joined #nim |
23:03:51 | FromDiscord | <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:13 | disruptek | that's the goal. |
23:04:27 | disruptek | 808,929 cycles? |
23:04:34 | FromDiscord | <treeform> do it compile time? |
23:04:59 | disruptek | it's literally the first line of text in the readme. |
23:05:12 | FromDiscord | <treeform> which readme? |
23:05:17 | disruptek | the one for the project. |
23:05:39 | FromDiscord | <treeform> criterion? |
23:05:50 | disruptek | !repo jason |
23:05:50 | disbot | https://github.com/disruptek/jason -- 9jason: 11JSON done right π€¦ 15 39β 1π΄ |
23:05:56 | disruptek | jason is the project you're testing, right? |
23:06:03 | disruptek | am i high right now? |
23:06:23 | FromDiscord | <treeform> "mostly compile-time JSON encoding" |
23:06:59 | FromDiscord | <treeform> I though this means it will generate the serialized at compile time, not serialize at compile time. |
23:07:15 | disruptek | what's the point of that? |
23:07:28 | FromDiscord | <treeform> I don't know? You wrote it. |
23:07:43 | disruptek | anyway, i just s/const thing/const thing2/ and add `var thing = thing2` and now: |
23:07:52 | disruptek | Benchmark: encode_jason_integer -> () Cycles: 41cycles Β± 5cycles |
23:08:12 | disruptek | it's obviously going to be slower to serialize stuff at runtime. |
23:08:19 | disruptek | why would you want to do that if you don't have to? |
23:08:33 | disruptek | to save a couple bytes of memory? |
23:08:47 | FromDiscord | <treeform> Because my data is dynamic? |
23:09:16 | disruptek | well, what can i say. it's still faster than jsony. |
23:09:23 | disruptek | Benchmark: encode_jsony_integer -> () Cycles: 298cycles Β± 168cycles |
23:09:34 | disruptek | you don't have to use jason, though. |
23:09:54 | FromDiscord | <treeform> yes your code is still faster |
23:10:03 | FromDiscord | <treeform> you are able to turn integer into string faster them I am |
23:10:05 | FromDiscord | <treeform> I want to know how |
23:10:17 | disruptek | it's just a macro. |
23:10:46 | FromDiscord | <treeform> Right now you are benchmarking this: https://gist.github.com/treeform/f49ce8132f5be7bb3ce5daaac849adab |
23:10:55 | FromDiscord | <treeform> And yeah I can't win vs a constant π |
23:11:12 | FromDiscord | <treeform> Unless I output a constant myself |
23:11:13 | disruptek | you're not supposed to win. |
23:11:16 | FromDiscord | <treeform> (edit) "Unless I output a ... constant" added "compile" |
23:11:23 | disruptek | the whole idea of jason is to not do any work. |
23:11:45 | disruptek | there's more to do, also. |
23:12:02 | * | D_ quit (Remote host closed the connection) |
23:12:55 | disruptek | i don't fold all constants, for example. i don't pre-serialize entire arrays or objects, etc. |
23:13:10 | FromDiscord | <treeform> but why benchmark then stuff you do fold? |
23:13:22 | disruptek | to make sure i don't fuck up. |
23:13:34 | FromDiscord | <treeform> ok |
23:13:36 | disruptek | it's hard to believe, but even disruptek makes errors. |
23:13:47 | FromDiscord | <zetashift> I don't believe that, lies. |
23:14:11 | disruptek | zeta you chucklehead, you starred my disruptek/README. |
23:15:07 | disruptek | treeform: a lot of my json use is constants for api calls and stuff. |
23:15:22 | disruptek | coupled with carnac, it cuts my runtime dramatically. |
23:17:45 | FromDiscord | <treeform> Yeah its neat, its a dimension I did not consider. |
23:17:55 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=2LdX |
23:18:03 | FromDiscord | <treeform> We both can do it, its just jason does it in more places. While mine reaches for the dynamic stuff. |
23:19:18 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=2LdY |
23:19:19 | FromDiscord | <treeform> `thing.sheep.jason.string` is still a constant |
23:19:24 | FromDiscord | <treeform> while mine is not a constant |
23:19:34 | FromDiscord | <treeform> fascinating... |
23:20:21 | disruptek | jason 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:05 | FromDiscord | <treeform> @disruptek I figured out how to do the same trick you are doing. This is pretty cool. Thanks! |
23:35:22 | FromDiscord | <treeform> Just had to add `template toJson[T](v: static[T]): static[string] =` |
23:35:56 | FromDiscord | <treeform> You give me a static thing, you get a static string back... beautiful π |
23:36:24 | FromDiscord | <sealmove> is it possible to download content of a site in Nim? get it as a nim string for example? |
23:36:54 | FromDiscord | <treeform> @sealmove https://nim-lang.org/docs/httpclient.html |
23:38:11 | FromDiscord | <ElegantBeef> @shadow. ah didnt ever test that case |
23:38:40 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=2Le1 |
23:40:09 | disruptek | i wonder what that means. |
23:40:37 | FromDiscord | <sealmove> ah nevermind, it works with -d:ssl, I had it at the end of the command which doesn't work |
23:40:48 | FromDiscord | <sealmove> thanks treefrom, awesome :) |