<< 20-11-2020 >>

00:16:23*hmmm quit ()
00:30:02FromDiscord<kodkuce> in nim if i change a char of stirng is whole new string created or just that char changes, i am not talking about adding more chars or deleting some just changing
00:30:11FromDiscord<kodkuce> (edit) "stirng" => "string"
00:33:01Zoom[m]@kodkuce how exactly do you perform that change?
00:33:29FromDiscord<kodkuce> var mysting = "i am string"
00:33:42FromDiscord<kodkuce> myasting[2] = 'z'
00:34:07FromDiscord<kodkuce> my logic is should not create a new string
00:34:21FromDiscord<kodkuce> or at least there is no need to
00:34:46mipriit doesn't create a new string.
00:37:12FromDiscord<kodkuce> ye i just tryed some JS stuff and was wtf
00:39:26miprithere not being a need to, depends. replacing the nth unicode rune of a string might change the width of the bytes involved. but mystring is directly mutated in your code. If you think you're seeing something else, you might be seeing value semantics when you're expecting reference semantics: mycopy = mystring; mystring[2] = 'z' won't create a new string the assignment, but it'll create a new one for mycopy
00:47:58Zoom[m]disruptek: I liked that paper on CPC. Skipped reading the proofs, obviously :)
01:00:00*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:01:06*njoseph joined #nim
01:13:04*hnOsmium0001 quit (Ping timeout: 240 seconds)
01:15:21*hnOsmium0001 joined #nim
01:20:43*Tanger joined #nim
01:52:37*NimBot joined #nim
01:57:58FromDiscord<Quibono> If I want an x by x array, how do I instantiate that?
01:59:15FromDiscord<Rika> array[N, array[M, Type]]
01:59:19FromDiscord<Rika> but
01:59:20FromDiscord<nikki> i think you mean 'initialize' (instantiation is for when specific versions of a generic proc are materialized)
01:59:24FromDiscord<Rika> uh
01:59:29FromDiscord<Rika> well i misread
01:59:49FromDiscord<Rika> well you dont really need to initialize it? its zero-set by default
02:00:19FromDiscord<nikki> yeah and if you wanna fill it you can just nested for loop 😄
02:01:15FromDiscord<InventorMatt> if you use fill from algorithms you don't even need to nest a for loop
02:02:13FromDiscord<Quibono> Sorry, yeah initialize.
02:03:47FromDiscord<Quibono> Trying to do a pagerank implementation in Nim.
02:12:28*abm quit (Read error: Connection reset by peer)
02:25:25FromGitter<jrfondren> little log munger that decompresses stdin and splits some lines. Rust: 150ms. Nim: 300ms. Nim (-d:danger --gc:arc): 200ms
02:25:35FromDiscord<Rebel> Best way to convert string to cstring? `cast[cstring](mystring)` will suffic?
02:25:45FromDiscord<Rika> mystring.cstring
02:26:15FromGitter<jrfondren> and then: I need some temporary transition code to auto-populate a column if it's missing. Nim: add an 'if' branch. Rust: uh I'd have to rewrite half the program, Nim is good enough, don't bother doing this.
02:26:50FromDiscord<Rika> lol
02:27:11FromDiscord<Rika> its fast enough, if you need any faster you'll be sacrificing sanity is what i thikn about nim vs rust
02:27:17FromDiscord<Rebel> Poggers thanks Rika
02:28:07FromGitter<jrfondren> unexpected late-comer requirements like "oh yeah mutate the input in such-and-such case" really screw with Rust, yeah. Oh suddenly all these &strs have to be Strings. great.
02:28:26*bung joined #nim
02:28:46FromGitter<jrfondren> incidentally -d:danger saves 30s and --gc:arc saves the rest. quite a large savings on this little app.
02:29:06FromDiscord<Rika> i like the &str vs String difference, just not how it's written
02:30:20FromGitter<jrfondren> yep, I imagine the rest of the savings for Nim is hidden in viewtype improvements and a viewtype-producing split. I'll look at this code again when I can add that
02:31:24*apahl quit (Ping timeout: 240 seconds)
02:33:35*apahl joined #nim
02:33:39FromDiscord<Rika> i believe views are being worked on soon, soon we shall say nim is faster than rust www
02:51:07FromDiscord<Rebel> Would one port this from golang to Nim via casting before calling fmt? Or can you do casting within fmt? `return fmt.Sprintf("%.1f %cB", float64(b)/float64(div), "kMGTPE"[exp])`
02:54:43FromDiscord<Rika> what are you casting?
02:54:54FromDiscord<Rika> fmt as in fmt""?
02:55:09FromDiscord<Rika> yes you can cast in the {} for fmt
02:56:57FromDiscord<Rebel> ah
02:56:59FromDiscord<Rebel> excellent
02:57:01FromDiscord<Rebel> there is a `formatFloat`
02:57:06FromDiscord<Rebel> (edit) "there is a `formatFloat` ... " added "in strutils"
02:59:18FromDiscord<Rebel> rtfm ftw
02:59:43FromDiscord<Rika> lmao
03:06:02*muffindrake quit (Ping timeout: 264 seconds)
03:08:09*muffindrake joined #nim
03:26:32FromDiscord<Plas> Anyone know how to do memory management in Nim?↵ie. allocating/deallocating bytes
03:29:48miprideclare a variable with a type containing bytes and you'll get bytes. newString or newSeqOfCap are probably what you want, but you can also alloc0(int.sizeof * 50) or whatever to get a pointer. http://zevv.nl/nim-memory/ goes into detail.
03:33:56FromDiscord<UNIcodeX> try `-d:lto` or `--passL:-flto`
03:35:02FromDiscord<ElegantBeef> Worth noting the new discord reply doesnt currenty do anything so for IC users it doesnt... show anything 😄
03:35:13FromDiscord<ElegantBeef> IRC users
03:35:18FromDiscord<ElegantBeef> It just says your message
03:36:48FromDiscord<Plas> lol
03:37:11FromDiscord<UNIcodeX> err. right. 😅
03:37:12FromDiscord<UNIcodeX> jrfondren: try adding those switches
03:38:39FromDiscord<UNIcodeX> well... one or the other that is.
03:42:02*thomasross quit (Quit: Leaving)
03:55:21*nekits07 quit (Read error: Connection reset by peer)
03:55:57*nekits07 joined #nim
04:06:01*supakeen quit (Quit: WeeChat 2.9)
04:06:37*supakeen joined #nim
04:08:22FromDiscord<emekoi> are there some things macros can't due even if they produce a valid AST?
04:08:33FromDiscord<Rika> like?
04:08:38FromDiscord<Rika> wdym?
04:09:47FromDiscord<emekoi> i'm writng a macro for serialization and i'm trying to use `?` to denote optional fields, but it won't work no matter what i do
04:10:25FromDiscord<emekoi> if i manually specify the field as `Option` it works just fine and produces the exact same AST
04:10:57FromDiscord<Rika> how are you checking the ast
04:11:21FromDiscord<emekoi> printing it with `treeRepr`
04:13:43FromDiscord<Daniel> What is AST?
04:14:14FromDiscord<emekoi> abstract syntax tree
04:15:17FromDiscord<Daniel> k, will google for those
04:15:25FromDiscord<Daniel> found this https://media.discordapp.net/attachments/371759389889003532/779198186840784946/1280px-Abstract_syntax_tree_for_Euclidean_algorithm.png
04:15:36FromDiscord<ElegantBeef> Can we see the macro?
04:18:32FromDiscord<emekoi> http://ix.io/2ELZ
04:21:23FromDiscord<emekoi> here are the errors i get: http://ix.io/2EM1
04:21:50FromDiscord<ElegantBeef> I threw it in nim playground i see the errors
04:27:55FromDiscord<ElegantBeef> Well i got it to work by making it get the typeof https://play.nim-lang.org/#ix=2EM2
04:28:03FromDiscord<ElegantBeef> line 52
04:30:03FromDiscord<emekoi> hmm, i guess type and typedesc aren't interchangable
04:30:12FromDiscord<emekoi> thanks for your help!
04:33:40*apahl quit (Remote host closed the connection)
04:34:05*apahl joined #nim
04:57:09FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> Question IRT the streams used OS procs (startProcess is what I'm using to start the proc). Am I missing something or is there just no way to just immediately return from `readStr` on the output and error streams?↵↵What I'm experiencing is that the `readStr` will block until the process finishes, which doesn't work for this application (I need to stream stderr/out as it happens)
04:57:20FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> (edit) "Question IRT the streams used ... OS" added "in"
04:58:12FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> It may be the underlying buffer isn't flushing to the stream until the process exits too, I'm not certain
05:29:15*rockcavera quit (Remote host closed the connection)
05:35:23*waleee-cl quit (Quit: Connection closed for inactivity)
06:16:51*muffindrake quit (Quit: muffindrake)
06:58:58*narimiran joined #nim
07:20:59*habamax joined #nim
07:28:11*vicfred_ joined #nim
07:28:24*natrys joined #nim
07:31:04*vicfred quit (Ping timeout: 265 seconds)
08:09:25*hyiltiz quit (Quit: hyiltiz)
08:17:37*antranigv quit (Ping timeout: 264 seconds)
08:36:19*Tanger quit (Quit: Leaving)
08:49:15*hyiltiz joined #nim
08:49:15*hyiltiz quit (Changing host)
08:49:15*hyiltiz joined #nim
08:50:59*jjido joined #nim
08:55:45*hnOsmium0001 quit (Quit: Connection closed for inactivity)
08:58:38FromDiscord<iWonderAboutTuatara> hey
08:58:53FromDiscord<iWonderAboutTuatara> I'm writing a rubiks cube solver, right now I'm just implementing logic for turns
08:59:11FromDiscord<iWonderAboutTuatara> the cube is represented as a type object with 6 arrays, each of which with 9 chars representing colors of the stickers
08:59:21FromDiscord<iWonderAboutTuatara> doing the rotations of the cube takes quite a lot of code
08:59:33FromDiscord<iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2EMK
08:59:46FromDiscord<iWonderAboutTuatara> Is there any way I can write a macro to automatically generate this?'
09:00:07*lum[m] quit (Quit: Idle for 30+ days)
09:00:08*hnOsmium0001[m] quit (Quit: Idle for 30+ days)
09:00:42FromDiscord<iWonderAboutTuatara> the rotation code itself I mean
09:00:43FromDiscord<Rika> i dont understand the code
09:00:46FromDiscord<iWonderAboutTuatara> because there's ~24 turns
09:01:16FromDiscord<iWonderAboutTuatara> basically, when you rotate the cube, sets of 3 stickers are rotated
09:01:46FromDiscord<iWonderAboutTuatara> if you turn the right side upwards, the 3 stickers on the bottom take the place of the 3 on the front, the front takes place of the top, etc
09:02:56FromDiscord<iWonderAboutTuatara> the way I'm doing it is that I copy the original values of the 3 stickers that I'll be replacing, then replace it with what it should be replaced with
09:03:07FromDiscord<iWonderAboutTuatara> there's a bit on the bottom which is different logic entirely
09:07:14FromDiscord<nikki> firstly, idk if rubiks cube rotations should be copying seqs...
09:07:47FromDiscord<Rika> why seqs? didnt you just say arrays
09:07:47FromDiscord<iWonderAboutTuatara> Probably not for speed reasons
09:07:51FromDiscord<nikki> i feel like since the layout is known you should be using arrays
09:07:58FromDiscord<Rika> okay
09:07:58FromDiscord<iWonderAboutTuatara> I don't know the difference honestly
09:08:10FromDiscord<Rika> memory layout
09:08:14FromDiscord<iWonderAboutTuatara> As in seq is probably slower
09:08:18FromDiscord<iWonderAboutTuatara> Than would be necessary
09:08:22FromDiscord<iWonderAboutTuatara> No like from my perspective
09:08:28FromDiscord<nikki> arrays have a static size and format. seqs are growable and have an intermediate obj with a ptr and size
09:08:35FromDiscord<iWonderAboutTuatara> Right
09:08:38FromDiscord<nikki> this is the perspective to have
09:08:58FromDiscord<iWonderAboutTuatara> But every time in the past I've tried to use arrays, something subtly broke and I've just switched back to seq
09:09:26FromDiscord<nikki> sure. another approach is just using an object that has defined layout for everything
09:09:38FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2EMP
09:10:27FromDiscord<nikki> it seems like a 3x3x3 array works? with colors at each point
09:10:29FromDiscord<Rika> the ptr is the major thing in the seq that makes it slower
09:11:01FromDiscord<nikki> needing heap allocations on every copy, and potential cache misses on every access
09:11:23narimirani see lots of repeated 2, 5, 8 code. you can refactor that
09:11:26FromDiscord<Rika> i think the cache misses is the major performance factor
09:11:45FromDiscord<iWonderAboutTuatara> Performance doesn't matter too much
09:11:46FromDiscord<nikki> i agree, unless you copy seqs every time you rotate like in this code
09:11:56FromDiscord<nikki> in which case allocations maybe come up too
09:12:00FromDiscord<iWonderAboutTuatara> @narimiran how would I refactor that?
09:12:07FromDiscord<iWonderAboutTuatara> This is just the first thing they came to mind
09:12:36FromDiscord<nikki> sure, but it's actually easier to write with arrays
09:12:41FromDiscord<iWonderAboutTuatara> This is the rotation function, if there's a way to change it that would make my life easier or would make it much faster without too much headache km willing
09:12:46narimiransomething like `proc doStuff(to, from: seq[char]) = to[2] = from[2]; etc.`
09:13:00narimiranand then `doStuff(cube.u, cube.f)`
09:13:08FromDiscord<iWonderAboutTuatara> Oh that would make it less messy
09:13:15FromDiscord<nikki> i only bring it up cuz, if sugaring it anyways, may as well sugar an array
09:13:15FromDiscord<iWonderAboutTuatara> Good idea
09:13:16Zoom[m]Why not implement a 3x12 array to simplify at least horizontal moves?
09:13:30FromDiscord<iWonderAboutTuatara> I don't know
09:13:41FromDiscord<iWonderAboutTuatara> This is the first thing that came to my mind
09:14:11FromDiscord<iWonderAboutTuatara> @nikki how would I switch this to using arrays?
09:14:17FromDiscord<Rika> well the first thing you think of is rarely the best solution to take
09:14:31FromDiscord<iWonderAboutTuatara> Agreed, but this isn't a professional product
09:14:46FromDiscord<iWonderAboutTuatara> Just my own fun, I don't think anybody will ever use it
09:14:49FromDiscord<Rika> yeah but this is good practice for coding better innit?
09:14:53Zoom[m]At least in one direction there's no change in colour sequence, so you need to move arrays, not items
09:14:53FromDiscord<nikki> yeah but to learn, you have to do it right
09:15:04FromDiscord<nikki> anyways; i think 3x3x3 array
09:15:08FromDiscord<nikki> of color enums
09:15:11*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:15:21FromDiscord<iWonderAboutTuatara> I thought about 3x3x3, the issue is thinking in pieces vs stickers
09:15:36FromDiscord<iWonderAboutTuatara> Of tuples of color enums right?
09:15:39FromDiscord<nikki> cool. so what layout are you thinking 🤔
09:15:49FromDiscord<iWonderAboutTuatara> Pretty much what I have
09:15:53Zoom[m]Reasoning in 3d is hard
09:15:59FromDiscord<iWonderAboutTuatara> @Zoom seems to have an interesting idea as well
09:16:00FromDiscord<nikki> i don't think i parsed it fully tbh
09:16:01*PMunch joined #nim
09:16:02FromDiscord<iWonderAboutTuatara> Yeah also that
09:16:33FromDiscord<nikki> all that was known was it's static / bounded at least
09:16:39FromDiscord<iWonderAboutTuatara> Cube is a type made of 6 seqs, each of which contains the stickers for one face
09:16:41FromDiscord<nikki> another thing that helps is some kinda neighborhood graph thingy
09:16:55FromDiscord<nikki> ah i see ok cool
09:17:06FromDiscord<nikki> yeah so i think it helps to do faces such that
09:17:19*hmmmmm joined #nim
09:17:20FromDiscord<nikki> you do front / back as 1 bit
09:17:25FromDiscord<nikki> and left right as another
09:17:26hmmmmmhallo :>
09:17:29FromDiscord<nikki> and top bottom as another
09:18:18FromDiscord<iWonderAboutTuatara> Why is that better?
09:18:26FromDiscord<nikki> nah actually that's mostly for vertices
09:18:27FromDiscord<nikki> nvm
09:18:37FromDiscord<iWonderAboutTuatara> Yeah that just seems more confusing
09:18:49FromDiscord<iWonderAboutTuatara> I think dealing with stickers instead of pieces is easier
09:19:01FromDiscord<nikki> yeah i was talking about faces for stickers
09:19:08FromDiscord<nikki> how to index faces
09:19:19FromDiscord<iWonderAboutTuatara> I just have them as fields in the type
09:19:25FromDiscord<iWonderAboutTuatara> Works fine
09:19:36FromDiscord<nikki> in any case, it'd be nice to index faces such that their neighborhood is some property of the index
09:19:50FromDiscord<nikki> but, idk if such a neighborhood exists among naturals
09:19:58FromDiscord<iWonderAboutTuatara> What do you mean by neighborhood in this case?
09:20:15FromDiscord<nikki> like that they share an edge
09:20:46FromDiscord<iWonderAboutTuatara> Oh that
09:20:53FromDiscord<iWonderAboutTuatara> Like partitioning a space sort of
09:21:07*antranigv joined #nim
09:21:16FromDiscord<iWonderAboutTuatara> I didn't know that had a name, I thought that was just a thing in topo
09:21:30FromDiscord<nikki> this is interesting
09:21:49FromDiscord<nikki> one thing that felt for sure was that bc. it's a known static size of data and layout
09:21:54FromDiscord<nikki> whatever the model is that is chosen
09:22:02FromDiscord<nikki> an array / object layout makes sense
09:22:10FromDiscord<iWonderAboutTuatara> Yeah agreed
09:22:16FromDiscord<iWonderAboutTuatara> Arrays are the better thing to use here
09:22:18FromDiscord<nikki> now i gotta sleep on the rest :p
09:22:24FromDiscord<iWonderAboutTuatara> I don't know how different they are though
09:22:27FromDiscord<iWonderAboutTuatara> Oh lol
09:22:31FromDiscord<iWonderAboutTuatara> This has been super useful
09:22:33FromDiscord<iWonderAboutTuatara> Thanks!
09:22:44FromDiscord<nikki> i'd say to just go low level and think about copying element by element
09:22:54FromDiscord<nikki> don't do "copy array to array with =" or sth
09:22:55FromDiscord<iWonderAboutTuatara> That's what I'm doing at the moment
09:22:58FromDiscord<nikki> like happened with the seqs
09:23:03FromDiscord<iWonderAboutTuatara> Oh nevermind that's not what I'm doing
09:23:16FromDiscord<nikki> the seqs seemed to have had seq-level copying done
09:23:20FromDiscord<iWonderAboutTuatara> That kind of is what I'm doing actually
09:23:29FromDiscord<nikki> i think making own procs for those primitives that have clear names like
09:23:32FromDiscord<iWonderAboutTuatara> I got lazy for buffers and just copied the entire seq
09:23:37FromDiscord<nikki> copy across face or sth
09:23:44FromDiscord<nikki> will be useful
09:23:46FromDiscord<iWonderAboutTuatara> Utility procs are desperately needed I agree
09:24:14FromDiscord<nikki> then the algo is made of those parts, then when someone reads a post like yours above it'll be like "copy edge. move <blah>" or whatever which seems good
09:24:16FromDiscord<iWonderAboutTuatara> For readability sake
09:24:27FromDiscord<nikki> people always think like algo code has to look hard to read but
09:24:47FromDiscord<nikki> stockfish, one of the top chess engines, is so readable
09:24:52FromDiscord<iWonderAboutTuatara> No, this is just super duper early stage and I didn't think to make a utility function for this kind of stuff
09:24:54FromDiscord<iWonderAboutTuatara> True
09:24:59FromDiscord<iWonderAboutTuatara> Stockfish code is beautiful
09:25:04FromDiscord<nikki> no just makijg a general point
09:25:24FromDiscord<nikki> not digging at urs 😄
09:25:40FromDiscord<nikki> probs will also help when showing progress on discord lolol
09:26:30Zoom[m]If you do a solver, you'll probably need to output a sequence of resulting discreet steps in conventional form, so it may be beneficial in realizing your logic in those steps, to simplify.
09:26:33FromDiscord<iWonderAboutTuatara> No worries, I understood
09:26:46FromDiscord<iWonderAboutTuatara> @Zoom
09:26:48FromDiscord<nikki> great point Zoom
09:26:56FromDiscord<iWonderAboutTuatara> Currently, each rotation is its own function
09:27:19FromDiscord<iWonderAboutTuatara> When doing the solver, I guess I can just get it to store notation depending on what rotation it's applying?
09:27:44FromDiscord<nikki> this is such an interesting data layout puzzle lol
09:27:52FromDiscord<iWonderAboutTuatara> Honestly
09:27:52Zoom[m]I reason there should be only 2 functions, for horizontal and for vertical rotation, with subroutines, depending on row/column
09:27:59FromDiscord<nikki> i rly shud go to bed but i may be having voxel dreams
09:28:17FromDiscord<iWonderAboutTuatara> @Zoom
09:28:31FromDiscord<nikki> there are 3 axes of rotation
09:28:40FromDiscord<iWonderAboutTuatara> One of them don't matter
09:28:49FromDiscord<iWonderAboutTuatara> Wait no I'm insane
09:28:53FromDiscord<nikki> lulz
09:28:55FromDiscord<Rika> lol
09:29:02FromDiscord<iWonderAboutTuatara> There should be 3 in simplest case
09:29:06FromDiscord<nikki> only if ur in gimbal lock ;D
09:29:09PMunchGood morning everyone :)
09:29:11FromDiscord<iWonderAboutTuatara> What am I doing lmao
09:29:16FromDiscord<iWonderAboutTuatara> Good morning!
09:29:29Zoom[m]I'm pulling this out of my... nowhere. Never solved one. :D
09:29:38FromDiscord<iWonderAboutTuatara> Oh lmao
09:29:51FromDiscord<iWonderAboutTuatara> I actually think the 3 functions thing would cause more trouble than it's worth
09:29:53FromDiscord<nikki> none of us have solved one, that's why we're in a coding discord
09:29:54FromDiscord<iWonderAboutTuatara> Hard to tell
09:29:56FromDiscord<nikki> not a math discord
09:30:12FromDiscord<iWonderAboutTuatara> I actually do solve them lmao
09:30:32FromDiscord<iWonderAboutTuatara> I'm not good, I average like 18 seconds, but I know how to
09:30:43FromDiscord<nikki> can u do it w/ ur feet
09:30:48FromDiscord<iWonderAboutTuatara> I wish
09:30:54FromDiscord<iWonderAboutTuatara> Wca removed the feet event
09:30:59FromDiscord<iWonderAboutTuatara> Feet was the biggest meme
09:31:00FromDiscord<Rika> "not good"↵"averages at 18 seconds"
09:31:05FromDiscord<iWonderAboutTuatara> Lmaooo
09:31:05FromDiscord<Rika> motherfucker whats good then
09:31:11FromDiscord<iWonderAboutTuatara> 18s is very doable
09:31:16FromDiscord<iWonderAboutTuatara> Sub10 is very good
09:31:16FromDiscord<nikki> lol they're from mercury
09:31:19FromDiscord<nikki> where time is ... different
09:31:26FromDiscord<Rika> bitch i'd be surprised if i could solve one in a year
09:31:36FromDiscord<nikki> @Rika have u tried enabling arc
09:31:41FromDiscord<nikki> i heard it makes things faster
09:31:41FromDiscord<iWonderAboutTuatara> If you tried and used Google you'd do it in < 10 minutes
09:31:50FromDiscord<Rika> i already refactored myself to use C
09:32:01FromDiscord<iWonderAboutTuatara> Most people get to sub 20 within a year or so, I've been doing it for 3 years on and off
09:32:05FromDiscord<nikki> lol ur probs stuck in a corruption-based infinite loop
09:32:14FromDiscord<iWonderAboutTuatara> That's what happens when you use c
09:32:25FromDiscord<iWonderAboutTuatara> Something breaks and it's really hard to find out what
09:32:32FromDiscord<iWonderAboutTuatara> And then you go back to Nim
09:32:40FromDiscord<iWonderAboutTuatara> Maybe that's just me
09:32:48FromDiscord<nikki> the problem is assuming you're meant to find out
09:32:52FromDiscord<nikki> that's very self-centered
09:33:12FromDiscord<nikki> in c the machine giveth, and it taketh away
09:33:22FromDiscord<iWonderAboutTuatara> Well said
09:33:55FromDiscord<iWonderAboutTuatara> On that note, if I don't sleep the universe shall taketh away my ability to function tomorrow
09:33:58FromDiscord<iWonderAboutTuatara> Goodnight everyone
09:34:24FromDiscord<Rika> sleep well
09:35:07Zoom[m]Good night
09:45:48*suchasurge quit (Quit: Ping timeout (120 seconds))
09:46:08*suchasurge joined #nim
09:58:21ForumUpdaterBotNew thread by Jasonfi: Hot-reload an entire application?, see https://forum.nim-lang.org/t/7125
10:08:22ForumUpdaterBotNew thread by Jasonfi: Enabling hot-reloading causes the chronicles module to fail to compile, see https://forum.nim-lang.org/t/7127
10:36:09*bung quit (Ping timeout: 260 seconds)
10:37:49planetis[m]<Zoom[m] "So I meant, if I'm not really us"> Well, there is dead code elimination maybe they are not included
10:41:09*bung joined #nim
10:42:52Zoom[m]planetis: you're right of course, I wasn't thinking clearly at the moment and didn't separate two reasons in my head (the second being I'd like the compiler to throw an error on runtime use)
10:55:32*abm joined #nim
11:10:11*bung quit (Quit: Lost terminal)
11:26:16*hmmmmm quit (Remote host closed the connection)
11:44:27PMunchHmm, is it just me or are the st_mode and st_nlink fields swapped in this struct? https://man7.org/linux/man-pages/man2/stat.2.html https://github.com/nim-lang/Nim/blob/devel/lib/posix/posix_linux_amd64.nim#L220-L244
11:47:35PMunchCuriously it was correct before posix got split: https://github.com/nim-lang/Nim/commit/ce86b4ad78aae11f62c50e4f46e8ab2a124356b4#diff-c41c09133bbe27fb23f2618d1246d3dd52941d5f3fb93e830d0873da0b97cb8cL267
11:49:51FromGitter<ynfle> Will nim run on the new M1 macs?
11:50:38PMunchWith the correct compiler flags? sure
11:51:27PMunchMight have to rewrap some stuff though
11:53:20FromDiscord<Rebel> Is there a way to not make ld crash?
11:53:30FromDiscord<Rebel> sent a code paste, see https://play.nim-lang.org/#ix=2ENA
11:53:34Zoom[m]Hey Peter, you streams get turned down A LOT by YT.
11:53:40FromDiscord<Rebel> (edit) "crash?" => "crash when compiling?"
11:53:49Zoom[m]Previous stream by 23db, last one by 19dB
11:53:50PMunchZoom[m], yeah it's weird..
11:54:02Zoom[m]You probably have your sound set too hot.
11:54:20Zoom[m]You can PM me with your processing chain and we can figure this out
11:54:42PMunchCan I PM you on IRC when you're on matrix?
11:55:10Zoom[m]Surprisingly, yes. I talked with TrustableCode this way
11:55:25PMunchHuh, cool
12:02:54*Vladar joined #nim
12:03:34FromDiscord<lqdev> @ynfle why wouldn't it?
12:04:39*rockcavera joined #nim
12:06:01*supakeen quit (Quit: WeeChat 2.9)
12:06:37*supakeen joined #nim
12:10:47FromGitter<ynfle> My guess is a lot of stuff the that is defined for mac only will change
12:28:46ForumUpdaterBotNew thread by Satoru: What's the difference between `,` and `;` in the parameter list of procs?, see https://forum.nim-lang.org/t/7129
12:30:22*krishtx joined #nim
12:30:43*krishtx left #nim (#nim)
12:38:47ForumUpdaterBotNew thread by Satoru: Why is the implicit `result` so widely used?, see https://forum.nim-lang.org/t/7130
12:44:47ForumUpdaterBotNew thread by Daef: Marshal: loading nested TableRef segfaults, see https://forum.nim-lang.org/t/7131
13:14:11*jjido joined #nim
13:18:57FromDiscord<inv> Hello, Are there any http-server for nim which supports chunk-streaming ?
13:20:51FromDiscord<flywind> chunk encoding?
13:24:51FromDiscord<inv> Yep, the main idea - to not just enable encoding - but to send long-running data, from database for example
13:25:01Zoom[m]PMunch: on your TermFM: KDE Plasma has a terminal embedded in the file browser which follows your position
13:28:07Zoom[m]Why not just write some shim layer to connect your terminal with an existing File Manager?
13:34:51Zoom[m]I think you don't want to rely on existing buses for communicating, so may be you can use FM which are easy to extend/have plugin support
13:44:33FromDiscord<inv> Ok, if no chunks - which RPC would you recommend? I cannot find gRPC for nim
13:45:02FromDiscord<inv> I see this one, but not sure is it ok not not: https://github.com/oswjk/nimtwirp
13:47:39FromDiscord<flywind> What about JSON RPC?
13:47:54FromDiscord<flywind> !repo nim-json-rpc
13:47:54disbothttps://github.com/status-im/nim-json-rpc -- 9nim-json-rpc: 11Nim library for implementing JSON-RPC clients and servers 15 37⭐ 6🍴
13:49:48*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:53:42*waleee-cl joined #nim
13:55:05*lritter joined #nim
13:56:26*Kaivo joined #nim
14:00:17FromDiscord<inv> Thx. Was thinking about something more "binary"
14:03:40Zevvinv: websocket?
14:07:11Zoom[m]PMunch: More on TermFM why not use kernel's inotify to watch for changes in the current dir?
14:08:29*vicfred_ quit (Quit: Leaving)
14:19:56*vicfred joined #nim
14:28:22*tsujp quit (Read error: Connection reset by peer)
14:31:32PMunchZoom[m], well this was mostly just thrown together for fun to see how I could do it. I'm guessing the KDE Plasma solution requires you to use one particular shell/file manager? This just requires that your terminal sets $WINDOWID and you're good
14:31:49PMunchAnd what would I use inotify for?
14:32:50Zoom[m]PMunch: yeah, of course. I meant this idea even got to KDE. You can look at the implementation.
14:33:59Zoom[m]To update the view when something happens with the files. It may be that something else than your terminal changes them
14:34:02PMunchAah right, yeah I guess it's not exactly a novel idea
14:34:12PMunchThat is true
14:34:40Zoom[m]Also, it means it can be async to the term
14:35:38*vicfred quit (Quit: Leaving)
14:37:04PMunchWell you can interact with it regardless of what the term is doing, but the state of it is locked to what the term does
14:37:57PMunchCome to think of it I might want to move some stuff around, as it is now it will query all the files in the folder when you scroll, which isn't great
14:39:46*natrys quit (Quit: natrys)
14:40:05Zoom[m]File browsing is fun stuff but it's full of edge cases, especially when you start considering file preview, remote places and stuff.
14:40:40Zoom[m]On the other hand, I'm choosey, as I move stuff
14:40:46Zoom[m]a lot
14:42:17PMunchOh for sure, this file manager is very basic
14:45:45Zoom[m]SpaceFM supports plugins, I think. I'd use that to talk to it. Write a daemon that follows your term and comunicates with the plugin.
14:46:09Zoom[m]This would be very useable fast
14:47:00PMunchHmm, that seems complicated though :P
14:47:22PMunchThis was 250 odd lines
14:48:00PMunchHmm, SpaceFM seems a bit overkill
14:48:10PMunchAnd it has tabs, how is that going to work?
14:48:26Zoom[m]It can be very minimal, from whatI remember seeing it in some distros like Antix
14:49:14Zoom[m]I remember seeing it being used with tiling WMs showing nothing but a file panel
14:49:27Zoom[m]That's just from the top of my head
14:49:41PMunchThat's probably possible to reconfigure though, which would break this
14:49:46Zoom[m]<PMunch "Hmm, that seems complicated thou"> But it's 250 for the current form, which is not a lot. What I'm talking about could be a few hundred lines for a complete project
14:49:51PMunchPossibly even just a keyboard shourtcut
14:50:24PMunchFair enough, but that interaction might be harder than you expect
14:51:43Zoom[m]What do you envision it to be able to do besides exchanging paths?
14:53:34PMunchNot much tbh
14:53:42PMunchIt was mostly meant as a PoC
14:53:58PMunchBut icons based on file-type would be nice
14:54:56Zoom[m]I meant, any functionality that would complicate things if you'd went with my suggestion
14:56:21PMunchOh, not really
14:56:45PMunchBut the file manager I integrate with might have different plans which breaks this project
14:57:16Zoom[m]It depends on how stable their plugin API is (if they have one)
14:57:53PMunchTrue
14:58:20Zoom[m]If you get the daemon part and choose the protocol, the sink part shouldn't be hard to port between different FMs
14:58:23*opal quit (Ping timeout: 240 seconds)
14:59:54PMunchI mean the API so far is basically "show this path" <-> "could you move to this path?"
15:03:45Zoom[m]That's great, it means you're bound for success
15:03:49Zoom[m]Looky-looky: https://ignorantguru.github.io/spacefm/spacefm-manual-en.html#sockets
15:04:26*bung joined #nim
15:06:51PMunchHmm, seems like it might be possible
15:07:36Zoom[m]So, just a daemon that binds the terminal with the socket
15:08:18PMunchBut it needs to instruct SpaceFM to not show multiple tabs and such..
15:08:36Zoom[m]And the good thing is, you can then write backends for other FMs
15:09:36PMunchWell that is already possible. My FM isn't really doing much of anything in regards to the terminal. It just reads an X window hints and runs `xdotools` on the terminal window.
15:10:08PMunchThe part of TermFM that is actually interacting with the terminal is like 10 lines of code
15:13:57PMunchI guess I should use xdo instead of calling xdotools come to think of it
15:16:25*opal joined #nim
15:17:06ForumUpdaterBotNew thread by AlectronikHQ: Which type to use for a flexible array?, see https://forum.nim-lang.org/t/7132
15:22:40*NimBot joined #nim
15:36:50planetis[m]hey @PMunch is it ok if I use a version of your rpn macro as an example? https://github.com/nim-lang/fusion/pull/47
15:36:51disbotNew example for buildAst
15:37:34PMunchSure, no problem .)
15:38:06planetis[m]thanks!
15:48:06planetis[m]i realised that i removed so much it doesn't even need to be a macro 🤦
15:48:31planetis[m]anyway...
15:49:06planetis[m]its just an example
16:02:27*habamax quit (Quit: leaving)
16:14:55PMunchNothing needs to be a macro
16:15:01PMunchIt's just much more fun
16:15:50*jjido joined #nim
16:17:04FromGitter<iffy> Why are the addresses after createSam() different than within? I guess it's making a copy, but I don't want it to. https://play.nim-lang.org/#ix=2EOU
16:21:59FromGitter<deech> Is there any documentation on how to use `expandArc`? I checked the both the experimental and regular manual.
16:28:43*bonoot joined #nim
16:30:16bonootdoes anyone else think `once`/`closureScope`/`rangeCheck` etc templates should be out of the system module? their names are too generic imo
16:53:23*hnOsmium0001 joined #nim
16:53:39*Troz joined #nim
16:54:04TrozWhy does zeroMem have no side effects?
16:55:10*bonoot quit (Remote host closed the connection)
17:02:50*Troz quit (Remote host closed the connection)
17:10:32disrupteknim people think mm is side-effect-free.
17:10:41disruptekthe nimpletons.
17:13:59miprior rather, it's implicitly invoked to initialize variables, and there are no side effects there, but it's an error for the proc to have that pragma since you can use it to create side effects elsewhere, by zeroing arbitrary memory. it's a bug.
17:17:36miprior, it's not a bug and noSideEffect permits stuff like zeroMem
17:17:38miprimanual: This means that the proc/iterator only changes locations that are reachable from its parameters and the return value only depends on the arguments. If none of its parameters have the type var T or out T or ref T or ptr T this means no locations are modified.
17:19:30disrupteklike i said, nimskulls.
17:19:49miprihttps://play.nim-lang.org/#ix=2EPk <- side-effect-free mutation
17:21:35disruptekunless it works under .strictFuncs, no one cares.
17:21:43disruptekthe zeroMem, i mean.
17:22:04miprisimilar to D's notion of purity rather than an FP one: https://dlang.org/spec/function.html#pure-functions , but you can get by avoiding obviously suspicious parameters like var, ref, ptr.
17:22:51disrupteki'm personally satisfied with strictFuncs and expect it to be the default in another release or two.
17:24:52miprihttps://play.nim-lang.org/#ix=2EPn <- side-effect-free strictfunc mutation
17:26:14disruptekyeah, those are fine.
17:27:30miprizeroMem works too: https://play.nim-lang.org/#ix=2EPo . the experimental manual just says "var parameter"
17:27:48disruptekyes, that's fine, too.
17:28:00disruptekyou're explicitly telling it what it can mutate.
17:28:37disruptektry zero'ing random memory.
17:43:20FromGitter<iffy> What about https://play.nim-lang.org/#ix=2EPw ?
17:46:56FromDiscord<lqdev> values behind pointers in nim are mutable by definition
17:47:19FromDiscord<lqdev> your code sample is unsafe btw
17:47:30disrupteklol
17:48:20disruptektry zero'ing random memory.
17:48:48FromDiscord<lqdev> remember that trick i used in _MEM.RECALL(); to quit the game
17:49:00disruptekhaha
17:49:07disrupteki vaguely remember something about that.
17:49:15FromDiscord<lqdev> `zeroMem(cast[pointer](0), 1)`
17:49:38FromDiscord<lqdev> yea let's just write zero to nil
17:49:41FromDiscord<lqdev> what could go wrong
17:49:43disruptekcast[pointer](0)[]
17:50:05FromDiscord<lqdev> excuse that, i wrote this during a game jam. could've just used nil, i know.
17:50:35disruptekclyybber: btw, we need halt.
17:50:44disruptekit's basically yield.
17:51:19FromDiscord<Quibono> What does the warning message mean when it says "Implementation of X expected"
17:51:33FromDiscord<Quibono> I changed some stuff in a proc and it threw that
17:51:42disruptekyou probably changed a signature that no longer matches the proc definition.
17:51:44FromDiscord<lqdev> you forgot the = after your proc declaration
17:51:47disruptekor that.
17:52:31FromDiscord<Quibono> Lol, thank you, turned out it was a double ,,
17:52:46FromDiscord<Quibono> Gotta love stupid typos.
17:52:52FromDiscord<iWonderAboutTuatara> You forgot to implement the proc
17:52:53disruptekneat; that's probably a bug.
17:52:58FromDiscord<iWonderAboutTuatara> Oh lmao
17:53:25FromDiscord<iWonderAboutTuatara> By the way, how do I swap elements in an array with temp variables?
17:53:36disruptekswap
17:53:42FromDiscord<iWonderAboutTuatara> Swap complains that I'm giving it char char
17:53:53FromDiscord<iWonderAboutTuatara> They're in the same array
17:54:01disruptekrepro?
17:54:03FromDiscord<iWonderAboutTuatara> without temp variables
17:54:12FromDiscord<iWonderAboutTuatara> Gimme a minute or so
17:54:19disruptekwithout temp variables?
17:54:22FromDiscord<iWonderAboutTuatara> I'll send a Nim playground like when I get back to my computer
17:54:25FromDiscord<iWonderAboutTuatara> Just using swap
17:54:30FromDiscord<iWonderAboutTuatara> You don't need temp variables
17:54:32disruptekwhat do you think swap uses?
17:54:45FromDiscord<iWonderAboutTuatara> It says it's faster than temp variables, so no idea
17:55:00*habamax joined #nim
17:55:11miprihttps://play.nim-lang.org/#ix=2EPB - swap with two chars in the same array
17:55:34FromDiscord<iWonderAboutTuatara> I tried that and it wasn't happy with me
17:55:38disruptekmaybe i'm thinking of a different impl.
17:55:41mipriif you change that 'var a' to a 'let a', you'll get an error that says: Error: type mismatch: got <char, char>
17:55:41FromDiscord<iWonderAboutTuatara> I'll repro in a minute
17:55:49mipribut the actual problem is shown below that
17:55:49disruptekcoulda sworn it just created a :tmp.
17:55:56FromDiscord<iWonderAboutTuatara> It is definitely a var array
17:56:01mipri"but expression 'a[0] is immutable, not 'var'"
17:56:12FromDiscord<iWonderAboutTuatara> It gives that error yes
17:56:19FromDiscord<iWonderAboutTuatara> I haven't used a single let statement
17:56:25FromDiscord<iWonderAboutTuatara> If it helps the array are components of a type
17:56:43miprithat doesn't help at all
17:56:59disruptekswap uses a temp variable.
17:57:33FromDiscord<iWonderAboutTuatara> Huh
17:57:54disrupteklook at compiler/ccgexprs.genSwap.
17:58:17disruptekbut anyway, swap() as you know it should be faster than a swap() you could write.
17:58:59FromDiscord<iWonderAboutTuatara> > This is often more efficient than tmp = a; a = b; b = tmp. Particularly useful for sorting algorithms.↵↵var
17:59:04FromDiscord<iWonderAboutTuatara> Confusing
17:59:11disruptekbut correct.
17:59:52*bung quit (Quit: Lost terminal)
17:59:57FromDiscord<Quibono> Okay, so new error, I've got an array of objects, i'm iterating through the objects in the array, and I'd like to change their values, but it says it cannot be assigned to.
18:00:46FromDiscord<iWonderAboutTuatara> sent a code paste, see https://play.nim-lang.org/#ix=2EPF
18:00:49FromDiscord<iWonderAboutTuatara> here's repro
18:01:33mipriQuibono: for v in array.mitems: v = whatever
18:01:37FromDiscord<iWonderAboutTuatara> https://play.nim-lang.org/#ix=2EPG
18:02:03mipriyou don't have a let anywhere but parameters are immutable by default
18:02:10mipriso 'a' is the same thing as a 'let'
18:02:28miprichange that to 'a : var array[9, char]'
18:04:41FromDiscord<Quibono> So I have "s.curVal = rspJson["p"].getFloat"
18:05:57FromDiscord<Quibono> Sorry for not getting it I'm just still really unfamiliar with Nim.
18:06:09disruptekdon't sweat it.
18:06:16disruptekeveryone starts from zero.
18:06:21FromDiscord<Quibono> Like it's a conditional change to one object in the array
18:06:52disruptekin the same way that variables you declare are `var` or `let`, parameters in procs are `var` or ``.
18:07:10FromDiscord<iWonderAboutTuatara> oh I see
18:07:16FromDiscord<iWonderAboutTuatara> I didn't think that through very much aha
18:07:17FromDiscord<iWonderAboutTuatara> thanks
18:07:32FromDiscord<iWonderAboutTuatara> I had var arrays for the other functions
18:07:37FromDiscord<iWonderAboutTuatara> just brainslipped I guess
18:07:40FromDiscord<iWonderAboutTuatara> thanks!
18:14:04FromDiscord<Quibono> Lol, so now I fixed that, annnd json is raising an error somewhere in my parseJson(response) logic.
18:14:44FromDiscord<Quibono> `node.kind == JObject` [AssertionDefect]
18:17:12*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:17:17FromDiscord<Quibono> So it's not a JObject...
18:18:38FromDiscord<Quibono> Okay it's a JArrat
18:32:25FromDiscord<shadow.> is there an easy way to remove an item from a `Deque` by index?
18:32:37FromDiscord<shadow.> if it's a doubly-linked list internally it shouldn't be that hard right?
18:32:46disruptekit's a seq internally.
18:33:11FromDiscord<shadow.> wait what
18:33:30FromDiscord<shadow.> do seq's have o(1) insertion at start?
18:33:35FromDiscord<shadow.> (edit) "insertion at start?" => "prepend time complexity?"
18:33:47FromDiscord<shadow.> (edit) "o(1)" => "O(1)"
18:34:13disrupteknope.
18:34:25FromDiscord<shadow.> but the deque should?
18:34:35disruptekyep.
18:34:40FromDiscord<shadow.> hmm
18:34:44FromDiscord<shadow.> so it's more than just a few proc's lmao
18:34:54FromDiscord<shadow.> alright
18:35:11FromDiscord<shadow.> so then if i need fast filtering i should probably use a doubly linked list instead right
18:35:29disruptek!repo skiplists
18:35:29disbothttps://github.com/disruptek/skiplists -- 9skiplists: 11generic skip list implementations💃 15 6⭐ 1🍴
18:36:13FromDiscord<shadow.> :o
18:36:40FromDiscord<shadow.> could that be used as a priority queue as well?
18:36:48FromDiscord<shadow.> normal queue
18:36:55disrupteksure.
18:37:23FromDiscord<shadow.> does it have O(1) enqueue and dequeue?
18:37:29disruptekyes.
18:37:47FromDiscord<shadow.> alr nice thanks
18:37:52disruptekthe manual indicates order for all procs afaik.
18:38:21FromDiscord<shadow.> oh nice!
18:38:59FromDiscord<Quibono> Can someone help me with working with JArrays? everything I try just seems to blow up.
18:39:13disruptekwhat isn't covered in the manual?
18:39:46*jjido joined #nim
18:41:36disruptekshadow.: i'm wrong; all the procs don't have order.
18:42:20disruptekoperations inside the list are log n, everything else is 1.
18:43:00disruptekunless it's, like, count(), which is n, of course.
18:50:13FromDiscord<Daniel> did anyone ever use this: https://nimwc.org/
18:50:21FromDiscord<Daniel> (edit) "did" => "Did" | "Didanyone ever use this: https://nimwc.org/ ... " added "?"
18:54:39FromDiscord<jseb> i'm curious to try and wrap a javascript library (three.js). I've read that: https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers↵I still get no clue. Is there any other doc i could read, please ?
18:55:02*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:59:56*rockcavera quit (Remote host closed the connection)
19:09:58*jjido joined #nim
19:10:11*xet7_ quit (Quit: Leaving)
19:11:56*xet7 joined #nim
19:21:47FromGitter<deech> I have a module that defines an `Option` which is unrelated to the one in stdlib, I need both for my current module so I have my `Option` imported qualified, `import M as M` which hopefully means that when I use things from `M` I have to prefix the name with `M.` but it still complains about ambiguity with the stdlib `Option`.
19:26:34FromGitter<deech> Ah hah, I need to do `from M import nil`.
19:34:51FromDiscord<nikki> when you look up eg. foo["bar"] in a JsonNode it doesn't compute the hash of "bar" at compile time (bc. it's a string literal), does it
19:36:06FromDiscord<Quibono> Is there a standard decimal library people use?
19:37:01FromDiscord<nikki> what do you mean by a decimal library 🤔
19:37:34FromDiscord<Quibono> I mean a library to properly represent decimals so I can write code that deals with money.
19:37:51FromDiscord<Quibono> Without weird $1.0000002 stuffs
19:37:51FromDiscord<nikki> what does a proper representation look like
19:37:57FromDiscord<nikki> for money you probably want to use integers
19:38:04FromDiscord<nikki> integers numbers of cents
19:38:34FromDiscord<Quibono> Yeah, I was just wondering if somebody had already written a library that does money.
19:38:46FromDiscord<nikki> ah got it
19:39:07FromDiscord<nikki> so, a standard money library
19:39:33FromDiscord<Quibono> Yeah, or just fixed point decimal library.
19:39:50FromDiscord<Quibono> Fixed precision I guess?
19:40:09disruptekthere are a bunch of libs out there and more all the time.
19:40:13*rockcavera joined #nim
19:41:25FromDiscord<Quibono> https://github.com/JohnAD/decimal128 This seems like the newest/best.
19:42:04FromDiscord<nikki> interesting didn't realize this category of things was actually called decimal 😮 cool
19:42:46FromDiscord<Quibono> Although this one doesn't have very good documentation.
19:43:49FromDiscord<Quibono> Yeah, and Nim doesn't even have an obvious/reliable way to round to a set precision.
19:44:00FromDiscord<Quibono> (That I've seen)
19:44:07FromDiscord<nikki> really? seems actually somewhat documented which is more than can be said for a lot of random open source
19:46:24FromDiscord<Quibono> Well like I'd like them to show how to set precision (found it in the source code).
19:46:45FromDiscord<Quibono> I'm coming from Python where anything I'd use was pretty well documented, so yeah I'm spoiled with that I think.
19:52:26*hmmm joined #nim
19:52:35hmmmhallo!
19:59:41hmmmmunchie I've seen your youtube stream
19:59:55hmmmyou have a huge beard and a very nice editor setup
20:00:00hmmmis that vim?
20:03:17FromDiscord<Daniel> sent a code paste, see https://play.nim-lang.org/#ix=2ERb
20:04:46FromDiscord<Daniel> (edit) "https://play.nim-lang.org/#ix=2ERb" => "https://play.nim-lang.org/#ix=2ERc"
20:06:50FromDiscord<lqdev> @Daniel nah he's on IRC so you can ping him just by is name
20:07:02FromDiscord<lqdev> PMunch
20:07:48*lritter quit (Remote host closed the connection)
20:18:58*Kaivo quit (Quit: offline for the weekend)
20:20:53*aaronm quit (Ping timeout: 260 seconds)
20:22:26FromDiscord<Daniel> rgr, tnx
20:27:49*kungtotte joined #nim
20:28:45hmmmhalp, I'm compiling my nim file on vscode with F6 from my project folder, but after execution I find myself in the folder "C:\Users\hmmm"
20:28:58hmmmI want to stay in the previous folder :|
20:36:26*aaronm joined #nim
20:54:46disrupteki want you to stay there, too.
21:06:06*vicfred joined #nim
21:07:05hmmmhey !
21:07:08hmmm:|
21:10:16*habamax quit (Ping timeout: 240 seconds)
21:21:25*tane joined #nim
21:21:31FromGitter<iffy> I have `var obj = ptr Foo` and Foo.things is a Table[int, Thing]. If I `var a = obj.things[4]; a.name = "bob"` would you expect `obj.things[4].name` to be "bob"? Or is `a` a copy of obj.things[4]?
21:22:35FromDiscord<nikki> iffy: depends on whether `Thing` is a `ptr` or `ref` kind of thing, and also if not, if whether `.name` and `.name=` are actually procs that alias something else
21:22:50FromDiscord<nikki> also `var object = ptr Foo` is not actually syntax that works? i think
21:23:00FromDiscord<nikki> maybe you mean `var obj: ptr Foo`
21:23:40FromGitter<iffy> Yes on the typo. `type Thing = object \n name*: string`
21:24:08FromGitter<iffy> nikki: ^
21:24:10miprithat's a value type, so a is a copy, and obj.things[4].name wouldn't change
21:24:13FromDiscord<nikki> then `a` is a copy i believe. you can also just trying it rq to verify
21:24:43FromGitter<iffy> How can I prevent myself from working on copies? I keep thinking I'm using Python :P
21:24:56FromDiscord<nikki> practice
21:25:08FromDiscord<nikki> my default is to actually think of things as copies haha
21:25:10FromGitter<iffy> As in, I'd like a compiler error to tell me I'm modifying a copy rather than the thing.
21:25:30mipriin Python everything's a reference type and in Nim almost everything's a value type. You really just have to stop thinking you're using Python
21:25:45FromDiscord<nikki> another thing i do is i actually don't `type X = ref Y` or `type X = ptr Y` a lot; i explicitly write `ptr` and `ref` in most places. unless it's a value type with a ptr or ref field, for sure
21:25:48FromGitter<iffy> I just watched Araq's video from a few days ago and he mentioned being able to disable copying?
21:26:06mipriyou can define an {.error.} =copy proc for a type
21:26:11FromDiscord<nikki> yeah proc `=copy`(a: var T, b: T) {.error}
21:26:40FromGitter<iffy> In this case `=copy(a: var Thing, b: Thing) {.error.}` ?
21:26:42mipribut that won't save you if you're not thinking. even with copy disabled for Thing, you could make a copy of the name
21:27:02FromDiscord<nikki> practice is the main thing
21:27:30FromDiscord<nikki> don't look for tricks, just keep practicing. the `=copy` thing is for when you want that to actually be part of the type's meaning -- that it's non-copyable
21:27:37FromGitter<iffy> Is there something I can put right here? `var a = obj.things[4]` Something like `var a = breakIfCopy obj.things[4]`?
21:27:40FromDiscord<nikki> some times i do that and then still have an explicit `.copy` proc so i can only explicitly copy
21:28:03FromDiscord<nikki> just remember that `=` means to copy
21:28:06miprisince almost everything's a value type in Nim, almost any kind of assignment is going to copy what you're looking at
21:28:33FromDiscord<nikki> `=` is also copy for refs and ptrs -- the ref or ptr is copied, and the new copy just points at the same destination
21:28:39FromGitter<iffy> okay, I can retrain to think "everything's a copy"
21:29:17FromGitter<iffy> But `obj.things[4].name = "bob"` does no copying of Thing, right?
21:29:25FromDiscord<nikki> nope
21:29:37FromGitter<iffy> everything's a copy
21:29:39FromGitter<iffy> everything's a copy
21:29:59Zevvwas that a pun
21:30:01miprithe right hand side of an assignment gets copied, not the left hand side
21:30:50FromGitter<iffy> right
21:30:51FromDiscord<nikki> there are a few other thiings -- you can mark a declaration as `{.byaddr.}` -- and also if it's the last read of the right hand side it may move it (but it should have equivalent visible behavior to copying (barring side effects in `=copy` hooks etc.))
21:31:24miprithe point of copy ellision is performance rather than semantics though. you still get value semantics
21:31:58FromDiscord<nikki> i think it's not just performance, it makes move-only types actually useable
21:32:07FromDiscord<nikki> and that's a semantic thing
21:32:19FromDiscord<nikki> i use it for unique handles on resources in a few cases
21:33:16FromDiscord<nikki> but yeah for value-like types it should have equivalent visible behavior to copying as noted
21:33:30FromGitter<iffy> So if I made `obj.things: Table[int, ref Thing]` then `var a = obj.things[4]; a.name="bob"` would change `obj.things[4].name == "bob"`?
21:34:07FromDiscord<nikki> idk what "would change means" but that expression would be true after the assignment, yeah
21:34:08mipriyeah. try it
21:34:32FromDiscord<nikki> just make sure to have some non-nil ref at obj.things[4]
21:36:03FromGitter<iffy> k, I'll try it. I'm not actually doing bob and things. This is in a Java app that runs Nim in a thread and uses JNI. So "try it" isn't always straightforward, but I think it makes sense in my head. Thank you!
21:36:33mipriyou can write a little bit nim in a file with dummy types and 'nim r file' to run it. or use play.nim-lang.org
21:37:20FromGitter<iffy> yep, I've made a few trimmed down samples (without the Java mess) but sometimes I trim out the problem
21:39:33FromDiscord<nikki> what's the timeline on the next nim minor release? 🤔 lots of destructor fixes in it
21:51:36*hmmm quit (Ping timeout: 240 seconds)
22:13:58*mal`` quit (Quit: Leaving)
22:14:18*hyiltiz quit (Remote host closed the connection)
22:14:30*mal`` joined #nim
22:15:26*hyiltiz joined #nim
22:17:24FromDiscord<Gyllou> is there a nim idiomatic way to override the hash function of primitives for use in a table?
22:17:58*hmmm joined #nim
22:18:17FromDiscord<Gyllou> or would i have to write a wrapper class for a primitive and make a custom hash for that
22:19:00*hmmm quit (Client Quit)
22:19:47FromDiscord<haxscramper> First solution that I come up with is to use `distinct`, but maybe there is a less drastic approach. But this is better than wrapper class
22:20:01FromDiscord<Gyllou> yea wrapper class seems ghetto
22:20:30FromDiscord<haxscramper> As it creates no runtime overhead and you could use all functions of original type by just converting back
22:20:39FromDiscord<Gyllou> im trying to write a graph library, one part will be made from mostly nim std, the other implementations will be for hpc
22:20:54FromDiscord<Gyllou> okay ill have to look at distinct i havent played with it yet
22:21:32FromDiscord<Gyllou> i want to override the has for primitives for the hpc version to use a more performant hash function for better throughput
22:21:40FromDiscord<Gyllou> (edit) "has" => "hash"
22:24:45*narimiran quit (Ping timeout: 240 seconds)
22:26:59disrupteki think tables will want to use a compatible hash but it doesn't have to be the same impl.
22:27:06disrupteki would use distinct, also.
22:30:34FromDiscord<haxscramper> Sadly there is no `template<class Hash = std::hash<Key>>`-like thing for table implementation, so `hash` for ints is kind of hard-coded.
22:30:48disruptekwouldn't make sense to change it.
22:31:03disruptekhash(x) == x, after all.
23:38:28*Vladar quit (Quit: Leaving)
23:44:22*tane quit (Quit: Leaving)
23:44:34*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)