<< 09-04-2022 >>

00:07:52*noeontheend joined #nim
00:20:47*ltriant quit (Read error: Connection reset by peer)
00:26:03*ltriant joined #nim
00:27:18*noeontheend quit (Ping timeout: 268 seconds)
01:07:23*SamuelMarks quit (Ping timeout: 268 seconds)
01:11:07*vicfred quit (Quit: Leaving)
01:20:39*neurocyte8614492 quit (Ping timeout: 246 seconds)
01:55:42*SamuelMarks joined #nim
02:02:39*SamuelMarks quit (Ping timeout: 246 seconds)
02:09:44*adigitoleo joined #nim
02:11:10*arkurious quit (Quit: Leaving)
02:12:36adigitoleoHi, I'm missing something simple here, any idea why toHex is different the second time? https://x0.at/JT1O.txt
02:16:20FromDiscord<Elegantbeef> Can you post the code here? https://play.nim-lang.org/
02:17:05FromDiscord<huantian> I got you beef https://play.nim-lang.org/#ix=3UEU
02:19:30adigitoleoAha, it works when I join strings with the slash already in them: https://play.nim-lang.org/#ix=3UEV
02:20:18FromDiscord<Elegantbeef> Well what it's' outputting is `\17\0\26` they're not escaped characters
02:21:13adigitoleoyeah I think I got it now, have to escape properly
02:21:42FromDiscord<Elegantbeef> or just turn it into a `char` `[17.char, 0.char, 26.char]`
02:22:04FromDiscord<Elegantbeef> which is just \`['\\17', '\\0', '\\26']\`\`
02:29:09*SamuelMarks joined #nim
02:37:19*SamuelMarks quit (Ping timeout: 256 seconds)
03:02:45FromDiscord<TryAngle> can I call nimscripts from bash?
03:02:54FromDiscord<TryAngle> (edit) "nimscripts" => "scripts written in nim"
03:03:37FromDiscord<TryAngle> (edit) "bash?" => "shell script?"
03:03:45FromDiscord<Elegantbeef> https://nim-lang.org/docs/nims.html standalone nimscript
03:05:03FromDiscord<huantian> wow that edit died
03:06:39FromDiscord<TryAngle> In reply to @Elegantbeef "https://nim-lang.org/docs/nims.html standalone nims": looks good but can I also use normal nim files?
03:06:51FromDiscord<TryAngle> (edit) "In reply to @Elegantbeef "https://nim-lang.org/docs/nims.html standalone nims": looks good ... but" added "enough"
03:06:54FromDiscord<Elegantbeef> think so
03:06:57FromDiscord<Elegantbeef> Dont recall
03:07:00FromDiscord<Elegantbeef> there is also nimcr
03:07:07FromDiscord<TryAngle> because there is always a binary generated
03:07:09FromDiscord<demotomohiro> You can import .nim files from .nims
03:12:34FromDiscord<demotomohiro> Running standalone nim script doesn't generage binary files
03:12:59FromDiscord<Elegantbeef> Even if there is just do `nim r` and you dont have the binary
03:13:12FromDiscord<TryAngle> ah true I forgot about nim r
03:13:45FromDiscord<TryAngle> so If I want to write scripts for example my window manager I could just nim r <script>?
03:14:48FromDiscord<huantian> or use a shebang
03:15:07FromDiscord<Elegantbeef> May want to look at nimcr
03:15:29FromDiscord<demotomohiro> Actually nim r generate c and object files in nimcache.
03:15:43FromDiscord<Elegantbeef> Who said it didnt?
03:16:08FromDiscord<Elegantbeef> `nim r` doesnt have the binary in the directory is my point
03:16:14FromDiscord<demotomohiro> Ol
03:16:17FromDiscord<demotomohiro> Ok
03:17:20FromDiscord<TryAngle> In reply to @Elegantbeef "`nim r` doesnt have": yeye, tha'ts also the only thing I was looking for
04:04:27FromDiscord<huantian> Can I get testament to disable a test on everything but windows?
04:05:06FromDiscord<Elegantbeef> still with the CI issues?
04:05:40FromDiscord<huantian> at this point I've just given up and made a seperate test file for win and `include`d the other file \:P
04:06:18FromDiscord<Elegantbeef> Maybe flywind can help
04:07:31FromDiscord<xflywind> IMO it is to be implemented, I would use when defined(windows) atm.
04:08:54FromDiscord<huantian> last time I checked when didn't work with the testament spec
04:11:05NimEventerNew thread by Jwatson-CO-edu: Creation of Variant Types with Table Members, see https://forum.nim-lang.org/t/9093
04:11:49FromDiscord<huantian> context is trying to get the test for https://github.com/nim-lang/Nim/pull/19622 work on windows, since it uses backslashes
04:12:56FromDiscord<huantian> The easy way out would just be to not touch the test and just change the message \:P
04:13:08*toulene quit (Read error: Connection reset by peer)
04:13:46*toulene joined #nim
04:15:19FromDiscord<Elegantbeef> Flywind i do have to ask if you're going to document the `fromJson` possibly having a dangling pointer
04:20:15FromDiscord<xflywind> In reply to @Elegantbeef "Flywind i do have": You have the better understanding of the issue. I would appreciate it if you could docuemdocument it.
04:21:34FromDiscord<Elegantbeef> I guess to me there is the question of "should it even be supported"
04:23:48FromDiscord<Elegantbeef> Deserializing a `cstring` is just such a silly thing to do without doing `create(char, json.str.len)`
04:24:54FromDiscord<xflywind> yeah
04:25:44FromDiscord<Elegantbeef> As such i'd argue just removing the branch
04:25:59FromDiscord<Elegantbeef> If you want to serialize a `cstring` do it yourself
04:28:03FromDiscord<xflywind> In reply to @huantian "context is trying to": I think disabling windows is good enough for tests. The error message doesn't seem to be platform specific.
04:31:12FromDiscord<huantian> Ok cool that seems good
04:32:43FromDiscord<xflywind> Or if you can utilize `tests/misctrunner` and check the output.
04:32:48FromDiscord<xflywind> (edit) "`tests/misctrunner`" => "`tests/misc/trunner`"
04:35:04*zeus-supreme joined #nim
04:35:12FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3UF8
04:35:54FromDiscord<Valdar> What am I doing wrong here:↵`if (stbi_info(fullName.cstring,width,height, n)) != 1:`↵` raise newException(IOError, "Cannot open file")`↵I still get "Error: unhandled exception:" Shouldn't that 'handle' it?
04:36:43FromDiscord<Elegantbeef> There is nothing handling an exception there
04:36:47FromDiscord<Elegantbeef> `try` handles exceptions
04:37:49*zeus-supreme1 quit (Read error: Connection reset by peer)
04:37:57FromDiscord<Valdar> ok, I tried try (no pun intended) and got the same. I was looking at code on Github and I don't see try used much
04:38:06*slowButPresent quit (Quit: leaving)
04:38:16FromDiscord<Valdar> what does raise do then?
04:38:59FromDiscord<Elegantbeef> raises an exception
04:39:00FromDiscord<Elegantbeef> try\:
04:39:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UF9
04:42:25FromDiscord<huantian> hm maybe I'll try this↵(@xflywind)
04:45:01FromDiscord<huantian> haven't seen this before
04:51:05FromDiscord<xflywind> It should have been documented in https://nim-lang.github.io/Nim/contributing.html
04:58:29FromDiscord<huantian> documentation? for the weak
05:18:06*SamuelMarks joined #nim
05:22:33*SamuelMarks quit (Ping timeout: 248 seconds)
05:23:38*yoyojambo joined #nim
05:24:29yoyojambohow much memory does a boolean ocupy?
05:24:44yoyojambolike if I had a sequence of booleans that is
05:25:36FromDiscord<Elegantbeef> 1 byte per bool
05:25:48FromDiscord<Elegantbeef> Depending what you're doing you can just use a `set[T]`
05:25:51FromDiscord<Elegantbeef> What're you doing?!
05:25:56FromDiscord<yoyojambo> damn a whole byte?
05:26:14yoyojamboi was planning on creating a matrix of booleans
05:26:18FromDiscord<Elegantbeef> Yea nim doesnt do a bitseq for `seq[bool]`
05:26:29FromDiscord<Elegantbeef> C++ does that and it's a mistake
05:26:36FromDiscord<Elegantbeef> it requires all logic to specialize for bool so it's dumb
05:26:44FromDiscord<Elegantbeef> "matrix of booleans"?
05:26:48FromDiscord<Elegantbeef> Is that just flags?
05:27:05yoyojamboI mean like a sequence of sequences of booleans
05:27:11yoyojambolike a 2d sequence
05:27:32yoyojambowdym flags?
05:27:57FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/TiL
05:28:05FromDiscord<Elegantbeef> How big does this need to be and are these named?
05:28:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UFj
05:30:16yoyojambohmmm I'm not sure I follow what you're saying
05:30:37FromDiscord<Elegantbeef> What is this for?
05:30:57FromDiscord<Elegantbeef> What are these bools for, is my point
05:31:02FromDiscord<Elegantbeef> my question rather 😄
05:31:14yoyojamboahh
05:31:30yoyojamboit represents cells in the Game of Life
05:31:40yoyojamboConway's Game of Life
05:32:03yoyojamboits supposed to be a slice of the actual thing
05:32:49yoyojambobut I will save the actual cells as a seq of coordinates, and just make a 2d sequence of actual cells to compute the next gen
05:32:59FromDiscord<Elegantbeef> Well if the size is fixed or within `0..uint16.high` you could use a `seq[set[0..high]]` otherwise you need a bitvector
05:33:45yoyojamboit is not fixed
05:34:05FromDiscord<Elegantbeef> is the width of 65k to few?
05:34:50FromDiscord<Elegantbeef> https://github.com/treeform/bitty/ this does exist
05:35:22yoyojambothat could be very useful actually
05:35:26yoyojambothanks
05:35:56yoyojambobecause I could just make it so that it never calls for a big matrix
05:35:59FromDiscord<Elegantbeef> @treeform\: is there a reason you make your types `ref object` instead of just `type MyType {.byref.} = object`?
05:36:19yoyojambobut I just wanted to know how fast it would be too ridiculously big
05:38:12yoyojambobecause the actual coordinates are represented with BiggestInt so if i accidentally asked for a range that covered a really big area it would make a reaaaaaaly big array
05:38:28FromDiscord<Elegantbeef> Ah disregard this, you use it for aliasing performance
05:41:19FromDiscord<Valdar> Thx Beef, I found the issue with catching the error
05:41:29FromDiscord<Elegantbeef> Congrats
05:41:52FromDiscord<Elegantbeef> What was the issue?
05:42:40*rockcavera quit (Remote host closed the connection)
05:42:43FromDiscord<Valdar> My stupidity 🙂
05:43:00FromDiscord<Elegantbeef> PEBKAC is always the worsr
05:43:53FromDiscord<treeform> In reply to @Elegantbeef "<@107140179025735680>\: is there a": I don't know what that {.byref.} even does?
05:44:06FromDiscord<Valdar> The error was actually about 4 lines above where I was trying to fix it. I was tapping the file twice and I wasn't paying attention to the line number in there error mesg
05:44:06FromDiscord<treeform> ref object is what nim uses?
05:44:09FromDiscord<Elegantbeef> it makes all procedures take a reference to the object
05:45:08FromDiscord<treeform> what is the benefit of using {.byref.} vs ref object?
05:45:41FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/nGg
05:45:53FromDiscord<Elegantbeef> If it's for aliasing there is no benefit
05:46:11FromDiscord<Elegantbeef> If it's for ensuring the object is always passed as a reference to procedures it means you dont introduce nil semantics
05:46:34FromDiscord<Hamid_Bluri> wow
05:46:45FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/1oA
05:47:39FromDiscord<Elegantbeef> Wow what?
05:47:53FromDiscord<Hamid_Bluri> > it means you dont introduce nil semantics
05:48:28FromDiscord<Elegantbeef> I dont know why treeform uses `ref object` so no clue if it's actually an improvement
05:48:53FromDiscord<treeform> ref object are usually faster then objects because less copies
05:49:04FromDiscord<Elegantbeef> That's not true
05:49:32FromDiscord<treeform> unless object is very small
05:49:34FromDiscord<Elegantbeef> Nim optimises procedure passing based off size, and also move semantics means moves are done instead of copies where needed
05:49:58FromDiscord<treeform> not in my experience
05:50:12FromDiscord<treeform> compiler is really bad at removing copies and I must help it.
05:50:19FromDiscord<Elegantbeef> With arc/orc?
05:50:23FromDiscord<Elegantbeef> Or with refc?
05:50:26FromDiscord<demotomohiro> Sizeof(BitArray) would be small enough so pass by copy would be fine.
05:50:40FromDiscord<treeform> I think most of my experience is with refc
05:50:42FromDiscord<Hamid_Bluri> sent a long message, see https://paste.rs/264
05:51:12FromDiscord<Elegantbeef> Ah then there you go, we use two different runtimes mostly 😄
05:51:41FromDiscord<Hamid_Bluri> " different runtimes "?
05:51:57FromDiscord<Elegantbeef> the RC and refc behave differently
05:52:18FromDiscord<Elegantbeef> Orc/arc have movesemantics so some things are completely free
05:52:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UFn
05:53:26yoyojamboI know that there is some cool stuff about arc/orc, but what are the benefits of refc? Like what does it do better?
05:53:27FromDiscord<treeform> I mainly use ref object because its easier as well
05:53:37FromDiscord<treeform> if you use plain object now you got to var it everywhere
05:53:41FromDiscord<Elegantbeef> Well it also makes your code slower
05:53:52FromDiscord<treeform> and make sure you baby them about because they are mostly copies
05:54:23FromDiscord<treeform> in my experience plain object are just too much tourble
05:54:26FromDiscord<treeform> (edit) "tourble" => "trouble"
05:54:32FromDiscord<treeform> and make code slow
05:54:32FromDiscord<Elegantbeef> You now have a pointer indirection for the sequence so you now really destroy your cache
05:55:30FromDiscord<treeform> If an object contains a seq it might accidently trash your perf
05:55:40FromDiscord<treeform> because it not only copies the object but also the seq
05:56:20FromDiscord<Hamid_Bluri> In reply to @yoyojambo "I know that there": araq had a talk about it in 2020 i guess↵the archive is available in nim youtube channel
05:56:21FromDiscord<treeform> if you can prove that you can speed up our code with objects we will take the PRs
05:56:58FromDiscord<treeform> main benefits of refc is that it had less bugs.
05:57:11FromDiscord<treeform> but arc/orc is pretty good
05:57:22FromDiscord<treeform> just waiting for it to be the default really
05:57:29FromDiscord<Elegantbeef> But anyway you said your piece and i understand i'll shush now
05:57:29FromDiscord<Elegantbeef> You now have the indirection of `mydata` then indirection of `bitseq` then finally indirection of that seq's data
05:57:30FromDiscord<Elegantbeef> You've really throttled the cache now
05:57:30FromDiscord<Elegantbeef> peace rather 😄
05:57:31yoyojambothanks Hamid I'll check it out
05:57:32FromDiscord<Elegantbeef> Arc/orc will make some of your usages of `ref object` deprecated though 😄
05:57:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UFo
05:57:49FromDiscord<Elegantbeef> Oh boy did matrix crash 😄
05:58:26FromDiscord<treeform> I love making things fast. If you can speed up any of my code's hot paths, PRs welcome.
05:58:37FromDiscord<treeform> Its not like I love "ref objects"
05:58:46FromDiscord<treeform> if shown some thing be faster i'll use
05:58:58FromDiscord<treeform> just not on toy examples
05:59:28FromDiscord<treeform> most code is not hot paths, so it really does not matter
05:59:48FromDiscord<treeform> but were it matters, I am interested
05:59:49*adigitoleo left #nim (#nim)
06:00:13yoyojambowdym hot paths? like stuff that makes a lot of changes to data?
06:00:30FromDiscord<Elegantbeef> hot paths are paths in the code that are often taken
06:00:51FromDiscord<treeform> its here you should optimize
06:00:55FromDiscord<Elegantbeef> This is talking about a `var a = b` right?
06:01:00FromDiscord<Elegantbeef> > If an object contains a seq it might accidently trash your perf
06:01:13FromDiscord<treeform> Like do you think switching https://github.com/treeform/pixie/blob/master/src/pixie/paths.nim#L31
06:01:20FromDiscord<treeform> path from ref to object will be faster?
06:02:20FromDiscord<treeform> We use plain object Path in the past and it was slower because copies
06:02:43FromDiscord<Elegantbeef> Do you have benchmarks i can test with?
06:02:58FromDiscord<treeform> yeah this one
06:02:59FromDiscord<treeform> https://github.com/treeform/pixie/blob/master/tests/benchmark_svg.nim
06:03:03FromDiscord<treeform> main bench for path filling
06:03:14FromDiscord<Elegantbeef> Ah ok thanks
06:13:58FromDiscord<huantian> If you wanna make fast arc code make everything sink and lent
06:14:02FromDiscord<huantian> That’ll be sure to help
06:22:10FromDiscord<Elegantbeef> Presently there is no difference between the three states
06:22:23FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/962236014687055882/image.png
06:31:51*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
06:34:36FromDiscord<treeform> It looks like you did make justObj go a little faster?
06:34:45FromDiscord<Elegantbeef> Nah
06:35:00FromDiscord<Elegantbeef> They're all within a margin of error
06:35:13FromDiscord<treeform> true
06:35:34FromDiscord<treeform> is this with arc?
06:35:41FromDiscord<treeform> intel cpu?
06:35:46FromDiscord<Elegantbeef> Nah with refc on an intel cpu
06:35:52FromDiscord<treeform> linux?
06:36:01FromDiscord<treeform> what does arc do?
06:36:06FromDiscord<Elegantbeef> Orc is around 2ms faster
06:36:14FromDiscord<treeform> show
06:36:21FromDiscord<Elegantbeef> Need to try all three again
06:38:03FromDiscord<Elegantbeef> 2ms faster but they're all within the same error
06:38:15FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/962240004548067418/image.png
06:38:28FromDiscord<Elegantbeef> That's with orc and assuming there isnt cyclic it's the same
06:38:37FromDiscord<Elegantbeef> same as arc\
06:39:34FromDiscord<treeform> its all even closer together now
06:39:39FromDiscord<Elegantbeef> Where you'll see benefits is if you're moving `Path` around of course
06:40:45FromDiscord<treeform> I think the SVG stuff moves paths around quite a lot
06:40:57FromDiscord<Elegantbeef> Into collections?
06:41:14FromDiscord<treeform> probably not
06:41:35FromDiscord<Elegantbeef> Yea that's what i mean though, it's a simple pointer assignment when you do `seq[Path].add`
06:42:01FromDiscord<TryAngle> Is there a good resource to understand the new arc / orc runtime?
06:42:26FromDiscord<Elegantbeef> There is the memory management docs, but it's just move semantics really
06:42:37FromDiscord<Elegantbeef> Nim unlike rust copies when it cannot move memory
06:42:56FromDiscord<TryAngle> Ah so it becomes "like rust" in that sense?
06:42:59FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html
06:43:18FromDiscord<Elegantbeef> Yes ARC is basically 1\:1 to rust's memory model minus a borrow checker
06:43:27FromDiscord<Elegantbeef> Orc is that memory model with a cycle breaker on top
06:43:36FromDiscord<TryAngle> Ah both sound awesome
06:44:08FromDiscord<Elegantbeef> https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html a nice writeup aswell
06:44:57FromDiscord<guzba> @treeform @ElegantBeef path is not a ref object vs non-ref for performance reasons. it was a plain object for a long time. it became a ref object for bindings generated by genny. complex basic value types + seqs or other gc memory does not work well together
06:45:15FromDiscord<guzba> when exported in a dll
06:46:00FromDiscord<guzba> instead we just give a the ptr to other languages and touch the dll / nim memory through dll api procs that are bound to in the other languages (eg python)
06:46:19FromDiscord<Elegantbeef> Generally speaking though the memory management is much smarter and you can encourage resources to be moved if needed
06:46:20FromDiscord<Elegantbeef> Like i showed prior, instead of copying on assignment sometimes memory is just moved if it can be
06:46:21FromDiscord<guzba> exporting a value type path from nim to python is crazy. value semantics + invisible refs + by copy etc
06:46:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UFA
06:47:37FromDiscord<Elegantbeef> To be fair in that case it was treeform's example 😛
06:48:17FromDiscord<Elegantbeef> When talking about the `Bitseq` i'd argue having the same semantics as all the other collections with a `BitSeqRef` seems sensible
06:49:08FromDiscord<Elegantbeef> Shit my arc showcase of move semantics isnt smart enough to show the actual movement
06:49:26FromDiscord<guzba> bitty is sort of a strange case. really using set[bool] is better whenever possible↵bitty only wins in unique access patterns and even then i could prob make set[bool] as fast
06:50:09FromDiscord<guzba> as for it being a ref type, for my i default to making things value type until it needs a seq on it
06:50:12FromDiscord<Elegantbeef> Eh you also might be able to just use `set[0..high]` depending on the use case
06:50:24FromDiscord<guzba> seq + object always copies and is absolutely horrible for performance in every case ive seen
06:50:26FromDiscord<guzba> maybe its better now
06:50:37FromDiscord<guzba> it also depends on how much proc param usage is likely
06:50:49FromDiscord<Elegantbeef> It always copies on copy yes, that's the semantics nim has 😛
06:50:53FromDiscord<guzba> strings also are very bad on object
06:51:04FromDiscord<guzba> yep its all good
06:51:14FromDiscord<guzba> its just i am not going to make something internal slower for no good reason
06:51:28FromDiscord<guzba> eg path filling, gzip encode/decode, png loading, etc
06:51:40FromDiscord<guzba> i never ever ever want an image blob of pixels to be copied
06:51:54FromDiscord<guzba> tree and i dispute ref vs value type all the time
06:52:07FromDiscord<guzba> such is programming
06:53:00FromDiscord<Elegantbeef> View types when
06:53:10FromDiscord<Elegantbeef> Personally i just prefer the cases where `ref T` needed use a `ref T`
06:53:28FromDiscord<Elegantbeef> And have my underlying `object` exist happily for places where i dont want extra indirection
06:53:35FromDiscord<Elegantbeef> But then again i dont write anything but toys 😛
06:56:25FromDiscord<guzba> that's a fine choice, wouldn't really want to hard position myself against that. i think for simplicity we simply have decided what best represents the concept and its usage pattern and just make it that. mostly a simple-for-our-use-case-probably-fine-for-everyone-else thing
06:56:48FromDiscord<guzba> not always really clear and we may do it different now if we could like "forget" a lib and re-do it
06:56:58FromDiscord<guzba> (edit) "not always really clear ... and" added "which way to go"
07:00:23FromDiscord<Elegantbeef> Hey be more like me and have no one use your code, it gets super easy to refactor!
07:01:52FromDiscord<guzba> i dunno if you can lay that claim anymore mr beef, i see stars on your repos
07:02:18FromDiscord<Elegantbeef> No issues though
07:02:53FromDiscord<guzba> perhaps they are simply perfect libs
07:03:28FromDiscord<Elegantbeef> Speaking of @auxym dont know if i bugged you properly in the issue but autolinking for picostdlib is done, give it a whirl when you get a chance
07:39:12*jmdaemon quit (Ping timeout: 260 seconds)
07:42:32FromDiscord<aph> ive successfully made nim dynamic with some random inheritance, i feel evil
07:44:03FromDiscord<Rika> Not really dynamic that way I don’t think
07:44:13FromDiscord<Phil> We can't do de-structuring of arrays right? Thinking of something like↵`let action, role = "add_guest".split("\_")`
07:44:15FromDiscord<Phil> (edit) ""add_guest".split("\_")`" => ""add_guest".split("_")`"
07:44:36FromDiscord<Elegantbeef> You can with macros, bunch of libraries that enable it
07:44:36*adigitoleo joined #nim
07:45:23adigitoleoDoes the first example work for anyone else: https://nim-lang.org/docs/tut3.html#introduction-generating-code
07:47:14FromDiscord<Solitude> yes, it does
07:47:55FromDiscord<aph> i got `/usercode/in.nim(1, 24) Error: expression expected, but found 'keyword let'` when running it on the playground
07:48:03FromDiscord<aph> In reply to @Rika "Not really dynamic that": true heh
07:48:03FromDiscord<Solitude> oh, you mean first small snippet
07:48:08adigitoleoYeah same, https://play.nim-lang.org/#ix=3UFH
07:48:47adigitoleothird exampe also doesn't want to compile
07:49:39FromDiscord<Solitude> someone wanted to play ascii golf and save on newlines
07:50:13adigitoleoHah, well that solves it
07:50:23adigitoleocheers
08:25:22*jjido joined #nim
09:19:40*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:33:20FromDiscord<aph> is there a type of a bit? i don't wanna use `int` then `.toBin` heh
09:36:23FromDiscord<aph> oh nvm doesn't seem to be one
09:36:59*lumo_e joined #nim
09:38:26FromDiscord<Rika> how would that work
09:40:30FromDiscord<aph> In reply to @Rika "how would that work": i'm finding a thing like bit array or smth, that stores 8 bits of true/false
09:40:50FromDiscord<aph> (edit) "In reply to @Rika "how would that work": i'm finding a thing like bit array or smth, that stores 8 bits of true/false ... " added "(1/0)"
09:41:21FromDiscord<aph> checking if there's things builtin heh but i'm sure `toBin` will work
09:42:36FromDiscord<aph> oh such thing will actually use more bytes.
09:42:48FromDiscord<aph> since bools are 8bits not 1
09:43:04FromDiscord<Yardanico> one way is to use bitsize and have an object with 8 bool fields with bitsize 1 i think
09:43:24FromDiscord<aph> In reply to @Yardanico "one way is to": ooh
09:44:01FromDiscord<Yardanico> but i'm sure there's an easier way, i just remember
09:44:32FromDiscord<Yardanico> sent a code paste, see https://paste.rs/oUT
09:44:37FromDiscord<Yardanico> (edit) "but i'm sure there's an easier way, i just ... remember" added "don't"
09:45:13FromDiscord<aph> `bitsize` is cool
09:45:54FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-bitsize-pragma
09:47:19FromDiscord<Yardanico> also you can use sets
09:48:15FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3UGk
09:48:39FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#types-set-type
09:49:38FromDiscord<aph> wait what wow
09:49:52FromDiscord<aph> that actually store less, cool
09:54:18FromDiscord<konsumlamm> In reply to @Elegantbeef "Yes ARC is basically": except that reference counting isn't the default in Rust
10:03:58*jjido joined #nim
10:16:07FromDiscord<Valdar> In reply to @aph "wait what wow": I use https://nim-lang.org/docs/bitops.html for bool type manipulation. Works great and fast as well
10:16:52FromDiscord<aph> woah thanks!
10:19:03FromDiscord<Valdar> np. you can do a lot with just toBin, fromBin, and testBit
10:19:45FromDiscord<Valdar> (edit) "np. you can do a lot with just toBin, fromBin, ... and" added "setBit, clearBit,"
10:26:06FromDiscord<Phil> Man, organizing an application is hard
10:36:52FromDiscord<Yardanico> In reply to @Valdar "I use https://nim-lang.org/docs/bitops.html for": yeah but specifically for bools sets are nicer to use
10:42:28FromDiscord<Valdar> Maybe it's what you get accustomed to, or maybe the use case. Sets look confusing to me, but maybe I'd need to invest more time in them.
10:43:44FromDiscord<Rika> theyre not a common feature in languages
10:44:04NimEventerNew thread by Dxb: Result of applying high()/low() to a range typedesc, see https://forum.nim-lang.org/t/9094
11:02:07FromDiscord<Valdar> Well, more accurately, I find the documentation for sets confusing. I really should give them a try at some point though.
11:04:21*zeus-supreme1 joined #nim
11:05:41FromDiscord<Yardanico> In reply to @Valdar "Well, more accurately, I": well you can also use the bitsize pragma for bools as I showed previously
11:06:01FromDiscord<Yardanico> i think it's a bit unclean to use bitops for storing multiple bools in one byte
11:06:10FromDiscord<exelotl> Sets are great!
11:06:11FromDiscord<Yardanico> since you don't even have the bools with different variables
11:07:25FromDiscord<exelotl> bitsize pragma has the problem that the nim compiler doesn't know the size of the object anymore
11:07:30*zeus-supreme quit (Read error: Connection reset by peer)
11:08:38FromDiscord<Yardanico> well, we were talking about 8 bools in 1 byte, the simplest case
11:08:54FromDiscord<Yardanico> sent a code paste, see https://paste.rs/s8h
11:09:25FromDiscord<Yardanico> but using sets for this is better anyway :)
11:09:33FromDiscord<Valdar> yeah, I can see where that would be very useful
11:10:46FromDiscord<exelotl> sent a code paste, see https://paste.rs/Mdm
11:10:57FromDiscord<Yardanico> well it didn't fail, it just showed 1
11:11:04FromDiscord<Yardanico> ah, compiletime
11:11:12FromDiscord<Yardanico> yeah you're right
11:11:13FromDiscord<Valdar> I'm doing a lot or ORing and ANDing with my use case, so bitops are a good fit for me
11:14:01*kayabaNerve quit (Ping timeout: 248 seconds)
11:17:39*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:18:00FromDiscord<ShalokShalom> sent a long message, see http://ix.io/3UGC
11:18:27FromDiscord<ShalokShalom> (edit) "http://ix.io/3UGC" => "http://ix.io/3UGD"
11:18:35FromDiscord<ShalokShalom> sent a long message, see http://ix.io/3UGD
11:21:38FromDiscord<Rika> shalok wrt. emacs, emacs or vi?
11:21:46FromDiscord<ShalokShalom> wrt?
11:21:52FromDiscord<Rika> with regards to
11:21:58FromDiscord<ShalokShalom> how you mean?
11:22:06FromDiscord<Rika> which do you prefer
11:22:16FromDiscord<ShalokShalom> doom
11:22:24FromDiscord<ShalokShalom> if it needs to be something out of this bunch
11:22:26FromDiscord<Rika> okay, thats all really
11:22:38FromDiscord<ShalokShalom> how you mean?
11:22:44FromDiscord<Rika> no i was just curious
11:22:49FromDiscord<ShalokShalom> ah, ok
11:32:09*lumidify quit (Ping timeout: 248 seconds)
11:37:39FromDiscord<Zoom> You know what, funnily, if you do a ton of dumb seq manipulations, including mass-concatenation of newly created single-element seqs, refc performs up to several times faster than arc/orc. As seen here\: https://forum.nim-lang.org/t/9079↵(<@709044657232936960_yoyojambo=5b=49=52=43=5d>)
11:41:59FromDiscord<Zoom> Except the sink/lent is completely backwards for now. You can lent-mark a return, but you can't lend an argument to a proc! It's comically frustrating. View types look like an unfinished job to me.
11:43:23FromDiscord<Rika> In reply to @Zoom "You know what, funnily,": because "faster" is not a good way to describe GCs
11:43:29FromDiscord<Rika> there's many kinds of "faster"
11:43:38FromDiscord<Rika> more throughput, less latency, ...
11:43:50FromDiscord<Rika> ARC is better in the latter, refc in the former
11:45:52FromDiscord<Zoom> For the code I described it's completely unambiguous. Faster = less allocs, which also means more throughput and less latency.
11:46:15FromDiscord<Yardanico> yeah ARC is more "correct" in that it cleans up right after the operation
11:46:25FromDiscord<Zoom> I use orc as a default, btw.
11:47:26*lumidify joined #nim
11:49:28FromDiscord<Yardanico> nice
11:55:37FromDiscord<Zoom> "BTW, I use ARC" lol
12:02:06FromDiscord<Phil> The arc beacons have been lit!↵No not the arch beacons!↵The ARC beacons!
12:11:44FromDiscord<ShalokShalom> @RikaYou are a beginner to Nim or programming?
12:12:14FromDiscord<ShalokShalom> Since we were talking the last time, and you meant you are also a beginner.↵I meant to programming as a whole, which might have sparked some confusion.
12:12:21FromDiscord<ShalokShalom> I guess you mean to Nim.
12:13:10FromDiscord<Rika> i was
12:13:13FromDiscord<Rika> not anymore
12:13:23FromDiscord<Rika> my point was that
12:13:31FromDiscord<Rika> when i was a beginner, i didnt think it was confusing
12:13:46FromDiscord<Rika> of course that anecdote has a sample of 1
12:19:58FromDiscord<ShalokShalom> Yeah, but to programming or Nim?
12:20:08FromDiscord<ShalokShalom> Since I think obviously, that makes a difference.
12:21:53FromDiscord<Rika> ah
12:22:12FromDiscord<Rika> uh to nim technically since by then i had maybe 2 years effective programming experience with python
12:22:23FromDiscord<Rika> but i still learned a lot by moving to nim
12:23:00FromDiscord<Rika> speaking of, i'm thinking maybe i should try porting an async framework, python's trio got me interested
12:27:21FromDiscord<ShalokShalom> Do you know the Erlang model?
12:30:19FromDiscord<Rika> no
12:30:37FromDiscord<Rika> it might be difficult to port that
12:44:48FromDiscord<Tanguy> sent a code paste, see https://paste.rs/Iqm
12:44:57FromDiscord<Tanguy> Or something equivalent
12:52:57FromDiscord<Zoom> Why do people insist on breaking stuff? May be return pointer from hey?
12:54:01FromDiscord<Rika> In reply to @Tanguy "Is it possible to": Maybe use an actual global?
12:56:41FromDiscord<Tanguy> Ofc my real use case is more complex than that, I can't return a pointer nor use a real global
12:57:47FromDiscord<Zoom> Then I can only suggest you stop trying to milk a stone.↵(@Tanguy)
12:58:40FromDiscord<xflywind> sent a code paste, see https://paste.rs/WR4
12:59:45FromDiscord<Tanguy> Mhh, smart
12:59:53FromDiscord<Tanguy> Thanks!
13:01:02FromDiscord<xflywind> you are welcome
13:32:54*jjido joined #nim
13:36:38*jjido quit (Client Quit)
13:44:19*SamuelMarks joined #nim
13:54:02*arkurious joined #nim
13:58:29FromDiscord<demotomohiro> I wonder why you cannot declare zMyvariable as global and you need to declare global inside proc?
14:03:33*SamuelMarks quit (Ping timeout: 256 seconds)
14:07:40*SamuelMarks joined #nim
14:10:12FromDiscord<Valdar> In reply to @demotomohiro "I wonder why you": Is this not global?↵https://play.nim-lang.org/#ix=3RVf
14:11:27*rockcavera joined #nim
14:11:27*rockcavera quit (Changing host)
14:11:27*rockcavera joined #nim
14:13:38FromDiscord<leorize> try sharing it again, that link got me a python script
14:17:07FromDiscord<Valdar> um, yeah, it does. That's weird. Is playground broken again?
14:19:27FromDiscord<aph> maybe ix.io broke
14:20:08FromDiscord<Valdar> it runs, but when it share it changes everything to python lol
14:20:33FromDiscord<Valdar> try this. I manually put in the env↵https://play.nim-lang.org/#ix=3UHc
14:21:13FromDiscord<aph> this one isn't python this time
14:21:15FromDiscord<aph> weird
14:21:18FromDiscord<aph> ¯\\_(ツ)\_/¯
14:23:02FromDiscord<demotomohiro> variables outside of a proc become global variable in C.
14:23:50FromDiscord<Valdar> correct
14:24:19FromDiscord<Valdar> did I misread what you meant?
14:27:54FromDiscord<demotomohiro> @Tanguy Said cannot use a real global variable and @xflywind 's {.global, exportc.}/{importc,nodecl.} code works. That sound like strange.
14:29:52FromDiscord<Valdar> Yeah, not sure in what context he couldn't create/use a global
14:31:36FromDiscord<Tanguy> sent a code paste, see https://paste.rs/Uau
14:32:12FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/qkh
14:32:16FromDiscord<Rika> In reply to @Tanguy "Basically, I have a": Sounds very fragile.
14:32:49FromDiscord<Rika> In reply to @Patitotective "is there a shorter": What are you trying to avoid? You’re still allocating a new string with the lower half
14:32:51FromDiscord<demotomohiro> In @xflywind 's code, zMyvariable is declared as let but zMyvariable is declared as var outside of the proc. That looks wrong.
14:35:37FromDiscord<!Patitotective> In reply to @Rika "What are you trying": id like define all the variables in a single statement↵also, if i could set the `"00"` to all variable too
14:35:37FromDiscord<Valdar> In reply to @Tanguy "Basically, I have a": can't you just instantiate the variable before you enter the block?
14:35:42FromDiscord<!Patitotective> (edit) "variable" => "variables"
14:36:35FromDiscord<Tanguy> Because it's a recursive macro, no
14:37:05FromDiscord<Valdar> In reply to @Tanguy "Because it's a recursive": 👍
14:37:29FromDiscord<leorize> you could use your global stash and put it in front of your procs instead↵(@Tanguy)
14:38:13FromDiscord<leorize> the thing with importc and exportc is that identifier mangling is disabled, and not to mention that you can't assume `{.global.}` will always be implemented that way
14:38:58FromDiscord<demotomohiro> @Tanguy xflywind's technique would not work if multiple variables in different procs have same name.
14:39:15*SamuelMarks quit (Ping timeout: 256 seconds)
14:39:41FromDiscord<Tanguy> Don't worry about me, I know it's a hacky workaround, but it's all I need at the moment, and more importantly, the only easy way to plonk this into my existing macro 🙂
14:40:16FromDiscord<leorize> you can just `= "00"` all of them at declaration lol↵(@!Patitotective)
14:40:47FromDiscord<!Patitotective> In reply to @leorize "you can just `=": but i need to do the `newString` stuff
14:40:55FromDiscord<!Patitotective> (edit) "In reply to @leorize "you can just `=": but i need to do the `newString` stuff ... " added "(like, define their size)"
14:41:02FromDiscord<leorize> why?
14:41:31FromDiscord<!Patitotective> cause those are the buf of my `igInputText` (dear imgui)
14:41:36FromDiscord<Yardanico> In reply to @Patitotective "is there a shorter": you don't need slices here btw
14:41:46FromDiscord<Yardanico> if it's already 2 chars and you're assigning two chars
14:41:50FromDiscord<Rika> In reply to @Patitotective "cause those are the": What does that have to do with?
14:41:52FromDiscord<Yardanico> or do you want to prevent a copy or something
14:42:05FromDiscord<Yardanico> In reply to @Patitotective "cause those are the": nim automatically resizes the buffer of strings for you
14:42:17FromDiscord<!Patitotective> let me try it
14:42:18FromDiscord<Yardanico> when you need to pass a string to a C function you just do `myCall(mystring[0].addr, mystring.len)`
14:42:29FromDiscord<Yardanico> that's if it's a simple ASCII string of course
14:42:56FromDiscord<leorize> if that's the case then there's a reason to do it like that
14:43:53FromDiscord<!Patitotective> it worked, thanks 🙃
14:44:36FromDiscord<leorize> Nim will keep strings in static memory until modifications are done on it. If you were to directly pass that to C code that modifies it, it might SIGSEGV
14:45:37FromDiscord<leorize> if the procs you're calling won't modify the string, then you can safely use the initial buffer from the constant assignment
15:06:03*lumidify quit (Ping timeout: 268 seconds)
15:09:54FromDiscord<xflywind> In reply to @demotomohiro "In <@658563905425244160> 's code,": `let zMyvariable {.importc, nodecl.}: int` this works too.
15:16:10FromDiscord<ITR> Is there any way I can declare a proc has no side effects, even if it technically does?
15:17:06FromDiscord<leorize> put all the code in the proc body in this block\: `{.cast(noSideEffect).}:`
15:22:57FromDiscord<xflywind> Is it possible to implement karax like dsl using typed ast?
15:26:17*slowButPresent joined #nim
15:28:23FromDiscord<ITR> In reply to @leorize "put all the code": ty
15:40:35FromDiscord<leorize> yes, but it will be painful↵(@xflywind)
15:45:10*PMunch joined #nim
15:49:25FromDiscord<xflywind> In reply to @leorize "yes, but it will": With untyped, I cannot use getImpl on procs in dsl. My current workaround it to store the impl node of procs at compile time by proc name. I duuno how far I can go with untyped ast.
15:50:11*Gustavo6046 joined #nim
15:52:10*Gustavo6046 quit (Max SendQ exceeded)
15:53:20*Gustavo6046 joined #nim
16:01:22FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/vYo
16:02:49FromDiscord<Yardanico> no, but you can just format yourself
16:02:58FromDiscord<Yardanico> https://nim-lang.org/docs/strutils.html#intToStr%2Cint%2CPositive minchars
16:03:08FromDiscord<Yardanico> `echo intToStr(1, 2)`
16:03:22FromDiscord<!Patitotective> 👍
16:22:13*vicfred joined #nim
16:23:00FromDiscord<Ayy Lmao> sent a code paste, see https://paste.rs/Rpe
16:24:04FromDiscord<Ayy Lmao> I can't seem to find a way to have conditional compilation within the same type block
16:25:44FromDiscord<Ayy Lmao> Actually I probably don't even need these functions to live in the platform data.
16:26:53PMunchHmm, not sure if you can do that
16:27:11*vicfred quit (Quit: Leaving)
16:27:40FromDiscord<Yardanico> In reply to @Ayy Lmao "Is it possible to": maybe what you want is this?
16:27:53*SamuelMarks joined #nim
16:27:56FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3UHB
16:28:33FromDiscord<Yardanico> ah nvm, I see what you mean, recursive types
16:29:16FromDiscord<Yardanico> if it's possible in your code, you can just place ClientPlatformData below Client
16:29:26FromDiscord<Ayy Lmao> I am actually able to get away with having the recursive type functions live in the `Client` object itself so I can avoid this issue
16:29:27FromDiscord<Yardanico> ah nvm, that won't work again
16:29:46FromDiscord<Ayy Lmao> But still curious if there is some way to get something like that to work
16:30:19FromDiscord<Ayy Lmao> Can you not forward declare a type?
16:31:01FromDiscord<Ayy Lmao> I tried but then the compiler complains about duplicate definitions
16:31:28FromDiscord<Phil> Out of curiosity, how do you actually style your stuff on desktop applications? Is there something CSS like?
16:31:34FromDiscord<Yardanico> In reply to @Ayy Lmao "Can you not forward": there's a thing but it's not really tested
16:31:36FromDiscord<Yardanico> https://nim-lang.org/docs/manual_experimental.html#package-level-objects
16:31:44FromDiscord<Yardanico> i mean that i haven't seen anyone use it
16:31:49FromDiscord<Phil> (edit) "like?" => "like?↵Not that I've ever done it or have active plans, the question just occurred to me"
16:32:24*SamuelMarks quit (Ping timeout: 246 seconds)
16:32:31FromDiscord<Yardanico> but they can only be passed as `ref` objects as said in the description
16:32:46FromDiscord<Phil> (edit) "me" => "me↵As a webdev I'm mostly familiar with the way of using HTML to define elements on a surface, styling it with CSS and giving it behaviour with JS:"
16:32:50FromDiscord<Phil> (edit) "JS:" => "JS."
16:33:08FromDiscord<Yardanico> In reply to @Isofruit "Out of curiosity, how": it depends, modern GUI frameworks have their own ways of styling
16:33:28FromDiscord<Yardanico> Qt basically uses CSS with some changes
16:34:06FromDiscord<Phil> I assume Qt defines elements as objects in whatever language is using QT and provides it with behaviour using that same language?
16:36:52*xet7 quit (Remote host closed the connection)
16:37:58*xet7 joined #nim
16:40:33FromDiscord<spoon> is there any documentation on nimeval/llstream/any of the compiler modules?
16:43:05*Gustavo6046 quit (Ping timeout: 248 seconds)
16:55:49*lumo_e quit (Ping timeout: 268 seconds)
16:59:32FromDiscord<auxym> In reply to @Elegantbeef "Speaking of <@882793909246369864> dont": Will do!
17:04:55*vicfred joined #nim
17:10:39*jmdaemon joined #nim
17:34:40*zeus-supreme joined #nim
17:37:30*zeus-supreme1 quit (Ping timeout: 246 seconds)
17:39:53*PMunch quit (Quit: leaving)
17:41:13*SamuelMarks joined #nim
17:51:41*lumo_e joined #nim
17:54:26*neurocyte8614492 joined #nim
17:56:53*vicfred quit (Quit: Leaving)
17:57:36NimEventerNew thread by Araq: Lexim -- Regular expressions and lexer generation for Nim, see https://forum.nim-lang.org/t/9095
18:08:51*xet7 quit (Remote host closed the connection)
18:11:28*xet7 joined #nim
18:21:09FromDiscord<!Patitotective> is there a way i could send notifications from code? or do i need to depending on the system use a command?
18:25:07FromDiscord<d4rckh> @Phil hi, this was long time ago but i figured out how to split the file between threads 🙂
18:25:10FromDiscord<d4rckh> (edit) "🙂" => "😄"
18:25:40FromDiscord<d4rckh> before everything else im running a function which reads the file and splits it in multiple ones in the temp file
18:25:58FromDiscord<d4rckh> then those threads get the file name and can start a file stream against it
18:32:02FromDiscord<Phil> In reply to @d4rckh "<@180601887916163073> hi, this was": Wait, so you split the file into n tempfiles and read in one per thread?
18:32:05FromDiscord<Phil> And that's.... faster?
18:32:18FromDiscord<d4rckh> yes...?
18:32:47FromDiscord<Yardanico> but can't you just read the file and pass the chunks to the threads directly
18:33:04FromDiscord<d4rckh> i tried
18:33:15FromDiscord<d4rckh> i kept getting memory leaks
18:33:20FromDiscord<Phil> I may not have enough knowledge of low level file stuff to comprehend how splitting a file in terms of computation isn't somewhere in the neighbourhood of reading the same file
18:34:22FromDiscord<Phil> The usecase was really massive files IIRC, right?
18:35:14FromDiscord<Ayy Lmao> Is it advised to use `create` and `dealloc` on a ref type if I have specific places from c interop where it's supposed to be created and destroyed?
18:35:17FromDiscord<d4rckh> yes, 3 to 100mb
18:35:39FromDiscord<Zoom> Do you read-only or write too? How massive we're talking?↵(@d4rckh)
18:35:57FromDiscord<Yardanico> In reply to @Ayy Lmao "Is it advised to": you can just used the usual creation together with GC_ref and GC_unref
18:36:00FromDiscord<d4rckh> In reply to @Zoom "Do you read-only or": im only reading from it, i just needed to split the file in chunk between multiple threads, its just a web fuzzer
18:36:08FromDiscord<d4rckh> (edit) "chunk" => "chunks"
18:36:21FromDiscord<d4rckh> https://github.com/d4rckh/vaf/blob/vaf-threads/src/utils/VafWordlist.nim#L12↵this is how im doing it now
18:36:58FromDiscord<Phil> I'm curious, how does that work? Can you just tell it to blindly jump 1 MB worth of data ahead and designate that as a new chunk to read in?
18:37:17FromDiscord<Ayy Lmao> In reply to @Yardanico "you can just used": Interesting, I had no idea those existed. I'm still newish at lower level interop. Thanks!
18:38:24FromDiscord<d4rckh> In reply to @Isofruit "I'm curious, how does": you supply the n thread count via an argument and the proc splits the list in n files and then the each file name is passed to each thread which can start its own file stream
18:38:34FromDiscord<d4rckh> (edit) removed "the"
18:41:53FromDiscord<Phil> sent a long message, see http://ix.io/3UI8
18:42:12FromDiscord<d4rckh> In reply to @d4rckh "https://github.com/d4rckh/vaf/blob/vaf-threads/src/": no, you can see the code here
18:42:15FromDiscord<Phil> (edit) "http://ix.io/3UI8" => "http://ix.io/3UI9"
18:42:24FromDiscord<Phil> (edit) "http://ix.io/3UI9" => "http://ix.io/3UIa"
18:43:07FromDiscord<d4rckh> its basically counting the lines and when it gets to the number of threads it setting the iterator to `0`
18:43:13FromDiscord<d4rckh> so it goes 0,1,2,0,1,2
18:43:17FromDiscord<Phil> Wordlistfile is your single file you want to read in?
18:43:21FromDiscord<d4rckh> yes
18:45:18FromDiscord<d4rckh> i just gave it a 139mb text file and it handled it just fine
18:45:26FromDiscord<d4rckh> it just took a bit to split it
18:49:35*jjido joined #nim
18:51:41FromDiscord<Yardanico> hm, I still think that there are better ways
18:51:49FromDiscord<Yardanico> also your code looks like it's doing a lot of allocations, e.g. `var word = prefix & line & suffix`
18:52:23FromDiscord<Phil> So you have a set of prefixes and a set of suffixes that count for all lines.↵You take a file, you read it in completely line-by-line through `strm` with a single thread and write every combination of prefix + line + suffix into their own temp-file. A set of prefix-line-suffix combinations always gets written into the same file.↵You then return the seq of temp filenames and read those in individually in some other module, I grasped that
18:53:06FromDiscord<d4rckh> yup
18:53:43FromDiscord<d4rckh> each thread has its own temp file with its own set of prefix-line-suffix combination
18:53:44FromDiscord<Phil> Oh yeah, for string concat a nice way is adding to an existing string
18:54:03FromDiscord<Phil> IIRC at least
18:55:00FromDiscord<d4rckh> In reply to @Yardanico "also your code looks": isnt & doing only concatnig?
18:55:02FromDiscord<d4rckh> (edit) "concatnig?" => "concating?"
18:55:29FromDiscord<Yardanico> yes, but it's also creating temp strings each time
18:55:33FromDiscord<Phil> I had this debate a while ago, IIRC & doesn't do it inline
18:55:35FromDiscord<Phil> (edit) "I had this debate a while ago, IIRC & doesn't do it inline ... " added "or sth"
18:55:42FromDiscord<d4rckh> oh, then im doing string formats
18:55:42FromDiscord<Phil> so `add` is preferrable
18:55:53FromDiscord<d4rckh> (edit) "doing" => "gonna do" | "formats" => "format"
18:55:57FromDiscord<jmgomez> hey guys, can you export a nim type to cpp as class instead of struct?
18:56:15FromDiscord<Yardanico> In reply to @d4rckh "oh, then im gonna": you can just do `var word = newStringOfCap(prefix.len + line.len + suffix.len)` and then `word.add` all 3. I think it should be better
18:56:30FromDiscord<Yardanico> i mean you don't neccessarily need newStringOfCap, it's just another optimization so there's only 1 new allocation
18:57:24FromDiscord<d4rckh> oh i see i see, thanks
18:57:58FromDiscord<Phil> I feel like I'm missing something though, what's stopping you from making a massive seq[String] for each line (since you're already reading those in) and passing references to that data structure around?
18:58:17FromDiscord<Phil> (edit) "each line" => "all the lines"
18:58:34FromDiscord<d4rckh> well that means im reading the entire file in right?
18:59:05FromDiscord<Phil> ` while strm.readLine(line):`↵This already reads in the entire file line by line, or am I missing something?
18:59:23FromDiscord<d4rckh> yes, line by line, but im not storing the entirety of the file in memory
18:59:24*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
18:59:34FromDiscord<Phil> Ahhhhh, memory constraints were what you're dealing with
18:59:50FromDiscord<Phil> See, I knew I was forgetting something
19:00:38FromDiscord<Phil> By splitting into temp files you can process them individually and keep your memory footprint below a certain level, which was the target (?)
19:00:55FromDiscord<d4rckh> yea
19:02:09FromDiscord<Phil> Hmm what were your results of the first naive approach I assume you've already done, meaning you only read in the first X lines into a seq[string] pass that forward, process it, once that's done read in the next etc. ?
19:02:49FromDiscord<d4rckh> memory leaks, but i didnt pass references <:big_think:729161514899996744>
19:03:54FromDiscord<Phil> Did you re-build a seq[string] every read-in or did you overwrite the lines in the seq[string] you built before?
19:04:06FromDiscord<Phil> (edit) "before?" => "before on your first read-in?"
19:04:17FromDiscord<Phil> (edit) "read-in" => "read-step" | "read-in?" => "read-step?"
19:04:27*SamuelMarks quit (Ping timeout: 256 seconds)
19:06:35FromDiscord<Phil> Either way, first things first, really cool it worked!↵Your solution really gets me thinking though how I myself would approach such an issue, thus all my questions ^^
19:08:28FromDiscord<d4rckh> i was reading the wordlist, split it by \n and then i calculated the start and end indexes for each thread
19:08:56FromDiscord<d4rckh> if there were 10 words and 5 threads, first thread would get 0-5 and second 5-10
19:09:01FromDiscord<d4rckh> (edit) "5" => "2"
19:09:15ormiretd4rckh: I had similar problem (though I was looking at binary data in fixed size packets rather than lines so the finagling of chunk boundaries would be different for you): https://play.nim-lang.org/#ix=3UIb and then `spawn` processing proc on each `MemSlice` in `parts`
19:10:57ormiretthat mmaps the whole file and lets the OS deal with how much of it is actually in memory
19:13:22*jjido joined #nim
19:23:08*SamuelMarks joined #nim
19:38:11*jmd_ joined #nim
19:38:37*jmdaemon quit (Ping timeout: 268 seconds)
19:40:35FromDiscord<spoon> variables/procs when creating an nimscript interpreter should persist until it's destroyed, right? if i use `evalScript`
19:44:08FromDiscord<spoon> nvm, found the problem
19:44:47*SamuelMarks quit (Ping timeout: 268 seconds)
19:45:58*SamuelMarks joined #nim
19:49:24FromDiscord<Knightmare Legion> sent a code paste, see https://play.nim-lang.org/#ix=3UIm
19:49:41FromDiscord<Knightmare Legion> (edit) "https://play.nim-lang.org/#ix=3UIm" => "https://play.nim-lang.org/#ix=3UIn"
19:53:19*SamuelMarks quit (Ping timeout: 260 seconds)
19:54:43*SamuelMarks joined #nim
19:55:43FromDiscord<Zoom> Do you need each thread to process exact same nimber of lines?↵(@d4rckh)
19:56:11FromDiscord<d4rckh> In reply to @Zoom "Do you need each": No
19:56:11FromDiscord<Zoom> Why not just iterate lines and send them to threads in a loop while you're reading them?
19:56:46FromDiscord<d4rckh> Well if I'm reading them in a single thread...
19:56:57FromDiscord<d4rckh> (edit) "Well if I'm reading them ... inthread" added "and sending" | "thread..." => "thread"
19:57:40FromDiscord<Zoom> Does your IO benefit from parallel access?
19:58:00FromDiscord<Zoom> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/962440693618442351): Do you need each thread to process exact same number of lines?
19:59:47FromDiscord<TryAngle> https://nim-lang.org/docs/osproc.html#execCmdEx%2Cstring%2Cset%5BProcessOption%5D%2CStringTableRef%2Cstring%2Cstring↵↵do I use this to execute shell commands for example in dotfiles?
19:59:59*SamuelMarks quit (Ping timeout: 256 seconds)
20:02:23FromDiscord<!Patitotective> which library should i use for playing audios?
20:02:42FromDiscord<d4rckh> In reply to @Zoom "Does your IO benefit": what do you mean?
20:03:05yoyojambowhy is there 'sort' and 'sorted' but no 'deduplicate' and 'deduplicated'?
20:03:49FromDiscord<Rika> https://nim-lang.org/docs/sugar.html#dup.m%2CT%2Cvarargs%5Buntyped%5D
20:03:54FromDiscord<Rika> because you can use this instead
20:05:13yoyojambohmm
20:05:34yoyojambobut deduplicate already returns the sequence deduplicated
20:05:48yoyojamboi meant a procedure that works in-place
20:06:13yoyojamboinstead of the current behavior
20:06:41yoyojamboof returning the copy
20:07:23FromDiscord<Zoom> I mean I still don't get why you split the file. You want to read the resulting multiple files in parallel?↵(@d4rckh)
20:08:12FromDiscord<Zoom> In which case, are you sure that reading the files is your bottlneck and reading in parallel makes a difference?
20:08:16FromDiscord<d4rckh> In reply to @Zoom "I mean I still": Yes, i need to split a large file in chunks and process it in parallel threads
20:10:31FromDiscord<Zoom> I got that. I don't get why you need it. What is the problem you're solving by splitting? Are the resulting file's contents ordered in some way and you want to preserve order for each thread?↵(@d4rckh)
20:10:57FromDiscord<d4rckh> I'm writing a web fuzzer
20:13:47FromDiscord<Rika> isnt "deduplicate" something to be used for inplace stuff?
20:14:08yoyojambonope. returns a new sequence
20:14:38yoyojamboidk why it isn't called deduplicated
20:15:26yoyojambosorta weird naming it's got going I guess
20:16:40FromDiscord<Zoom> That I see, it doesn't explain anything. Splitting a file may be required if each of the resulting will need a special treatment from the threads, or if there's some ordering constraints.↵(@d4rckh)
20:17:57FromDiscord<Zoom> You're reading the source file in a single thread, why not just send the data directly to worker threads.
20:20:56FromDiscord<huantian> In reply to @Knightmare Legion "Hello, could someone tell": just do `type S = object`
20:23:47FromDiscord<Yardanico> In reply to @yoyojambo "sorta weird naming it's": why?
20:24:03FromDiscord<Yardanico> ah right, for deduplicate you're right
20:24:42NimEventerNew post on r/nim by Thadeu_de_Paula: https://github.com/thadeudepaula/ide.nvim.git, see https://reddit.com/r/nim/comments/u01grx/httpsgithubcomthadeudepaulaidenvimgit/
20:27:27nrds<DarthOreo99> stil there even though acct deleted :P
20:28:43NimEventerNew post on r/nim by Thadeu_de_Paula: Nim + NeoVim + Native LSP, see https://reddit.com/r/nim/comments/u01jo8/nim_neovim_native_lsp/
20:29:19FromDiscord<Yardanico> In reply to @nrds "<DarthOreo> stil there even": you can't delete in IRC :)
20:29:29FromDiscord<Yardanico> and yes, the bot is too fast sometimes when people delete their posts
20:32:54nrds<DarthOreo99> It happens. We all done it. :)
20:33:48FromDiscord<Zoom> At the very least move the string alloc on ln42 out of the loop and reuse it.↵Doing `encodeUrl` in threads may also speed things up.↵(@d4rckh)
20:34:33FromDiscord<d4rckh> In reply to @Zoom "At the very least": Will do
20:36:31*SamuelMarks joined #nim
20:41:21*SamuelMarks quit (Ping timeout: 256 seconds)
21:00:36FromDiscord<TryAngle> sent a code paste, see https://paste.rs/fYP
21:01:04FromDiscord<Rika> most of us cant read rust code
21:01:17FromDiscord<Rika> im assuming this looks for processes with the names and thats it
21:01:30FromDiscord<TryAngle> yes basically iterating over all processes and get their pid
21:01:38FromDiscord<TryAngle> (edit) "yes basically iterating over all processes and get their pid ... " added "and name"
21:02:35FromDiscord<TryAngle> (edit) "yes basically iterating over all processes and get their pid and name ... " added "and their environment variables"
21:04:46*ltriant quit (Ping timeout: 272 seconds)
21:05:30FromDiscord<TryAngle> ah I found a port of psutils
21:15:18FromDiscord<!Patitotective> is there a way i could get an audio lenght in milliseconds? or play an audio until the end with https://github.com/paranim/parasound ?↵im using parasound and i need to `sleep(ms)` manually, and id like to be able to load different audio files with different lenghts↵https://play.nim-lang.org/#ix=3UII
21:18:58*dtomato quit (Quit: The Lounge - https://thelounge.chat)
21:19:21*dtomato joined #nim
21:20:12*SamuelMarks joined #nim
21:22:27FromDiscord<ITR> How can I tell what type a macro will return? It's listed as "untyped" and returns a function that has the return type "NimNode"
21:25:18*SamuelMarks quit (Ping timeout: 268 seconds)
21:32:46*ltriant joined #nim
21:43:15*wyrd quit (Ping timeout: 240 seconds)
21:53:04FromDiscord<Phil> Depends. A macro basically writes you code (or you can imagine it that way, strictly speaking IIRC it's the other way around), which can do a lot of different things. ↵With dot expressions you can literally tell it to write "myobj.someField", which, if "someField" is a static string that's passed into the macro, means the macro can't possibly know what field on "myobj" it will be accessing and thus not know which type there shall be
21:53:43FromDiscord<Phil> Therefore, if the macro is untyped you'll have to either comprehend what it does yourself to see whether that can be specified or it's a case where the actual type that comes out there could be anything
21:54:12FromDiscord<Phil> (edit) "that" => "you" | "be specified" => "replace the "untyped""
21:54:50FromDiscord<Phil> (edit) "way, strictly speaking IIRC it's the other way around)," => "way),"
21:55:16*wyrd joined #nim
21:59:21FromDiscord<Elegantbeef> Macros return code
21:59:25FromDiscord<Elegantbeef> That's all you can say for certainty
22:03:35FromDiscord<Elegantbeef> To be fair passing by reference is a lent argument
22:03:55FromDiscord<Elegantbeef> Now if you could do it on a per proc basis without `var` it'd be nice
22:07:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UIU
22:12:21FromDiscord<Zoom> Except it provides interior mutability.
22:12:29FromDiscord<Elegantbeef> What?
22:12:36FromDiscord<jmgomez> hey guys, when compiling a library that import headers that depends on another dll, how do you tell where they are? Using the passC argument or there is something else? If so, anyone knows what the one for ms?
22:13:08FromDiscord<Elegantbeef> Do you think i'm talking about `ref T`?
22:13:57FromDiscord<Elegantbeef> Nim generally does the cheapest operation on procedure calls, which means for larger objects to pass by reference, which is practically `lent`
22:14:09FromDiscord<Elegantbeef> I'm not talking about making a `ref object`
22:14:33FromDiscord<Elegantbeef> `--passL:"-LmyIncludePath"`
22:15:01FromDiscord<Elegantbeef> also or `-I`
22:15:25FromDiscord<jmgomez> but Im talking about the libraries needed to link
22:15:46FromDiscord<jmgomez> Not the headers
22:15:47FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UIW
22:16:00FromDiscord<Elegantbeef> Like i said `-L`
22:16:39FromDiscord<Elegantbeef> That adds a path to the linker, which it'll search for libraries
22:16:45FromDiscord<Elegantbeef> you might also need `-lMyLibName`
22:16:53FromDiscord<Zoom> Sorry, didn't get you. Still under the weather a bit.
22:16:55FromDiscord<Elegantbeef> I could be wrong about the issue though
22:17:02FromDiscord<Elegantbeef> Yea it's fine
22:17:43FromDiscord<jmgomez> ohh, ok. Sorry for the confusion
22:20:51FromDiscord<SirOlaf> I am back with a banger of a question. Does Nim have issues with really big files or something? I got about 200k lines of table initialization and it produces a binary that just kinda seems to abort
22:21:23FromDiscord<Elegantbeef> Nim doesnt have a problem with big files, are you perhaps misusing big files?
22:21:37FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UIX
22:21:55FromDiscord<Elegantbeef> I could be wrong not one for C/C++ compiler tinkering 😛
22:22:18FromDiscord<jmgomez> the file should be .dll?
22:22:38FromDiscord<SirOlaf> In reply to @Elegantbeef "Nim doesnt have a": Well it's misused in the sense that it's not worth it because my compile time jumped to like 6 minutes instead of 10 seconds. But the point is that it produces a binary that when run does nothing even if I add echoes and whatever
22:22:56FromDiscord<jmgomez> no worries, any hint is worth it. I have been here for a long time, cant think with clarity anymore lol
22:26:47*SamuelMarks joined #nim
22:29:43FromDiscord<Elegantbeef> Welll what's the code olaf?
22:29:55FromDiscord<SirOlaf> Can send in a moment, am waiting for it to compile once more
22:30:09FromDiscord<Elegantbeef> Ok
22:30:18FromDiscord<SirOlaf> But it's a big generated file, obviously I wouldn't write 200k lines by hand
22:30:37FromDiscord<vSkyleX> Hi, I would like to know what are the control flows in NIM and if it has the sequential one.
22:31:12FromDiscord<Elegantbeef> It's Nim and it has the standard `if` `elif` `else` `case` `for` `while`
22:31:23FromDiscord<Elegantbeef> "the sequential one"?
22:31:26*Gustavo6046 joined #nim
22:32:16FromDiscord<vSkyleX> In reply to @Elegantbeef ""the sequential one"?": user actions and computer logic that initiate, interrupt, or terminate transactions.
22:33:00FromDiscord<vSkyleX> does it execute code line by line or it reads the entire thing then it executes the code
22:33:12FromDiscord<Elegantbeef> It's compiled
22:33:22FromDiscord<vSkyleX> sequential means it executes it line by line
22:33:38FromDiscord<Elegantbeef> It's an imperative compiled language
22:33:54FromDiscord<SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3UIZ
22:33:56FromDiscord<SirOlaf> With my big generated file
22:34:05FromDiscord<vSkyleX> In reply to @Elegantbeef "It's an imperative compiled": gotcha thanks
22:35:17FromDiscord<Elegantbeef> I'm a bit confused why you have a file that's 200k lines, but nim should handle it fine
22:35:24FromDiscord<SirOlaf> I told you it's generated
22:35:31FromDiscord<SirOlaf> From a file that's even bigger
22:35:45FromDiscord<Elegantbeef> Eitherway can i see the file?
22:36:04FromDiscord<SirOlaf> Yeah, one second, gotta see what it depends on, it's a bit messy
22:36:23FromDiscord<SirOlaf> https://media.discordapp.net/attachments/371759389889003532/962481125173899274/wiztypedefs.nim https://media.discordapp.net/attachments/371759389889003532/962481125408796752/wiztypegen.nim
22:36:57FromDiscord<SirOlaf> Ignore non-idiomatic stuff or whatever
22:37:03FromDiscord<SirOlaf> Point is the big initialization
22:37:18FromDiscord<yoyojambo> is there any known bug that makes lowerBound return a very off index?
22:37:23FromDiscord<Elegantbeef> I'm just amazed this is a raw file 😛
22:37:47FromDiscord<SirOlaf> Sometimes you just gotta do what you gotta do 😼
22:37:58FromDiscord<Elegantbeef> You arent even using macros api, jeez you're a masochist
22:38:16FromDiscord<SirOlaf> I'm scared of how brutal the compiletimes might get with macros
22:38:23FromDiscord<SirOlaf> If this is already 6 minutes
22:38:51FromDiscord<Elegantbeef> I meant for the code gen
22:38:55FromDiscord<SirOlaf> Oh
22:39:17FromDiscord<SirOlaf> Yeah just did some old-fashioned magic because I got no idea how else to do it
22:39:41FromDiscord<Elegantbeef> Runs fine here
22:39:52FromDiscord<SirOlaf> That's odd
22:39:53FromDiscord<Elegantbeef> Took like 10s to compile and ran
22:39:53FromDiscord<Elegantbeef> `nim -v`?
22:39:57FromDiscord<Elegantbeef> Sorry 25s
22:40:21FromDiscord<SirOlaf> Am on devel, but tried stable as well
22:40:47FromDiscord<Elegantbeef> OS?
22:40:50FromDiscord<SirOlaf> Windows
22:40:52FromDiscord<SirOlaf> 10
22:41:00FromDiscord<Elegantbeef> Yea even the `$` of the output works
22:41:18FromDiscord<SirOlaf> What is the code you're running?
22:41:19FromDiscord<Elegantbeef> Are you sure you compiled `wiztypegen`?
22:41:34FromDiscord<jmgomez> In reply to @Elegantbeef "I could be wrong": you were absolutely right! Thanks a ton. It does compile now 🙂
22:41:35FromDiscord<Elegantbeef> `echo "hello"; echo wizTypeRegistry`
22:41:53FromDiscord<Elegantbeef> Fuck i might be smarter than i think!
22:43:27*vicfred joined #nim
22:45:03FromDiscord<SirOlaf> Can the vm or something time out
22:45:13FromDiscord<SirOlaf> Because it does not want to work for me
22:45:30FromDiscord<Elegantbeef> What's your CPU?
22:45:36FromDiscord<Elegantbeef> You said it compiles
22:45:37FromDiscord<SirOlaf> 2700x
22:45:43FromDiscord<SirOlaf> Yeah it compiles, but takes 6 minutes
22:45:47FromDiscord<Elegantbeef> Yea you have a higher IPC than me iirc
22:46:15FromDiscord<Elegantbeef> You are just compiling `wiztypegen` right?
22:46:16FromDiscord<Elegantbeef> The one with 200k loc
22:46:32FromDiscord<SirOlaf> I tried importing it and I tried adding code to the big file
22:46:41FromDiscord<SirOlaf> Both options produce something that does not work
22:46:54FromDiscord<SirOlaf> And takes forever to compile
22:47:01FromDiscord<Elegantbeef> Well i dont know what to say, try a different C compiler
22:47:08FromDiscord<Elegantbeef> If that doesnt change anything try WSL2
22:47:24FromDiscord<Elegantbeef> If that doesnt change anything, i dont know cry or something
22:50:52FromDiscord<SirOlaf> What gc did you use
22:51:01FromDiscord<SirOlaf> Because it does seem to work with refc
22:52:06FromDiscord<SirOlaf> So may just be another arc bug
22:53:06FromDiscord<SirOlaf> Yeah that seems to be it, switching back to arc makes it produce trash again
22:53:21FromDiscord<Elegantbeef> Works fine
22:53:29FromDiscord<SirOlaf> With arc?
22:53:40FromDiscord<Elegantbeef> Takes a bit to compile like 30s but works ifne
22:53:51FromDiscord<SirOlaf> Well it breaks for me
22:53:56FromDiscord<SirOlaf> That's odd
22:54:21*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:54:55FromDiscord<SirOlaf> I can switch back and forth and it just works™️ with refc
22:57:38FromDiscord<SirOlaf> According to x64dbg it crashes with a stack overflow
22:58:46FromDiscord<SirOlaf> So I guess that explains why it may not happen for everyone
22:59:50FromDiscord<SirOlaf> This means the next question I have is why arc uses more stack space
23:02:37FromDiscord<Elegantbeef> Might need to increase your stacksize
23:03:08FromDiscord<Elegantbeef> Dont recall if a Nim flag for it exists
23:03:15FromDiscord<Phil> Huh.... my web application compiles with both default, arc and orc... guess I'll stick with arc because it's almost arch
23:03:40FromDiscord<SirOlaf> Well can pass to c compiler I guess, but why does it use so much/infer the wrong size in the first place
23:05:14FromDiscord<auxym> In reply to @Isofruit "Huh.... my web application": fyi, if you have cyclic refs and use arc, you will have memory leaks. that's the reason for orc's existence.
23:06:24FromDiscord<Phil> In reply to @auxym "fyi, if you have": Fair point! Hmmm well I guess the extra security will be pretty nice. I don't think there are any cyclical dependencies, but I could be wrong
23:08:08FromDiscord<Elegantbeef> Dont ask me it works here 😜↵(@SirOlaf)
23:08:31FromDiscord<Elegantbeef> use `--gc:arc -d:useMalloc` and valgrind it↵(@Phil)
23:08:35FromDiscord<Elegantbeef> If you leak use orc and try again
23:08:56FromDiscord<Elegantbeef> If you still leak you have an orc bug
23:09:19FromDiscord<Phil> But then I'd actually have to check if I leak memory
23:09:55FromDiscord<Elegantbeef> true
23:10:33FromDiscord<Phil> Wait, wasn't it `--mm:arc` ?
23:11:11FromDiscord<Elegantbeef> same thing
23:11:20FromDiscord<Elegantbeef> Pre 1.6 it was `gc`
23:13:07FromDiscord<SirOlaf> Epic, my code works with 500MB stack
23:13:27FromDiscord<Elegantbeef> Bit fucking big dont you think 😛
23:13:39FromDiscord<Phil> what happens if I do orc with usemalloc?↵I mean, that makes use of C's memory allocation... I'm not sure what that actually changes, fundamentally speaking
23:14:05FromDiscord<Elegantbeef> Nim's allocator doesnt return memory to OS, so valgrind doesnt know what a leak is
23:14:14FromDiscord<Elegantbeef> Valgrind works with malloc
23:14:17FromDiscord<SirOlaf> In reply to @Elegantbeef "Bit fucking big dont": Go big or go home
23:14:48FromDiscord<SirOlaf> 5MB does seem to be enough though
23:15:24FromDiscord<Elegantbeef> Are you using mingw?
23:15:39FromDiscord<SirOlaf> Me? I'm on gcc
23:15:46FromDiscord<SirOlaf> So I guess yes
23:16:25FromDiscord<Elegantbeef> Seems mingw doesnt work like normal gcc with stack
23:16:30FromDiscord<Elegantbeef> So explains why my gcc doesnt error but mingw does
23:16:43FromDiscord<SirOlaf> Probably just has higher default size
23:17:35FromDiscord<Elegantbeef> Yea i dont know i've never had stack issues so i think gcc has better sizing mechanisms
23:17:45FromDiscord<SirOlaf> Also fixed my compile time, so linker was seemingly just dying
23:18:18FromDiscord<Elegantbeef> Ah nice
23:18:20FromDiscord<TryAngle> @ElegantBeef u had a zip that accepted more than 2 right? may u link me it please 🥺
23:19:11FromDiscord<Elegantbeef> https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L151
23:19:49FromDiscord<Elegantbeef> https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L278
23:20:24FromDiscord<TryAngle> zipIter is faster right?
23:20:27FromDiscord<Elegantbeef> The last can be more memory efficient
23:20:43FromDiscord<Elegantbeef> Depends on the use case
23:20:59FromDiscord<Elegantbeef> "can be"
23:21:09FromDiscord<TryAngle> is slicerator up to date on nimble?
23:22:01FromDiscord<Elegantbeef> Say you pass in an iterator of `0..100` and `0..10` with a normal algorithm you iterate 100 times then 10 times and resize the sequence to 10, with that iterator you convert the iterators to closures then iterate until the first one is finished
23:22:05FromDiscord<Elegantbeef> So it's 10 iterations instead
23:22:10FromDiscord<Elegantbeef> It's on nimble
23:22:49FromDiscord<TryAngle> ah I see 🤔
23:22:51FromDiscord<TryAngle> thanks
23:23:27FromDiscord<Elegantbeef> It also can be more memory efficient since it copies the input data and doesnt make a large sequence
23:23:28FromDiscord<Elegantbeef> But this is all 'can' and it's not always faster than the `sequtils` zip
23:23:30FromDiscord<Elegantbeef> the sequtils zip takes in collections and as such they're fixed size, which means this can be done easily
23:24:45FromDiscord<Elegantbeef> I can make cases where either is faster or more memory efficient, case by case matters
23:25:28FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJ1
23:26:02FromDiscord<Elegantbeef> `.items`
23:26:32FromDiscord<TryAngle> ah, ok what does .items do?
23:26:36FromDiscord<TryAngle> return an iterator?
23:26:42FromDiscord<Elegantbeef> yes
23:26:59FromDiscord<SirOlaf> Got another, less convoluted question. Why does this crash if you set the stream position to say 0 and then call write? https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/streams.nim#L1248
23:27:18FromDiscord<spoon> hmm, why does iterating backwards using `for i in 10..1` not work? is that a design choice?
23:27:28FromDiscord<Elegantbeef> Yes
23:27:39FromDiscord<Elegantbeef> a range of `10..1` doesnt have any elements
23:27:45FromDiscord<Elegantbeef> `countDown(10, 1)`
23:28:19FromDiscord<Elegantbeef> It increases the cost of a simple `0..10` since it has to check if `a > b`
23:28:49FromDiscord<Elegantbeef> Olaf there is very little reason for a crash there
23:29:34FromDiscord<SirOlaf> Crashes for me
23:29:35FromDiscord<SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3UJ3
23:29:47FromDiscord<Elegantbeef> Runs fine here
23:30:00FromDiscord<SirOlaf> Are we just using different nims here
23:30:08FromDiscord<SirOlaf> How come everything works for you
23:30:20FromDiscord<Elegantbeef> Ah arc it crashes
23:30:27FromDiscord<SirOlaf> Ok good, I'm not just crazy
23:30:40FromDiscord<vSkyleX> Does Nim offer aliasing?
23:31:00FromDiscord<huantian> aliasing of variables?
23:31:07FromDiscord<vSkyleX> yup
23:31:56FromDiscord<SirOlaf> Found this stream crash when I was comparing a really bad custom bytestream to it
23:32:11FromDiscord<SirOlaf> So I wanted to switch but couldn't
23:32:14FromDiscord<Elegantbeef> This is really odd
23:33:50FromDiscord<Elegantbeef> Depends what you're doing but yea
23:33:50FromDiscord<huantian> probably just use a ref type, I think?↵(@vSkyleX)
23:33:51FromDiscord<Elegantbeef> Think it's something to do with the `sink`
23:34:01*yoyojambo quit (Quit: Leaving)
23:34:15FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/streams.nim#L1255 from here
23:34:54FromDiscord<Elegantbeef> Make an issue for it olaf if one doesnt exist "Creating a string stream with a string nil refs on write"
23:35:15FromDiscord<SirOlaf> Ok sure
23:35:44FromDiscord<Elegantbeef> You dont even need to set position
23:36:00FromDiscord<SirOlaf> Yeah I think it doesn't set it on init like that
23:36:07FromDiscord<Elegantbeef> Does it too
23:36:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UJ5
23:36:11FromDiscord<SirOlaf> But I do it anyways because that's the example I was gonna use it for
23:36:20FromDiscord<Elegantbeef> It's an issue with `sink`i think
23:36:20FromDiscord<Elegantbeef> So mention `arc`
23:37:53FromDiscord<Elegantbeef> it's odd that there are no tests that have caught this bug
23:38:19FromDiscord<SirOlaf> Well imagine my surprise when it failed, really seemed like something that would just work
23:38:47FromDiscord<Elegantbeef> It errors all the way back to `1.2.x`
23:38:50FromDiscord<Elegantbeef> So yea something is just wrong there
23:39:07FromDiscord<Elegantbeef> to work around it just dont pass a string then do `s.write`
23:39:45*SamuelMarks quit (Ping timeout: 246 seconds)
23:43:43FromDiscord<SirOlaf> Guess that works, but a tiny bit of extra work for my use case
23:44:53FromDiscord<SirOlaf> And not an obscure bug for once, I could see someone run into this one
23:47:05FromDiscord<Elegantbeef> Well it's obscure in that i dont see exactly what causes it, i replicated the logic and no error
23:47:44FromDiscord<SirOlaf> Always nice when reproducing it is hard
23:48:19FromDiscord<Yardanico> @ElegantBeef maybe for some reason Nim is not calling prepareMutation for the stream string?
23:48:29FromDiscord<Elegantbeef> Perhaps
23:48:31FromDiscord<Yardanico> yeah i think so
23:48:34FromDiscord<Yardanico> doesn't crash
23:48:42FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3UJ9
23:49:00FromDiscord<Elegantbeef> sink + copymem alias that away?
23:49:06FromDiscord<Yardanico> but again, looks like streams only does it with `copyMem` so nim really has no way of knowing the proc wants to modify that
23:49:14FromDiscord<Yardanico> so maybe it needs to be inserted in streams explicitly
23:49:49FromDiscord<Yardanico> that's actually documented in https://nim-lang.org/docs/destructors.html#copy-on-write
23:49:54FromDiscord<SirOlaf> Anyways, issue has been made, so my job here is done 😼
23:50:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UJa
23:50:09FromDiscord<Elegantbeef> That errors of course
23:50:42FromDiscord<Elegantbeef> Ah so inside `newStringStream` it needs a `prepareMutation`
23:51:08FromDiscord<Yardanico> yes
23:51:18FromDiscord<Elegantbeef> Well yardanico you found the fix you PR the fix 😛
23:51:24FromDiscord<Yardanico> noo you do it
23:51:32FromDiscord<Yardanico> im going to sleep anyway
23:51:33FromDiscord<Elegantbeef> No you!
23:51:35FromDiscord<Yardanico> 2:50 AM!!
23:51:47FromDiscord<Elegantbeef> Psh 10 minutes until 3 plenty of time
23:52:30FromDiscord<huantian> Submitting PRs at 3AM (GONE WRONG!)
23:52:39FromDiscord<Elegantbeef> Gone sexual\
23:53:04FromDiscord<Elegantbeef> Jeez yard really really wants me to fix it even thanked me in the issue
23:53:07FromDiscord<Elegantbeef> Fucking asshole
23:53:32FromDiscord<Elegantbeef> Jokes aside, nighty night