<< 02-04-2021 >>

00:42:37*vicfred joined #nim
00:50:31*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:50:50*njoseph joined #nim
01:03:30*jjido quit (Quit: Connection closed for inactivity)
02:18:24*waleee-cl quit (Quit: Connection closed for inactivity)
02:40:18FromDiscord<Edwin> sent a code paste, see https://play.nim-lang.org/#ix=2UMr
02:42:14FromDiscord<ElegantBeef> do `.repr` instead
02:44:00FromDiscord<ElegantBeef> Atleast assuming this is for debugging
02:47:05FromDiscord<Edwin> i will try that! i am trying to access the member `pw_name` of `passwd` for regular code (since i couldn't seem to find the file owner with the builtin functions), so i don't think this is strictly for ust debugging
02:47:08FromDiscord<Edwin> (edit) "ust" => "just"
02:52:56FromDiscord<ElegantBeef> Ah your cast might be the culprit
02:53:02FromDiscord<ElegantBeef> Do `file.id.file.uint32`
02:55:06FromDiscord<Edwin> Hmm, both `getpwuid(cast[uint32](file.id.file))` and `getpwuid(file.id.file.uint32)` seem to be yielding the same output with repr
02:55:25FromDiscord<ElegantBeef> Well the cast is unsafe and almost certainly not what you want
02:55:58FromDiscord<Edwin> I see, I guess I won't be using the cast then
02:56:48FromDiscord<Edwin> sent a code paste, see https://play.nim-lang.org/#ix=2UMt
02:57:41FromDiscord<ElegantBeef> Are you using the `posix` module or your own code?
02:58:03FromDiscord<ElegantBeef> Ah i'm blind
03:01:29FromDiscord<ElegantBeef> Ok so it seems `getpwuid` uses a user ID not a file id, which is where this issue is coming from
03:02:45FromDiscord<Edwin> ahh, so then it makes sense that the `file.id.file.uint32` wasn't working
03:02:51FromDiscord<ElegantBeef> Yep
03:04:30FromDiscord<ElegantBeef> Though the stat method should work
03:07:37FromDiscord<Edwin> yeah, just to make sure i'm not totally out of it, i did it in c and there weren't any errors or anything, worked perfectly fine
03:08:01FromDiscord<ElegantBeef> Yea i just replicated the issue
03:08:24FromDiscord<ElegantBeef> Well it's not an issue rather it works
03:08:44FromDiscord<ElegantBeef> Repr doesnt return the object it's represented by `[]` apparently
03:09:08FromDiscord<ElegantBeef> So you can now access the field you want
03:09:34FromDiscord<Edwin> OMG i just realized!
03:10:12FromDiscord<Edwin> that is what i'm looking for
03:10:18FromDiscord<Edwin> thank you so much!
03:10:24FromDiscord<Edwin> i suppose i'm fine with the repr thing for now :P
03:10:35FromDiscord<ElegantBeef> You're welcome always nice to lead people down the wrong path!
03:36:00*spiderstew joined #nim
03:38:26*spiderstew_ quit (Ping timeout: 240 seconds)
03:54:50*NimBot joined #nim
04:28:00*NimBot joined #nim
05:08:24*narimiran joined #nim
05:37:15*vicfred quit (Quit: Leaving)
06:37:06*aeverr quit (Ping timeout: 240 seconds)
07:00:43*filcuc joined #nim
07:21:57*kostrak[m] joined #nim
07:29:38*filcuc quit (Quit: Konversation terminated!)
07:29:53*filcuc joined #nim
07:32:56*filcuc quit (Client Quit)
07:33:08*filcuc joined #nim
07:37:59*filcuc quit (Ping timeout: 265 seconds)
07:42:53*hed0n1st joined #nim
07:47:54*hed0n1st quit (Quit: Leaving)
07:49:08FromDiscord<flywind> https://github.com/nim-lang/Nim/issues/17392
07:49:27FromDiscord<flywind> Can someone help me test this issue?
07:49:40FromDiscord<flywind> (edit) removed "help me"
07:49:47FromDiscord<flywind> (edit) "Can someone ... test" added "else"
07:57:25*kostrak[m] left #nim ("User left")
08:06:37*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
08:07:35*pbb joined #nim
08:12:32ForumUpdaterBotNew thread by Miran: This Month with Nim: March 2021, see https://forum.nim-lang.org/t/7737
09:00:10*ee7[m] quit (Quit: Idle for 30+ days)
09:26:14*lritter joined #nim
10:10:07*waleee-cl joined #nim
10:10:54FromDiscord<jtiai> How should I go with bitfields? Like I have `uint32` value which I'm only interested in bits 0, 1, 2 and 16.
10:15:59FromDiscord<zetashift> @jtiai maybe this: https://nim-lang.org/docs/manual.html#set-type-bit-fields ?
10:17:27FromDiscord<jtiai> I read that but couldn't find anything that would say how to skip/define bitsets that I'm not interested in.
10:22:08FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2UNJ
10:26:20FromDiscord<Rika> Set the value
10:26:28FromDiscord<Rika> D = 16
10:26:43FromDiscord<Rika> It will reflect in the bit field
10:27:07FromDiscord<Rika> Note that the first element will be bit zero regardless of the value
10:37:25FromDiscord<Rika> Oh forgot, “bit fields are 1 indexed” (not really)
10:39:47*aeverr joined #nim
11:06:51*haxscramper joined #nim
11:15:41FromGitter<HJarausch_gitlab> Layout of the Duration object? ⏎ According to the docs ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=6066fcdd92a3431fd66e68fa]
11:20:23*narimiran quit (Ping timeout: 252 seconds)
11:33:44FromGitter<Clyybber> I think seconds is not exported
11:34:28FromGitter<Clyybber> @HJarausch_gitlab Btw, can you test if https://github.com/nim-lang/Nim/pull/17574 works for you?
11:37:29FromGitter<HJarausch_gitlab> Thanks! Is there any means to convert a Duration object to a float value? ⏎ ⏎ And w.r.t. nim-lang/Nim#17574 I currently cannot test it since it occurred during compilation of Weave. ⏎ But, unfortunately, Nim-Devel cannot compile Weave any more. I try to find some means to test it. [https://gitter.im/nim-lang/Nim?at=606701f8657d022d5a59e22c]
11:59:00liblq-devany reason for why --exceptions:goto is not the default?
12:06:49FromGitter<Clyybber> @HJarausch_gitlab Use the inMilliseconds/inMicroseconds to get the duration as an int in that unit, then convert that to a float and scale it to seconds
12:07:02FromDiscord<clyybber> liblq-dev: AFAIR it's the default for gc:arc
12:07:13liblq-devah yes, the default for gc:arc.
12:07:20liblq-devBUT GC:ARC IS NOT THE DEFAULT GC!!!!!!!!!!
12:07:38liblq-devwhat's preventing --exceptions:goto from becoming the default exception model on all GCs?
12:08:19liblq-devhttps://github.com/liquidev/datarray#benchmarks
12:09:19FromDiscord<clyybber> liblq-dev: Nothing afaik, it's just that it has different performance characteristics
12:15:41FromDiscord<no name fits> Is there a way to see what the type of the error that gets raised, is?
12:16:06liblq-devwhat would be your use case for that?
12:16:32liblq-devasking because there are a few ways
12:17:00FromDiscord<no name fits> I want to try out the assertRaise thingy
12:17:09FromDiscord<no name fits> But I have no idea which error I'm actually expecting
12:18:26liblq-devidk, look at the raising proc's documentation to see what {.raises: […].} pragmas it has?
12:19:47FromDiscord<no name fits> Alright, thanks
12:20:32liblq-devi mean i'm just throwing ideas around :p if that doesn't work, you can try echoing `yourException.name`
12:20:56FromDiscord<no name fits> so catching it and printing the name
12:21:06liblq-devyeah
12:22:01haxscramperliblq-dev: do you have benchmarks for 'unoptimized' version of the code from readme example? I.e. with just `Datarray[1000, Ant]`.
12:22:33haxscramperOr is it there but I just missed it
12:22:48liblq-devthe benchmarks use pretty much the same code but the size is 1000000
12:23:07liblq-devhttps://github.com/liquidev/datarray/blob/master/src/datarray.nim#L314
12:35:33*filcuc joined #nim
12:55:32*filcuc quit (Ping timeout: 265 seconds)
13:02:29*MeMeNim joined #nim
13:03:29*filcuc joined #nim
13:05:01*MeMeNim quit (Read error: Connection reset by peer)
13:10:46ForumUpdaterBotNew post on r/nim by XxDiCaprioxX: Tuples vs. Objects, see https://reddit.com/r/nim/comments/mik0wx/tuples_vs_objects/
13:12:40*MeMeNim joined #nim
13:14:02*filcuc quit (Ping timeout: 260 seconds)
13:14:57*MeMeNim quit (Read error: Connection reset by peer)
13:17:47FromGitter<HJarausch_gitlab> @Clyybber I just applied your patch to threadlocalstorage.nim to Nim-1.4.4. Then I tried to compile Weave. I get the compilation error ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=6067197a89446618e9802d5a]
13:19:40FromGitter<Clyybber> @HJarausch_gitlab Are you sure you also included https://github.com/nim-lang/Nim/pull/17574/commits/3a3ca62c5a35ba3583f6a030dbaa1f9b937c25c7 ?
13:19:44FromGitter<Clyybber> It's part of the PR
13:28:09FromGitter<HJarausch_gitlab> Thanks, I've missed that. Now, it compiles and runs just fine. I don't know how to check if a given thread is *bound* to a fixed cpu/core now. Now, I hope that Nim Devel will be able to compile Weave soon. Unfortunately, Weave is quite complex so that it will be difficult for me to narrow down the code which triggers this Nim compiler bug.
13:34:18FromDiscord<no name fits> Is there a cheat-sheet for string manipulation somewhere?
13:34:58liblq-devhttps://nim-lang.org/docs/strutils.html i guess
13:35:09FromDiscord<no name fits> alright
13:56:24FromGitter<xflywind> @Helmut Jarausch you should use https://nim-lang.org/docs/times.html#inSeconds%2CDuration
13:56:40FromGitter<xflywind> to access seconds attributes.
14:28:25*wasted_youth2 quit (Read error: Connection reset by peer)
14:28:49*wasted_youth2 joined #nim
14:32:31FromDiscord<no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2UP2
14:32:44FromDiscord<lantos> ffff, getting segfaults and can't work out why. 😦
14:33:10FromDiscord<no name fits> I tried putting it into the playground with some test HTML, and it works, but I have no idea how
14:33:41FromDiscord<lantos> (edit) "ffff, getting segfaults and can't work out why. 😦 ... " added "Anyone who knows how to debug this pleasa helpa"
14:34:10FromDiscord<Yardanico> what exactly do you not understand here?
14:34:32FromDiscord<no name fits> Mostly the part involving the actual scanp call
14:34:47FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/827551640164761610/unknown.png
14:35:06FromDiscord<no name fits> Yeah I read that one, but I'm still struggling to put it all together
14:36:27*guelosk[m] joined #nim
14:36:35FromDiscord<no name fits> So I get that it seems to start at the "<a" skip until the "href=", stop at the ">" and then the rest looks magic to me
14:37:07FromDiscord<no name fits> I also don't get why it's $input and $index
14:38:14FromDiscord<Yardanico> just because it's not documented enough :)
14:38:23FromDiscord<Yardanico> those are replaced by scanp https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/strscans.nim#L502 automatically
14:38:38FromDiscord<no name fits> ohhh
14:38:41FromDiscord<no name fits> Alright
14:39:26FromDiscord<Yardanico> quoting is a shorter way of creating an atom https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/strscans.nim#L596
14:39:34FromDiscord<Yardanico> with back quotes I mean
14:40:33FromDiscord<Yardanico> as something a bit similar to strscans you might also try https://github.com/zevv/npeg for more complex parsers
14:41:22FromDiscord<no name fits> Cool, thanks.
14:47:22FromDiscord<no name fits> sent a long message, see https://paste.rs/1kj
14:47:39FromDiscord<no name fits> There might be any number of bracket pairs, anywhere in the string
14:49:54FromDiscord<Yardanico> does strformat not work for you?
14:50:01FromDiscord<Yardanico> it has a similar purpose I mean
14:50:02FromDiscord<Yardanico> kind of
14:50:03FromDiscord<no name fits> It might. I have no idea what I'm doing
14:50:16FromDiscord<no name fits> I'm basically trying to make a templating engine for web
14:50:17FromDiscord<Yardanico> what do you need this for?
14:50:19FromDiscord<Yardanico> oh
14:50:50FromDiscord<no name fits> Right now I'm just trying to even get what's within the brackets lol
14:54:25FromGitter<bung87> execCmdEx has previous outputs ?
14:55:05FromGitter<bung87> I can parse `nimble dump --json` , previous output `Warning: Using project local deps mode`
14:55:10FromGitter<bung87> can't
15:16:46FromGitter<bung87> nvm
15:18:00FromDiscord<zetashift> @leorize using your plugin in neovim, the syntax highlighting kind of "drags" along as I type, anyway to disable this behavior?
15:18:27liblq-devnope
15:18:36liblq-devwelcome to nimsuggest™
15:20:10FromDiscord<Yardanico> if I have an array[ThreadCount, seq[string]] and add to those seqs from different threads (each index is only owned by a single thread), is it thread-safe under ARC/ORC ?
15:20:25FromDiscord<Yardanico> since there can be no data races as I understand
15:25:38FromDiscord<Yardanico> maybe I should try using new std/channels 🤔
15:25:57FromDiscord<Conifer> Could someone sell the idea of using Nim for me? Having difficult time choosing Nim or going back to Lua for gamedev (Lua with Love2D) albeit Lua's tables are driving me to suicidal thoughts. Anywhere I can read solid examples of Pros & Cons of Nim?
15:27:14leorize[m]@zetashift it can't be done instantly, so some form of "dragging" has to occur. Do you want to customize it so that it only updates when you stop typing or smt?
15:31:00liblq-dev@Conifer pros: static type system, metaprogramming with code introspection capabilities, speed
15:31:11liblq-devcons: compiler can be unstable and/or slow at times
15:31:41FromDiscord<exelotl> Yeah what lqdev said
15:31:49leorize[m]Yardanico yes, it should be safe
15:32:37leorize[m]now if you are gonna read from those from different threads, then you need a lock
15:32:58FromDiscord<exelotl> About static/dynamic typung: I used to not care, then I wrote games in JS for 2 years and now I think the confidence that a statically typed language gives you, being able to catch mistakes before your code even builds, is extremely valuable for any sizeable project
15:33:10FromDiscord<exelotl> (edit) "typung:" => "typing:"
15:33:15liblq-devyeah what exelotl said
15:33:39liblq-devi still like lua for static prototyping but sometimes i find it hard to catch errors related to nim access
15:33:45liblq-devs/static/fast
15:33:49liblq-devs/nim/nil
15:34:13*Vladar joined #nim
15:34:23liblq-devforgive my brain being on airplane mode, i spent the past hour or two trying to figure out why the heck hoisting my code to another module slows it down.
15:34:29FromDiscord<zetashift> In reply to @leorize "<@77574388035100672> it can't be": yeah that!
15:34:49FromDiscord<Conifer> Yeah I get the idea of static typing. Used Go before but it started to become unrepairable mess and there are bits I hate there as well so I agree.↵↵Gonna play around with nim
15:34:52FromDiscord<Conifer> and see how it is
15:35:07liblq-devnim's type system is considerably better than go's thanks to generics
15:35:32leorize[m]also we have distinct types
15:35:38liblq-devgo also has distinct types
15:35:45liblq-devafaik
15:35:52liblq-devhaven't delved too deep into it
15:36:05leorize[m]I never knew that :p
15:36:24FromDiscord<Conifer> Go will have generics tho
15:36:28liblq-devi think making a type alias to another type acts like distinct but idk
15:36:34liblq-devlike `type foo int`
15:36:50liblq-devi don't like go sooooooooooooooooo
15:36:52FromDiscord<exelotl> Oh yeah Go's type system is not great... It doesn't even have enums 😅
15:37:02PrestigeDang really?
15:37:04liblq-devenums in go are icky
15:37:10liblq-devyou use this weird iota thing
15:37:14leorize[m]@zetashift I'll push an update in a few mins with a switch for this, this feature has been requested for awhile :p
15:37:15liblq-devwhatever "iota" even means.
15:37:49*liblq-dev < https://matrix.org/_matrix/media/r0/download/matrix.org/GWTVeWuTiQdXtsVpwAzGkKbH/message.txt >
15:41:07Zoom[m]Hey everyone. I asked a couple of days ago, but the channel was kinda slow. Does anyone have ideas in regards to Nim being considerably slower than Go in that countwords thingy?
15:41:20FromDiscord<Conifer> yeah... Was never fan of their enums.↵Are there any good VSC plugins I should look into? Seen few really outdated, the only one I found so far is by nimsaem
15:41:29Zoom[m]Is this a topic worthy enough for the forum, perhaps?
15:41:39leorize[m]nimsaem is the best vsc plugin atm
15:41:55FromDiscord<Conifer> take it nothing else needed apart from it?
15:42:02leorize[m]Zoom: can you post the benchmark again? I believe I haven't seen it
15:42:08Zoom[m]https://github.com/ZoomRmc/countwords_nim
15:42:11leorize[m]@Confier pretty much
15:42:23FromDiscord<Conifer> 👍
15:42:35Zoom[m]Here's my version, it's about 3-4% faster than the optimized one from the original repo.
15:43:32leorize[m]Zoom: drop the custom buffering and use lexbase
15:43:51leorize[m]I did that and nearly beat the optimized C :p
15:45:03Zoom[m]I understand the algo has a lot of points of attack to optimize further, but at this stage it's almost the equivalent to Go code, yet it's seriously lags behind
15:46:10Zoom[m]BTW, What are the options to profile the Nim code besides cachegrind?
15:46:42leorize[m]you can use intel vtune
15:47:42FromDiscord<Rika> zoom: the nim one runs faster for me
15:48:00FromDiscord<zetashift> In reply to @leorize "<@77574388035100672> I'll push an": I've been trying out neovim for a few days and I gotta say with the Lua stuff, I really like it. It has gotten really far since I tried it 2 years ago, where every little thing broke on me cause I'm dumb.
15:48:14FromDiscord<zetashift> I am thinking of trying to take a crack at writing a treesitter grammar
15:48:20Zoom[m]@Rika, huh, the one from my repo?
15:48:37FromDiscord<Rika> yes
15:48:43Zoom[m]How did you measure?
15:48:55FromDiscord<Rika> https://media.discordapp.net/attachments/371759389889003532/827570298081509466/unknown.png
15:48:56FromDiscord<Rika> hyperfine
15:49:01Zoom[m]Did you ensure the file was hot in the cache?
15:49:40leorize[m]@zetashift saem, Prestige and I currently have the idea of porting the compiler's lexer to tree-sitter
15:49:55leorize[m]I believe none of us has done a thing torwards that though :P
15:49:59FromDiscord<Rika> ive no clue what you mean, your script doesnt seem to do that either?
15:50:05leorize[m]Zoom: hyperfine does that automatically
15:50:32Zoom[m]Yeah, I see. Typed before seeing the answers
15:50:55FromDiscord<zetashift> In reply to @leorize "<@77574388035100672> saem, Prestige and": I mean, I just wanted to look at python/js treesitter grammars and just try to hack my way through, using the lexer sounds fancy af
15:51:22leorize[m]it's kinda hard to grammar your way through with nim's style insensitivity :P
15:51:50PrestigeYeah for sure
15:52:09FromGitter<bung87> that sounds like rewrite the compiler
15:52:21FromDiscord<Rika> that sounds like glhf
15:52:21leorize[m]if you want to use regex, feel free to study nim.nvim syntax regexes, which I'm proud to say is the most accurate right now regarding numbers, pragmas, etc :)
15:52:43FromDiscord<zetashift> In reply to @leorize "it's kinda hard to": Ah, I might not have thought this through all the way hahahah
15:52:44leorize[m]there's no need to rewrite the compiler, the lexer is pretty pluggable
15:53:04Zoom[m]Rika, could you please measure with the bible_x50 on your HW?
15:53:20FromDiscord<Rika> on my ram?
15:53:54Zoom[m]I mean of course you will measure on your hardware, not mine :)
15:54:06FromDiscord<Rika> no difference
15:54:28leorize[m]@zetashift I've seen your post on the forum, looks like nim-compe is the now preferred completion provider?
15:54:29FromDiscord<Rika> no statistically significant difference, i sent an image above if you missed it
15:55:09leorize[m]how is it compared to asyncomplete? I'm thinking of providing native support for all popular completion plugins instead of expecting people to work their way through
15:56:31FromDiscord<zetashift> erhm, compe with nimlsp, just worked for me. I use Scala, Elixir and JS too and with those it was all so no hassle to set up
15:56:41FromDiscord<Rika> zoom: did you see the image?
15:56:45Zoom[m]Ok. I was interested if there could be any reallocation shenanigans going one for a bigger input which could affect results.
15:57:10FromDiscord<zetashift> also AFAIK windows works too, which with the suggested async of nim.nvim didn't work well (I gave up on that like 2 years ago)
15:57:19leorize[m]the nim version is slightly slower for me, I'll look in a bit
15:57:29FromDiscord<Rika> okay
15:57:32FromDiscord<Rika> wait
15:57:34Zoom[m]@Rika, yep seen it. Nim version? CPU?
15:57:48FromDiscord<Rika> ill show the x50 too just so you can see that too
15:57:55FromDiscord<Rika> im on almost-latest devel
15:57:58FromDiscord<Rika> 2700x
15:57:59FromDiscord<zetashift> You want me to sent me my compe config so it can be added to the README?
15:58:07Zoom[m]Thanks, Rika
15:58:18FromDiscord<Rika> the larger file makes nim slower
15:58:46FromDiscord<Rika> BUT go's max is roughly == nim's max
15:59:10FromDiscord<Rika> ah, misread the max
15:59:11FromDiscord<Rika> lmao
15:59:13FromDiscord<Rika> https://media.discordapp.net/attachments/371759389889003532/827572887476633670/unknown.png
15:59:29FromDiscord<Rika> ill uprof this
15:59:43*gangstacat quit (Ping timeout: 250 seconds)
16:00:19Zoom[m]That's more like my results. Go is currently at 88% of Nim for me
16:00:32*Zoom[m] uploaded an image: (13KiB) < https://matrix.org/_matrix/media/r0/download/matrix.org/GsvswKQnYfoxzHbaTVrwIsqK/countwords_nim_cachegrind.png >
16:00:47Zoom[m]Don't know if you can see the attachments via matrix bridge
16:01:08FromDiscord<Rika> n
16:01:10FromDiscord<Rika> can
16:01:50leorize[m]@zetashift don't worry, I already created one :P I'm experimenting with some changes to the completion so it will go up with that
16:02:01FromDiscord<Rika> i bet this is because of many string copies
16:04:11Zoom[m]I suppose so. But where are they happening? During sort? We explicitly copy only on insertion and output.
16:04:58*vicfred joined #nim
16:05:38FromDiscord<Rika> string[int..int]
16:06:04FromDiscord<Rika> any copy is bad because i think go does barely any
16:06:43*leorize[m] < https://matrix.org/_matrix/media/r0/download/matrix.org/hsYISnAGlQXZvZotDTUAzNIM/message.txt >
16:07:35leorize[m]though that copy for words.inc is necessary
16:07:49leorize[m]to combat that, creates a buffer specifically for it
16:08:08leorize[m]so that you never have a "buffer-create/buffer-delete" cycle every loop
16:08:15leorize[m]that's my trick to beat the C version
16:10:18Zoom[m]@Rika there's only one slicing happening in my code
16:11:31FromDiscord<lantos> hmmm, trying to make an audio queue but the deque object keeps crashing at 64 length
16:12:01FromDiscord<lantos> (edit) "hmmm, trying to make an audio queue but the deque object keeps crashing at 64 length" => "sent a code paste, see https://play.nim-lang.org/#ix=2UPz"
16:12:11FromDiscord<lantos> (edit) "https://play.nim-lang.org/#ix=2UPz" => "https://play.nim-lang.org/#ix=2UPA"
16:17:58*gangstacat joined #nim
16:18:38Zoom[m]leorize: looks cool but I don't get how can I use a special buffer for inserting. I'm just passing a slice directly into `inc`
16:19:00leorize[m]that "slice" is copied
16:19:34leorize[m]and for that to happen, a temporary buffer is created to store the copy, which involves memory allocation then deallocation after the loop
16:20:09leorize[m]by using one long-lived buffer for this, you avoid that slow cycle
16:20:50FromDiscord<Rika> zoom: your hash function takes the most time accdg to uprof
16:20:53FromDiscord<lantos> is that @me leorize or something else?
16:20:58Zoom[m]Of course, but isn't the copy happening inside `insertImpl()` regardless?
16:21:33Zoom[m]@Rika it's just a copy from std to bypass murmur
16:21:51leorize[m]Zoom: yes but have you counted when insert is not happening?
16:21:54FromDiscord<Rika> idt thats how that works but okay
16:22:59FromDiscord<Rika> your code is wrong as well, i get an assertiondefect when running out of danger
16:24:51Zoom[m]Try removing that hash proc, it's slower on my machine.
16:25:57leorize[m]the default hashing algo is not meant to be very fast, but to avoid duplicate hashes
16:26:28Zoom[m]That's why I tried to bypass it.
16:28:20FromDiscord<Rika> here be possible hotspots? https://media.discordapp.net/attachments/371759389889003532/827580214598172712/unknown.png
16:30:09FromDiscord<Rika> so yeah i think str copies are still fucking the program
16:30:18FromDiscord<Rika> i still think
16:30:34Zoom[m]@Rika It very well might be wrong, but the output is equal to Go code on the test file (except the order)
16:32:29*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
16:32:31FromGitter<UrKr> can I use deep copy from js nim?
16:33:00FromGitter<UrKr> I'm getting undeclared identified deepCopy
16:33:06*Gustavo6046 joined #nim
16:33:08FromDiscord<Rika> https://media.discordapp.net/attachments/371759389889003532/827581425754570812/unknown.png
16:33:09FromGitter<UrKr> nim 1.4.4
16:33:18FromDiscord<Rika> some more interestingly high points
16:33:35FromDiscord<Rika> esp. that 5 one, but thats a while loop so likely expected
16:33:42Zoom[m]leorize: sorry, I'm too dumb, still don't understand how we can avoid copying for inc without modifying how tables work.
16:33:54FromDiscord<Rika> seems inefficient though
16:35:26leorize[m]Zoom: http://ix.io/2UPE
16:35:30leorize[m]it's faster than go now
16:35:40leorize[m]probably can be even faster once I clean up more of your code
16:39:39leorize[m]Zoom: note that we are not avoiding all copies, we are avoiding one extra
16:40:55FromDiscord<Rika> thats what i said T_T even if we do just one copy, thats already pretty significant over go
16:41:27Zoom[m]Yep, checked it. Cool trick
16:42:35leorize[m]once views mature we would stop having to do this kind of thing :P
16:45:35FromDiscord<exelotl> vieeeeeews!!!!
16:50:11Zoom[m]Wait, do we have automatic enumeration in `for` loops?
16:50:33leorize[m]we do, std/enumerate
16:50:58leorize[m]some types provide a pairs() iterator that does pretty much the same thing
16:51:19Zoom[m]Didn't know it works implicitly like in your code
16:51:41leorize[m]it's the pairs iterator, not enumerate
16:53:41Zoom[m]I get that :)
16:55:58Zoom[m]Anyway, I think I'm just starting to understand what's happening there and I would expect inc(slice) to do it like that.
17:18:22*hoijui joined #nim
17:39:43*hoijui quit (Ping timeout: 246 seconds)
17:40:02*hoijui joined #nim
17:44:40haxscramperI'm getting ambiguous call error for a **SINGLE** procedure, with declaration positions showing absolutely identical locations: `htree_distance.[](node: NodeId[[].L, [].V], idx: int)` [declared in `htree_distance.nim(413, 6)`] and `htree_distance.[](node: NodeId[[].L, [].V], idx: int)` [declared in `htree_distance.nim(413, 6)`].
17:44:40haxscramper
17:44:43haxscramper(full declaration path omitted because it is not necessary). It happens when I run unit tests in github CI - I cannot reproduce it locally, even when trying it out with completely new docker instance.
17:44:43haxscramper
17:44:58haxscramperhttps://github.com/haxscramper/hmisc/runs/2255489324?check_suite_focus=true#step:5:195 link to the error itself
17:46:03haxscramperI'm not even sure what cause this, because I haven't touched the code, or any of it's direct dependencies for couple month at this poing
17:46:28haxscramperI'm using setup-nim for CI and just run `nimble test` as a test job
17:48:06haxscramperAnyone got ideas?
17:49:51*fputs quit (Ping timeout: 246 seconds)
17:52:09*fputs joined #nim
17:56:08haxscramperCan't even reproduce on completely new nim installation with all dependencies newly installed. And of course it doesn't break when just compiling locally
18:05:16FromDiscord<zetashift> @leorize I'm guessing syntax highlighting breaking halfway through a file is nim.nvim <-> nimsuggest related?
18:05:54leorize[m]no, you're dealing with long strings, right?
18:06:58FromDiscord<zetashift> Just reading through: https://github.com/nim-lang/nimforum/blob/master/src/frontend/threadlist.nim and editing it
18:08:02leorize[m]do you have a pic showing that?
18:08:32leorize[m]oh it's nim js stuff...
18:08:40leorize[m]nimsuggest is not a big fan of those
18:09:45leorize[m]yea i think your issue is nimsuggest related
18:09:49saem👋
18:13:48*sagax joined #nim
18:14:44FromDiscord<zetashift> ah good to know, at first I actually didn't even notice haha https://media.discordapp.net/attachments/371759389889003532/827606992927195147/unknown.png
18:18:38*tane joined #nim
18:20:19FromDiscord<checkersai> Is there a way to generate Nim AST at runtime? I want to write a language that transpiles to Nim, sorta like what ReasonML is to OCaml
18:20:43FromDiscord<Yardanico> you can use the compiler as a library
18:20:49leorize[m]yes, you can use the compiler's ast library
18:20:56FromDiscord<Yardanico> but of course the API is lower-level than std's macros
18:21:17FromDiscord<checkersai> Cool
18:21:57FromDiscord<checkersai> And since I can use the compiler as a library I also have access to the semantic checker and c code generator, right?
18:22:31FromDiscord<haxscramper> yes, though using semcheck is not well documented
18:23:03FromDiscord<haxscramper> https://github.com/haxscramper/haxdoc/blob/master/src/haxdoc/compiler_aux.nim#L48 that is the basic setup you need to use in order to semcheck AST
18:23:44FromDiscord<haxscramper> And for using C code generator you would probably need to read how it is used in the compiler itself, I haven't touched this part yet
18:23:57leorize[m]you can look at nimterop as an example of generating code with the compiler's ast library
18:24:13leorize[m]for generating code I'd recommend shooting it to nim instead
18:25:15FromDiscord<haxscramper> I also made https://haxscramper.github.io/hnimast/src/hnimast.html to make code generation easier, so you can do things like `newPProcDecl("hello", exported = true)`
18:25:27FromDiscord<haxscramper> I use it for hcparse code generation
18:25:49FromDiscord<zetashift> In reply to @checkersai "Is there a way": Nim as a target, $LANG -> Nim -> JS/C/C++ -> machine code, how far can we go?
18:26:02FromDiscord<checkersai> Thanks
18:26:15FromDiscord<haxscramper> It can also unparse existing code into higher-level objects like https://haxscramper.github.io/hnimast/src/hnimast/object_decl.html#ObjectDecl if you need this
18:26:33FromDiscord<checkersai> In reply to @zetashift "Nim as a target,": I'm not really trying to make a new language, just a syntax skin over nim
18:27:39FromDiscord<JSONBash> is there a bcrypt library that anyone recommends using?
18:30:40FromDiscord<JSONBash> the one I found is a wrapper on C but hasnt been updated in a while, when i think bcrypt has
18:31:56FromDiscord<haxscramper> Nim wrappers don't require updating for newer versions of the library unless new procedures/types are introduced. And you can always write your own wrapper additions without even patching the original library
18:32:37FromDiscord<haxscramper> `importcpp: ".missingField"`
18:32:48FromDiscord<JSONBash> i just meant that the C files have not been updated in 3 years
18:33:02FromDiscord<JSONBash> which isnt a bad thing
18:33:17FromDiscord<JSONBash> just for security libraries it seems unusual
18:34:13FromDiscord<haxscramper> I didn't know it uses `.compile:` in main library. Then yes, I think it can't be fixed without updating.
18:34:49*natrys joined #nim
18:35:20FromDiscord<zetashift> Didn't nim have syntax skins?
18:37:20FromDiscord<haxscramper> They were not really supported and deprecated
18:37:32FromDiscord<haxscramper> And finally removed before 1.0 I think
18:38:25FromDiscord<haxscramper> But I, too, would prefer 4-space indent with curly braces, and it won't be that difficult to write standalone frontend for nim compiler
18:42:47liblq-devheresy
18:43:26haxscramperAfter seveal years on nim I starting to think more and more often that I would prefer curly braces over indentation
18:44:33haxscramperAnd at this point I'm writing nim almost all the time, and not so much other languages.
18:46:07PrestigeThat's one of my biggest gripes about it, I fuck up indentation all the time
18:46:28FromDiscord<zetashift> Scala actually is transitioning from braces to indentation
18:47:10haxscramperYes, same here. Indentation-based paired with use-only-two-spaces is just a bit too unreadable at times.
18:48:34FromDiscord<checkersai> That's basically what I'm trying to do lol
18:48:52FromDiscord<checkersai> I wanted to write a brace-based skin over nim
18:49:28PrestigeIf you get something decent working let us know..
18:49:40FromDiscord<XxDiCaprioxX> quick question: is there a way to divide which returns an int (like in python `int1 // int2`)
18:49:54FromDiscord<haxscramper> @checkersai if you want to look for examples on writing lexer/parser in nim you can check out: https://gist.github.com/haxscramper/3562fa8fee4726d7a30a013a37977df6#writing-own-parser
18:50:03FromDiscord<zetashift> In reply to @XxDiCaprioxX "quick question: is there": `div`
18:50:11FromDiscord<checkersai> Thanks
18:50:26FromDiscord<haxscramper> And links at the bottom for examples of the parser for languages implemented in nim.
18:50:32FromDiscord<XxDiCaprioxX> thanks
18:50:55FromDiscord<zetashift> There is a repl bot here but I don't know how to call it to show an example sorry lol
18:55:19FromDiscord<zetashift> I find really nested blocks to be the only real buzzkill for me with Nim & Python
18:57:04FromDiscord<haxscramper> Using braced skip would also allow to use some existing pretty printer. clang-format is actually good enough to not break even unsupported languages
18:58:57FromDiscord<zetashift> pretty printer? Like a formatter or?
18:59:20FromDiscord<haxscramper> yes, code formatter
19:00:22FromDiscord<zetashift> ah yea
19:01:03FromDiscord<XxDiCaprioxX> 'nother quick question - is there an easy way of measuring elapsed time for efficiency purposes?
19:01:56*al1ranger joined #nim
19:02:45FromDiscord<haxscramper> https://github.com/treeform/benchy for microbenchmarking use this, or I guess `getCpuTime()`
19:06:16FromDiscord<checkersai> In reply to @zetashift "I find really nested": I don't like python for many reasons but yeah for Nim it's one of my only complaints
19:06:37FromDiscord<checkersai> And frankly it's kind of a minor complaint which is a testament to how great everything else is about Nim
19:07:12FromDiscord<XxDiCaprioxX> In reply to @haxscramper "https://github.com/treeform/benchy for microbenchma": thank you! do I put into `keep()` what WOULD be the result of my program or do I just call it at the end of the block?
19:08:06FromDiscord<XxDiCaprioxX> nevermind
19:11:12FromDiscord<XxDiCaprioxX> now this is probably a super dumb question but does: `-d:release` have any requirements normal compilation doesn't have?
19:12:17leorize[m]it just enables optimization and disable some very heavy debugging features
19:13:42FromDiscord<zetashift> In reply to @checkersai "And frankly it's kind": In practice I haven't seen it as a major roadblack, and I have yet to see a language that's as readable as Nim
19:16:27FromDiscord<XxDiCaprioxX> In reply to @leorize "it just enables optimization": Then it must be a different reason my compilation fails
19:17:42leorize[m]note that code can detect when it's being compiled with `-d:release` via `when defined(release)`, so your code might be taking a different branch
19:18:49leorize[m]@haxscramper no one really stops you from moving to 4-space indentation y'know :P
19:20:00FromDiscord<XxDiCaprioxX> In reply to @leorize "note that code can": nope, normal compilation also failed. thanks for the tip tho
19:22:20haxscramperleorize[m]: technically yes, but this doesn't bother me enough to manually switch over. When I will finally get time to write *working* pretty-printer I should add option to indent on four spaces
19:22:32haxscramperAnd reformat all my code with it
19:23:38FromDiscord<checkersai> hmm I'm thinking instead of writing a compiler from scratch, I can just fork the nim parser and make changes to it
19:24:23*al1ranger quit (Quit: Leaving)
19:27:00FromDiscord<haxscramper> I'm not sure how this partic in particular is implemented, but my guess is that you can just adapt code from https://github.com/nim-lang/Nim/blob/9abd383a2ae36e50ee23b78654e9d8154db46c84/compiler/main.nim#L90
19:28:07shmorgleI have ssh2-0.1.0 from the nimble directory
19:28:08FromDiscord<haxscramper> You can try using https://github.com/haxscramper/haxdoc - it provides sourcetrail integration, so you can quickly dive into compiler implementation and check how things are implemented and used
19:28:56shmorglewas trying to modify the simple ssh code given as an example, into something where I could say, read in a list of IPs
19:29:07shmorgleand connect to say 20 ssh hosts in parallel
19:30:24shmorgledoes anyone have a sample bit of code that shows how to loop over a list of IPs and do the async / await on that?
19:36:36*hoijui quit (Ping timeout: 246 seconds)
19:38:04FromDiscord<haxscramper> In reply to @checkersai "hmm I'm thinking instead": https://github.com/nim-lang/Nim/blob/9abd383a2ae36e50ee23b78654e9d8154db46c84/compiler/passes.nim#L139 I think you just need to start here, and reimplement `parseTopLevelStmt` and other necessary parts
19:41:28FromDiscord<checkersai> thanks again!
19:42:07FromDiscord<Recruit_main707> libertarian? 👀
19:43:18FromDiscord<checkersai> kekistani?
19:44:05FromDiscord<Recruit_main707> i see, you're a man of culture as well
19:44:50FromDiscord<checkersai> indubitably
20:05:45*narimiran joined #nim
20:42:35*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
20:42:59*Gustavo6046 joined #nim
20:50:11*narimiran quit (Ping timeout: 240 seconds)
20:57:54FromDiscord<brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=2UQD
20:59:32FromDiscord<brainproxy> nvm, this seems to have relevant info/answer: https://github.com/nim-lang/Nim/issues/15220
21:05:23FromDiscord<Tuatarian> Is there a way to take non-blocking keyboard input in the background?
21:12:03FromDiscord<Tuatarian> and send keyboard input from the bg as well
21:12:23*haxscramper quit (Remote host closed the connection)
21:25:08FromDiscord<checkersai> Where is `IdGenerator` defined?
21:25:18FromDiscord<demotomohiro> There are windows api that can do that but i forget api name
21:25:25FromDiscord<checkersai> (edit) "defined?" => "defined in the compiler?"
21:28:59FromDiscord<checkersai> nvm I got it
21:33:04*natrys quit (Quit: natrys)
21:38:19*Vladar quit (Quit: Leaving)
21:56:00ForumUpdaterBotNew thread by Tsojtsoj: Performance issue with closure, see https://forum.nim-lang.org/t/7738
22:03:10*wasted_youth2 quit (Ping timeout: 258 seconds)
22:03:59*wasted_youth2 joined #nim
22:18:44ForumUpdaterBotNew question by Alex Craft: How to normalise file path in Nim?, see https://stackoverflow.com/questions/66925906/how-to-normalise-file-path-in-nim
22:43:59*lritter quit (Quit: Leaving)
22:47:17*NimBot joined #nim
22:47:41*tane quit (Quit: Leaving)
22:53:21FromDiscord<Yardanico> nice spam, https://media.discordapp.net/attachments/371759389889003532/827677110159933450/unknown.png
22:58:06ForumUpdaterBotNew thread by Japplegame: Static tuple generic parameter, see https://forum.nim-lang.org/t/7740