<< 09-09-2021 >>

00:24:39FromDiscord<gogolxdong (liuxiaodong)> How to make a ref from seq[string] ?
00:25:41FromDiscord<impbox [ftsf]> what are you trying to do?
00:25:42*stkrdknmibalz joined #nim
00:27:44FromDiscord<impbox [ftsf]> `var s = new seq[string]()`
00:29:10FromDiscord<impbox [ftsf]> (edit) "seq[string]()`" => "seq[string]`"
00:31:45FromDiscord<gogolxdong (liuxiaodong)> that's nice, how about making a ref from a literal seq[string] , like `@["width:100%;height:100%;"]`
00:33:24FromDiscord<Elegantbeef> follow it with `s[] = @["width:100%;height:100%;"]` or make a template to do it for you
00:33:57FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3ykb
00:35:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ykd
00:35:31FromDiscord<Elegantbeef> of course as `makeRef` is a template you also can do `makeRef:` style syntax
00:37:46*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
00:38:09FromDiscord<Elegantbeef> Clearly should be named `newRef` but i'm a big dumb dumb
00:45:53FromDiscord<gogolxdong (liuxiaodong)> is there something like `new @["width:100%;height:100%;"]`
00:47:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3yke
01:10:45*neurocyte6 joined #nim
01:13:10*neurocyte quit (Ping timeout: 252 seconds)
01:13:11*neurocyte6 is now known as neurocyte
01:59:18FromDiscord<techno3d> whats the difference between procedure and function?
02:00:18FromDiscord<Elegantbeef> Functions cannot have any side effects, so they cannot access any globalstate or mutate variables that were not passed as mutable
02:00:39FromDiscord<Elegantbeef> with `strictFuncs` on they cannot even mutate reference parameters without the `var` annotation
02:00:40FromDiscord<auxym> see https://nim-lang.org/docs/manual.html#pragmas-nosideeffect-pragma
03:11:26FromDiscord<Alea> In reply to @Yardanico "yeah, it's pretty easy": what profilers would you recommend?
03:11:32FromDiscord<Hoober> sent a code paste, see https://play.nim-lang.org/#ix=3ykx
03:12:03FromDiscord<Elegantbeef> depends on the os @Alea i use callgrind/hottie
03:12:17FromDiscord<Alea> In reply to @Hoober "Very new to nim": the let probably does type inference that return doesn't
03:14:45FromDiscord<Elegantbeef> you can use `auto` as a return type for when the type annotation doesnt play nicely
03:15:19FromDiscord<Rika> In reply to @Hoober "Very new to nim": The space and the parentheses make a tuple instead of a function call
03:15:25FromDiscord<Rika> So you’re passing a tuple to a function
03:16:15FromDiscord<Elegantbeef> Rika what are you talking about?
03:17:33FromDiscord<Rika> Did you not see Hoober’s message
03:17:42FromDiscord<Rika> Ah
03:17:44FromDiscord<Rika> I misread
03:17:45FromDiscord<Hoober> In reply to @Elegantbeef "you can use `auto`": That does help, thanks! Still curious if there's a way to get it to work with a tuple return type
03:17:46FromDiscord<Rika> Really bad
03:17:58FromDiscord<Rika> I don’t know how I misread that, but whatever
03:18:09FromDiscord<Elegantbeef> Well i think it's a compiler bug so i'm looking at it right now
03:18:28FromDiscord<Rika> I feel like it’s to do with implicit genetics
03:18:37FromDiscord<Elegantbeef> Nah i see the issue right now
03:20:08FromDiscord<Rika> Did you read the compiler code
03:20:11FromDiscord<Rika> Because I cannot
03:20:27FromDiscord<Elegantbeef> Yea i'm trying to fix it right now
03:20:36FromDiscord<Hoober> Haha, excellent!
03:20:45FromDiscord<Hoober> Okay, I don't feel so silly for asking now.
03:21:13FromDiscord<Rika> In reply to @Elegantbeef "Yea i'm trying to": Well what is the issue
03:21:49FromDiscord<Elegantbeef> It wants to change the type to a builtin typeclass and cannot for obvious reasons
03:22:21FromDiscord<impbox [ftsf]> is nim likely to ever support serializing a seq of inherited objects?
03:23:50FromDiscord<Elegantbeef> Shouldnt be unfeasible assuming we can eventually do `getAllThatInherit(X)`
03:24:16FromDiscord<Elegantbeef> Which honestly i think it kinda needs it to make it less tedious to do stuff
03:24:36FromDiscord<Elegantbeef> Might be possible with lazy sem being on the way
03:26:44FromDiscord<Rika> Why ya gotta use a double negative
03:27:05FromDiscord<Elegantbeef> Cause i think doubly bad
03:27:32FromDiscord<impbox [ftsf]> I guess until we get a fields iterator that works with rtti it won't be possible
03:31:24FromDiscord<Hoober> In reply to @Elegantbeef "It wants to change": Let me know if you get a fix up for this! Very curious to follow along.↵↵Should I report it on github, you think?
03:31:35FromDiscord<Elegantbeef> Yea you should make an issue
03:31:55FromDiscord<Elegantbeef> I'm only a numpty that can fix basic stuff, if it's more complex than i think it's not going to be fixed by me 😀
03:53:12FromDiscord<Rika> Get it fixed or your reputation will drop smh
03:53:37FromDiscord<Elegantbeef> Aw shit not my reputation, i'm already only slightly above an ant
04:00:28FromDiscord<Archion> Hi
04:00:42FromDiscord<Elegantbeef> Hello
04:01:43FromDiscord<Rika> Hello
04:06:01*supakeen quit (Quit: WeeChat 3.2.1)
04:06:30*supakeen joined #nim
04:07:02*rockcavera quit (Remote host closed the connection)
04:11:43FromDiscord<Elegantbeef> Well i've "fixed" it , so heres seeing what CI says 😀
04:12:15FromDiscord<Rika> Then you didn’t actually fix it and instead caused more bugs
04:12:30FromDiscord<Elegantbeef> What?
04:25:59FromDiscord<Elegantbeef> Well you also made me fine another compiler bug so good job! 😛
04:28:01FromDiscord<Elegantbeef> Fun semi related bug https://play.nim-lang.org/#ix=3ykH
04:28:21FromDiscord<JSONBash> is the result of (100.13 - 100.12) a floating point arithmetic (IEEE) artifact in nim? becuase in C it is not the same value. I see other languages match nims result
04:29:49FromDiscord<Rika> I mean like “and then you accidentally break everything”
04:29:56FromDiscord<Rika> I’m surprised you didn’t understand what I meant
04:29:57FromDiscord<Elegantbeef> Ah
04:30:18FromDiscord<Rika> In reply to @JSONBash "is the result of": Are you subtracting doubles in C?
04:30:24FromDiscord<Elegantbeef> I'm very very scared of accidently breaking stuff, but my PRs still get accepted so wild 😛
04:30:34FromDiscord<Rika> Because float in Nim is double in C
04:30:35FromDiscord<impbox [ftsf]> nim's float = double in c
04:30:45FromDiscord<Rika> Hey what the fuck don’t cut me smhhhh
04:30:54FromDiscord<JSONBash> In reply to @Rika "Are you subtracting doubles": yeah I am
04:30:57FromDiscord<Elegantbeef> hey imp loses to me often give him this one!
04:31:07FromDiscord<Rika> But that’s YOU
04:31:32FromDiscord<Rika> In reply to @JSONBash "yeah I am": Sounds strange then, how are you printing these numbers
04:31:34FromDiscord<Rika> On C
04:31:51FromDiscord<impbox [ftsf]> https://play.nim-lang.org/#ix=3ykJ weird!
04:31:56FromDiscord<JSONBash> ``
04:32:02FromDiscord<Elegantbeef> It could just be nim's stringication
04:32:08FromDiscord<JSONBash> sent a code paste, see https://play.nim-lang.org/#ix=3ykK
04:32:26FromDiscord<Rika> In reply to @Elegantbeef "It could just be": I doubt it
04:32:41FromDiscord<Rika> I’m thinking it’s something to do with literals and compiler optimisation on C
04:33:06FromDiscord<impbox [ftsf]> sense... it makes none to me
04:33:08FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3ykL
04:33:34FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/885382399255523388/image.png
04:33:35FromDiscord<Elegantbeef> Shame
04:33:42FromDiscord<JSONBash> I tried that same in clojure, JS, scala and they all printed what nim did
04:33:50FromDiscord<JSONBash> C was the only one that didn't
04:34:55FromDiscord<xflywind> I got
04:34:57FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3ykM
04:35:08FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3ykN
04:35:42FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3ykO
04:36:04FromDiscord<Rika> You used f
04:36:06FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3ykP
04:36:11FromDiscord<Rika> That prints in float I believe
04:36:14FromDiscord<impbox [ftsf]> to pay respects
04:36:20FromDiscord<Rika> I think you use d if you want to print a double
04:36:25FromDiscord<Rika> I forget
04:37:45FromDiscord<JSONBash> In reply to @Rika "I think you use": I think %d is for ints
04:37:58FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3ykQ
04:38:06FromDiscord<Rika> Hmm
04:38:10FromDiscord<Rika> F is indeed double
04:38:13FromDiscord<Rika> But that’s strange
04:38:36FromDiscord<Rika> Try compiling with all warnings and extra warnings, might show something
04:39:01FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3ykR
04:39:21FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3ykS
04:40:09FromDiscord<xflywind> > g option: Use the shortest representation: %e or %f
04:40:20FromDiscord<JSONBash> sent a code paste, see https://play.nim-lang.org/#ix=3ykT
04:40:35FromDiscord<JSONBash> i only have ever used %d and %f to orint really
04:41:34FromDiscord<Rika> I believe the important part here is the .16 and not the g
04:41:44FromDiscord<xflywind> yeah
04:42:20FromDiscord<JSONBash> I also have never printed with .16 lol
04:42:30FromDiscord<JSONBash> thanks for the answer all
05:24:45FromDiscord<Elegantbeef> Well rika i'm passing CI now, so put that in your pipe... and i caught the compiler on fire
05:26:06FromDiscord<Rika> Nice
05:56:47FromDiscord<cabboose> Hey guys, with the GC_ref and GC_unref call, is that specific to the thread calling it?
05:57:01FromDiscord<cabboose> so if I pass an object to an intermediary and call GC_ref on the thread sending it
05:57:15FromDiscord<cabboose> can I then call GC_unref on the thread receiving it and it'll be managed by that thread?
05:57:18FromDiscord<cabboose> i'm guessing not
05:57:27FromDiscord<cabboose> doesn't really make sense with how ref objects work
05:57:35FromDiscord<Elegantbeef> Well depending on your GC it'd be copied over
05:57:43FromDiscord<cabboose> using refc
05:57:54FromDiscord<Elegantbeef> Then no, refc doesnt have shared heaps
05:58:15FromDiscord<cabboose> hmm
06:02:40FromDiscord<cabboose> does owned function by registering the ref with the GC?
06:02:50FromDiscord<cabboose> so could move semantics be used to transfer the ref to another GC?
06:03:05FromDiscord<cabboose> and using allocshared in the intermediary
06:03:19FromDiscord<cabboose> que nah that seems stupid
06:03:58FromDiscord<Elegantbeef> There is `std/isolation` but idk how supported it is 😀
06:07:13FromDiscord<cabboose> Looks good
06:07:57FromDiscord<cabboose> The ownership of the refs isn't hard to reason with on my side
06:08:01FromDiscord<cabboose> so hopefully can get that working
07:06:43*PMunch joined #nim
07:49:36*max22- joined #nim
07:52:22*NeoCron joined #nim
07:56:02FromDiscord<cabboose> So strings that get converted to cstring are truncated to 128 len?
07:57:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ylx
07:57:33FromDiscord<Elegantbeef> They really cant since the cstring is the string
07:57:52FromDiscord<cabboose> I'm having a json truncated when converted to cstring
07:57:57FromDiscord<Elegantbeef> Nim puts a `\0` at the end of the string as a hidden element
07:58:06FromDiscord<Rika> Show code
07:58:12FromDiscord<Elegantbeef> You sure it just doesnt have a `\0` somewhere?
07:58:24FromDiscord<cabboose> hmm maybe; i'm using jsony
07:58:26FromDiscord<cabboose> {"dob":"2021-09-09 03:57:20","entit":{"kind":"Non","mcare":"","conc":"","snet":"","rpat":"","ndss":"","ctg_stat":false},"gndr":"","sx":"","deceased":false,"facility":0,"name":{0:""},"contact":{"p":"","h":"","m":"","f":"","e":""},"status":false,"address":{0:" ",1:" ",2:" "},"did":0,"wid":0,"uids":[],"pid":5}
07:58:31FromDiscord<cabboose> that's the json i'm trying to convert
07:58:41FromDiscord<cabboose> sent a code paste, see https://play.nim-lang.org/#ix=
07:58:44FromDiscord<cabboose> gets truncated to that
07:58:55FromDiscord<cabboose> (edit) "{"dob":"2021-09-09 03:57:20","entit":{"kind":"Non","mcare":"","conc":"","snet":"","rpat":"","ndss":"","ctg_stat":false},"gndr":"","sx":"","deceased":false,"facility":0,"name":{0:""},"contact":{"p":"","h":"","m":"","f":"","e":""},"status":false,"address":{0:" ",1:" ",2:" "},"did":0,"wid":0,"uids":[],"pid":5}" => "sent a code paste, see https://play.nim-lang.org/#ix="
07:59:13FromDiscord<Elegantbeef> `assert '\0' notin yourStringdJson`
07:59:24FromDiscord<cabboose> oki gimme a sec
07:59:26FromDiscord<Rika> Don’t run in danger
07:59:30FromDiscord<Rika> Use release
08:01:10FromDiscord<cabboose> Oh right I'm stupid
08:01:19FromDiscord<cabboose> I made default gndr and sx '\0'
08:01:21FromDiscord<cabboose> jesus
08:01:23FromDiscord<cabboose> kill me
08:01:26FromDiscord<Elegantbeef> I dont imagine a `\0` got encoded into the json
08:01:31FromDiscord<Elegantbeef> Lol
08:01:35FromDiscord<Elegantbeef> Cstrings are lovely eh
08:01:36FromDiscord<cabboose> not unless you specifically put it in
08:01:40FromDiscord<cabboose> 😂
08:01:42FromDiscord<cabboose> thanks ❤️
08:24:35*darwillim86d joined #nim
08:27:37*jjido joined #nim
08:34:05*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:51:39*jjido joined #nim
08:58:27*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:06:29*TakinOver quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
09:27:58*PMunch quit (Ping timeout: 260 seconds)
10:13:37FromDiscord<Archion> Sport is bad
10:14:17*PMunch joined #nim
10:18:52FromDiscord<Rika> ?
10:32:02*jjido joined #nim
10:48:40*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
10:49:44*Vladar joined #nim
11:17:25*max22- quit (Ping timeout: 260 seconds)
11:31:08FromDiscord<bolino> Hi! I'd like to have a structure of Tables in Table, equivalent to a dict of dicts in python (mydict = `{"key1":{"key11":"value11", "key12":"value12"},"key2":{"key21":"value21", "key22":"value22"}}`)
11:31:37FromDiscord<bolino> (edit) ""key22":"value22"}}`)" => ""key22":"value22"}}`)↵↵I wonder why I can't initialize it with `var sp = Table[string, Table[string, string]]`?"
11:32:02PMunchTry `var sp: Table[string, Table[string, string]]
11:32:11PMunch`var sp: Table[string, Table[string, string]]`
11:32:24PMunchNote the colon instead of the equal sign
11:32:39FromDiscord<greenpete> Are there any Nim lang podcasts?
11:33:03FromDiscord<bolino> Ah yeah of course! Thanks. Or I can use `newTable` I guess also
11:33:09PMunch@greenpete, none that I know of. Closest you'll get at the moment is the monthly live chat
11:33:12FromDiscord<bolino> thank you!!
11:33:19PMunchNo problem :)
11:35:16FromDiscord<Rika> In reply to @bolino "Ah yeah of course!": Not new, init
11:35:17FromDiscord<enthus1ast> and there also is the "This Month in Nim"
11:35:30FromDiscord<enthus1ast> https://nim-lang.org/blog.html
11:35:45FromDiscord<Yardanico> that's what PMunch talked about :)
11:36:40FromDiscord<enthus1ast> is this also a live talk?
11:37:23FromDiscord<Yardanico> oh sorry he mentioned the meeting then I guess
11:37:44PMunchYeah I was talking about the meeting :P
11:38:43FromDiscord<greenpete> Thanks!↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
11:42:23FromDiscord<ant1fact> Hello everyone, I am just picking up nim after python for a small project and I am trying to do things as correctly as possible. I need some simple but important data types which are mostly different sized vectors of floats and ints. When creating these types, should I use object or a tuple instead? I cannot find a straightforward answer about this. Are there pros and cons to them?
11:42:29FromDiscord<ant1fact> (edit) "Hello everyone, I am just picking up nim after python for a small project and I am trying to do things as correctly as possible. I need some simple but important data types which are mostly different sized vectors of floats and ints. When creating these types, should I use object or a tuple instead? I cannot find a straightforward answer about this. Are there pros and cons to them? ... " added "Thanks"
11:43:02FromDiscord<haxscramper> Use object
11:43:08FromDiscord<haxscramper> `tuple` is a throwaway anonymous single-use thing
11:43:19FromDiscord<enthus1ast> tuples have all their fields visible, object fields must be exported
11:43:48FromDiscord<enthus1ast> (from other modules)
11:48:05FromDiscord<ant1fact> I am not convinced that you are actual bots : )
11:50:39FromDiscord<haxscramper> this is a discord \<-\> matrix bridge
11:50:47PMunchI'd say use objects, they both look the same in memory on runtime, but have slightly different semantics on compile-time.
11:53:56*jjido joined #nim
11:58:14FromDiscord<ant1fact> Thanks for all the info
12:06:02*supakeen quit (Quit: WeeChat 3.2.1)
12:06:32*supakeen joined #nim
12:09:36*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
12:25:41FromDiscord<ant1fact> Are there any best practices for parsing large text files (millions of lines) to increase performance?
12:27:00FromDiscord<enthus1ast> do it line by line (if you can), do not use split("\\n") but eg. lines iterator, maybe strscan or parseutils are your friends
12:27:38FromDiscord<enthus1ast> or even do everything yourself
12:27:56FromDiscord<ant1fact> is readFile(f).splitLines() ok or better to go with readLine() ?
12:27:57*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:29:13FromDiscord<Rika> splitlines will process the whole file most likely
12:29:19FromDiscord<Rika> use iterators
12:29:31FromDiscord<enthus1ast> there is `lines` https://nim-lang.org/docs/io.html#lines.i%2Cstring
12:29:47FromDiscord<ant1fact> mostly what I need to do is parse ints and floats out of lines. for floats I can use scanf() because I always expect 3 of them so I can do $f $f $f but for ints the number of ints in the line can change, any best alternative to scanf() in that case?
12:30:19FromDiscord<Rika> there is parseutils as enthusiast says
12:30:33FromDiscord<ant1fact> I wrote a proc that uses parseFloat but I also use .split(' ') on the line
12:30:42FromDiscord<Rika> its ok to split on lines
12:30:45FromDiscord<Rika> just do not split to get lines
12:30:50FromDiscord<ant1fact> ahhh
12:30:51FromDiscord<ant1fact> ok!
12:30:55FromDiscord<Rika> unless your lines are also long, then split might be slow
12:31:07FromDiscord<enthus1ast> but for great performance, i would not backtrack
12:31:27FromDiscord<ant1fact> where does the backtracking happen at the moment?
12:31:29FromDiscord<enthus1ast> there is no need to split the line first
12:31:56FromDiscord<enthus1ast> but parseFloat ; skipWhitespace ; parseFloat ; etcc...
12:32:11FromDiscord<ant1fact> hmmm
12:32:17FromDiscord<ant1fact> may not even need lines then
12:32:22FromDiscord<enthus1ast> when you encounter newline yield
12:32:25FromDiscord<ant1fact> just store floats every 3 floats
12:32:33FromDiscord<Rika> is it strictly 3 floats?
12:32:36FromDiscord<ant1fact> for floats yes
12:32:37FromDiscord<Rika> if it is then you dont need lines
12:32:39FromDiscord<ant1fact> for ints its variable
12:32:43FromDiscord<Rika> oh hm
12:32:44FromDiscord<ant1fact> thats where i am struggling
12:32:49FromDiscord<ant1fact> ints can be 3
12:32:51FromDiscord<ant1fact> 4
12:32:52FromDiscord<ant1fact> 5
12:33:13FromDiscord<Rika> then lines is still ok
12:35:18*rockcavera joined #nim
12:35:19*rockcavera quit (Changing host)
12:35:19*rockcavera joined #nim
12:36:28FromDiscord<ant1fact> Really appreciate all the tips, folks
12:36:33FromDiscord<ant1fact> Having a blast with nim
12:42:20FromDiscord<bolino> Same here, really appreciate the community, you guys are super helpful! The community is really the most important criteria for a language 🙂
12:46:01*max22- joined #nim
12:46:55PMunchWe try our best (for the most part)
12:55:26*arkurious joined #nim
12:57:12PMunchDamn, finding a good dithering algorithm that can run on a GPU is hard
12:58:44PMunchAny ordered/positional algorithm will work, but those typically look pretty bad
12:58:55FromDiscord<Rika> have you seen about "a dither"?
12:59:04*max22- quit (Quit: Leaving)
12:59:06PMunchHuh?
12:59:16FromDiscord<Rika> the name oft he algo
12:59:18FromDiscord<Rika> is "a dither"
12:59:23FromDiscord<Rika> https://pippin.gimp.org/a_dither/
12:59:27FromDiscord<Rika> certainly confusing
12:59:32FromDiscord<Rika> but i think it looks pretty good
12:59:48FromDiscord<Rika> unless you've implemented void-and-cluster
13:00:00FromDiscord<Rika> which is kinda hard, its pretty complex
13:01:37PMunchVoid and cluster is also positionally complex..
13:01:43PMunchcomputationally*
13:02:22FromDiscord<Rika> a dither is pretty fast i think
13:02:25FromDiscord<Rika> still needs floats
13:02:35FromDiscord<Rika> but you can use 32s and it should be fine
13:02:37FromDiscord<Rika> maybe even 16s
13:02:49FromDiscord<Rika> prolly implementable as a shader
13:03:29PMunchOoh, a dither seems promising
13:03:59FromDiscord<Rika> it doesnt help that its name is so generic lmao
13:04:18FromDiscord<Rika> whats the dithering for btw
13:05:23PMunchAn eInk screen
13:05:38FromDiscord<Rika> saaaaaame
13:05:49FromDiscord<Rika> i was planning on using it for my eink screen too
13:05:55FromDiscord<Rika> but i cant implement it on gpu...
13:06:24FromDiscord<Rika> since it's not an opengl context (it's a regular android one) and i dont know how to program on gpu for that...
13:06:30PMunchIt's a computer monitor with HDMI input, but the dithering that comes with it appears to be something like Floyd-Steinberg. So when I move the mouse all the pixels to the right and down from the cursor updates which looks terrible when you consider ghosting..
13:07:09FromDiscord<Rika> how will you disable the internal dithering?
13:07:51PMunchEither by just setting it to BW mode, or by using another driver board
13:09:59PMunchYou wouldn't happen to have a dither implemented in Nim would you?
13:12:25FromDiscord<Rika> i do
13:12:29FromDiscord<Rika> but its cpu ofc
13:12:36PMunchOf course
13:12:41PMunchI just wanted to try it out
13:13:10FromDiscord<Rika> ill just pastebin it okay
13:14:06PMunchSure
13:14:29FromDiscord<Rika> give me a moment then
13:19:33*max22- joined #nim
13:24:07FromDiscord<Rika> https://cryptpad.fr/code/#/2/code/view/dZ57STcjOOkYfzoGEPt2VLiRur3ezDJrC-mfJLlNk04/embed/
13:24:08FromDiscord<Rika> i think that works
13:25:06FromDiscord<Archion> Mhm
13:25:10PMunchAh, you have processed it quite a bit :P
13:25:21FromDiscord<Archion> Why are you do this bot thing when there are tupperbox bot
13:25:23FromDiscord<Archion> A
13:25:30FromDiscord<Rika> er is that bad or good
13:25:37FromDiscord<Rika> i made it when i was still learning nim mind you
13:25:39FromDiscord<Rika> 😛
13:26:42FromDiscord<Rika> for per-channel/rgb versions you have to run the same thing per channel
13:26:52FromDiscord<Rika> so greyscale is 3x faster
13:31:35PMunchGood thing I'll be doing grayscale then :)
13:32:14FromDiscord<Rika> i mean, is the input pre-processed into greyscale?
13:32:36FromDiscord<Rika> i guess you can just add that to the shader actlly
13:35:12PMunchI would definitely have to do that for the real shader
13:35:24PMunchNow I'm just testing dithering algorithms on pngs :P
13:36:36FromDiscord<Rika> i was about to send image examples but i forgot i used an nsfw image
13:40:22FromDiscord<Yardanico> lol
13:46:53PMunchHmm, this is pretty interesting
13:47:01PMunchBut I can't really tell how it actually works :P
13:48:00FromDiscord<Rika> well it IS just magic numbers
13:48:37PMunchSure, but how did he come up with them :P
13:48:43PMunchAnd are there better ones out there?
13:49:00FromDiscord<Rika> probably experimentation
13:49:06FromDiscord<Rika> better ones? no clue
13:49:11FromDiscord<Rika> it would probably be on the site
13:49:12FromDiscord<Rika> if there were
13:49:19FromDiscord<Rika> it says on the bottom of the site
13:49:27PMunchI'm kinda tempted to write a error function and just brute force the numbers
13:49:28FromDiscord<Rika> `If someone comes up with better magic numbers to use on variations of the above formulas, please tell me`
13:49:36FromDiscord<Rika> call me if you do
13:49:41PMunchReally only two numbers for the addition algorithm
13:49:50FromDiscord<Rika> well if you do AND decide it should be either pubdomain or open source
13:50:04FromDiscord<Rika> for the add one its three
13:50:11FromDiscord<Rika> ah, no
13:50:13FromDiscord<Rika> two yeah
13:50:18FromDiscord<Rika> 237 and 119
13:50:58PMunchI guess they should be in the range 0..255
13:51:09FromDiscord<Rika> yes
13:51:16PMunchMeaning there's about 64k possibilities
13:51:41FromDiscord<Rika> for those wondering why it's `and 255`, it acts like a "faster" mod operation
13:52:57FromDiscord<impbox [ftsf]> I made a dither thing recently
13:53:02FromDiscord<impbox [ftsf]> Interesting stuff
13:53:55FromDiscord<Rika> an a dither thing or a dither thing
13:54:10FromDiscord<impbox [ftsf]> Yadither
13:54:14FromDiscord<Rika> ?
13:54:21FromDiscord<impbox [ftsf]> Yet another
13:54:50FromDiscord<impbox [ftsf]> But basically building a lookup table of ascending numbers
13:55:12FromDiscord<Rika> ah yeah you can do that for a dither as well, i just havent figured that out 🙂
13:55:15FromDiscord<impbox [ftsf]> Then using that with a per pixel threshold
13:55:47FromDiscord<Rika> well i figured it out mentally i mean, i just havent coded it
13:55:55FromDiscord<impbox [ftsf]> Similar to a bayer dither but with a different layout
13:56:14FromDiscord<impbox [ftsf]> I guess you can experiment with different layouts to see what gives the aesthetic you want
13:57:08FromDiscord<impbox [ftsf]> If you take a X by Y array and fill it with numbers from 1..XY
13:57:37FromDiscord<impbox [ftsf]> In a way that adjacent numbers are far apart spatially
13:57:55FromDiscord<impbox [ftsf]> Taking into account the grid wraps on both axes
13:58:42FromDiscord<impbox [ftsf]> You can compute an optimal one, but maybe a less optimal solution will look more aesthetically pleasing
13:59:10FromDiscord<bolino> sent a long message, see http://ix.io/3yn9
13:59:28FromDiscord<bolino> (edit) "http://ix.io/3yn9" => "http://ix.io/3yna"
13:59:43FromDiscord<impbox [ftsf]> `for v in variants.mitems:`
13:59:55FromDiscord<impbox [ftsf]> Will give you a mutable iteration
14:00:02PMunchI looked at some bayer dithers, but the results are so bad :(
14:00:28FromDiscord<impbox [ftsf]> They're not the prettiest
14:00:46FromDiscord<impbox [ftsf]> Did you check the article on Obra Dinns Dithering?
14:01:24PMunchOh damn, I didn't even think of that!
14:01:35PMunchI read it when the game came out, just as a curiosity
14:01:53FromDiscord<bolino> sent a code paste, see https://play.nim-lang.org/#ix=3ynd
14:01:57PMunchBut I remember them talking about looking for something that would be stable with animations
14:02:18FromDiscord<Rika> make your table mutable
14:02:20FromDiscord<Rika> let -> var
14:02:43FromDiscord<impbox [ftsf]> Blue noise dithering
14:03:16FromDiscord<Rika> blue noise dithering is similar to void and cluster
14:03:38FromDiscord<Rika> personally i prefer the look of "a dither add"
14:04:07FromDiscord<bolino> sent a code paste, see https://play.nim-lang.org/#ix=3yne
14:04:20FromDiscord<Rika> looks correct
14:04:35FromDiscord<bolino> can it become immutable when passed to a function?
14:04:39FromDiscord<Rika> do you call the for loop in a function
14:04:40FromDiscord<Rika> yes
14:04:42FromDiscord<Rika> it can
14:04:46FromDiscord<bolino> it's initailized elsewhere
14:04:50FromDiscord<Rika> `variants: var seq[...]`
14:05:01FromDiscord<Rika> instead of what you have on the parameters right now
14:05:09FromDiscord<bolino> Thanks, ok, let me try
14:05:25FromDiscord<bolino> (I'm always confused about the initialization in Nim)
14:07:35FromDiscord<bolino> (you mean `var variants: seq[...]` right?)
14:07:41PMunchHmm, Obra Dinn dithering is unfortunately very much based on having control over the rendering..
14:08:13FromDiscord<Rika> In reply to @bolino "(you mean `var variants:": no
14:08:14FromDiscord<Rika> i do not
14:08:16PMunchI mean I have control over the windows, so I can dither on a window by window basis and exclude the mouse. That by itself will help immensely
14:08:21FromDiscord<Rika> i mean put that in the fucntion parameters
14:08:35FromDiscord<Rika> `proc aaaa(variants: var seq[...], ...`
14:08:48FromDiscord<enthus1ast> var in functions is like "in out" in other langs
14:09:27FromDiscord<bolino> In reply to @Rika "i mean put that": Oooh ok
14:09:56FromDiscord<enthus1ast> by default function parameters are not mutable
14:10:28PMunchHmm, what would be a good error function? Total error in the image?
14:12:21FromDiscord<bolino> @Rika Works! Thanks! Learned something.
14:12:32FromDiscord<Rika> congrats
14:12:47FromDiscord<Rika> meanwhile im suffering trying to learn android programming xddd
14:12:50FromDiscord<bolino> Now I have to figure out out to delete a key/value pair from a table from the key - looks like .del() doesn't do the trick
14:13:01FromDiscord<bolino> In reply to @Rika "meanwhile im suffering trying": Kotlin?
14:13:19FromDiscord<Rika> kotlin, opengl, trying to do the same thing as pmunch but on a fucking android app
14:13:34FromDiscord<Rika> In reply to @bolino "Now I have to": del should do the trick
14:13:41FromDiscord<Rika> as long as you do not have duplicate values for the same key
14:13:44FromDiscord<enthus1ast> https://nim-lang.org/docs/tables.html#del%2CTable%5BA%2CB%5D%2CA↵(@bolino)
14:13:47PMunchYou know Android has OpenGL right?
14:13:55FromDiscord<bolino> By the way I remember a few articles from Lucas Pope on forums when he was coding Obra Dinn
14:13:55FromDiscord<enthus1ast> but be aware that you should not delete stuff while iterating over it
14:13:59FromDiscord<Rika> i just said that pmunch
14:14:01PMunchYou can use Nim on Android :P
14:14:02FromDiscord<Rika> look at the start of my msg
14:14:09PMunchYeah I just realised :P
14:14:11FromDiscord<Rika> cpu dithering is still slow
14:14:53FromDiscord<Rika> im not sure how a slow draw function would affect this tablet but i cant imagine it being ok
14:15:12FromDiscord<bolino> In reply to @enthus1ast "https://nim-lang.org/docs/tables.html#del%2CTable%5": yup but doesn't work in my case, need to figure out why
14:15:35FromDiscord<enthus1ast> what means 'doesn't work' ?
14:15:57FromDiscord<bolino> oh sorry my bad. it's fine
14:16:00FromDiscord<bolino> thanks guys!
14:16:01FromDiscord<Rika> he doesnt know
14:16:01FromDiscord<Rika> ah
14:16:09FromDiscord<Rika> slow msg sending sorry xd
14:16:15FromDiscord<bolino> that's ok
14:16:46FromDiscord<Rika> man im almost tempted trying to make a custom rom for this tablet but then i dont know how i would install it...
14:16:47FromDiscord<Rika> hmm
14:16:52FromDiscord<Rika> my options are limited xd
14:17:49FromDiscord<enthus1ast> closed hardware will be a big problem in the future...
14:18:23FromDiscord<Rika> in the future??? its already one now
14:18:49FromDiscord<enthus1ast> at least most notebooks still allow you to install your desired os
14:19:48NimEventerNew thread by DPixie: Passing JsonNode from Nimscript to host proc, see https://forum.nim-lang.org/t/8407
14:22:01*PMunch quit (Quit: Leaving)
14:22:08FromDiscord<enthus1ast> yeah, there should be some best practices documented somewhere how to shouvle data back and forth the vm
14:22:18FromDiscord<enthus1ast> useing json seems like a dirty hack to me
14:24:12FromDiscord<haxscramper> `const runtimeData = newLit(<compile-time data>)`
14:24:32FromDiscord<haxscramper> or `let runtimeData = newLit(<CT data>)`
14:25:20FromDiscord<enthus1ast> is it really so simple?
14:25:36FromDiscord<enthus1ast> will play with it later
14:27:04FromDiscord<haxscramper> `newLit()` generates object constructor for your data, so it is the same as writing `MyType(field1: ..., field2: ...)` and so on
14:27:23FromDiscord<haxscramper> it has some limitations IIRC, but for data that makes sense to be transferred from VM it is good enough
14:27:51FromDiscord<haxscramper> Like if you have complex cyclic `ref` graph it would probably be weird
14:43:51FromDiscord<haxscramper> [leorize](https://matrix.to/#/@leorize:envs.net)\: Is it possible to pin to `1.4.8` specifically in https://github.com/alaviss/setup-nim
14:43:54nrds<R2D299> itHub: 7"CI helpers to setup Nim using prebuilt nightlies"
14:44:35FromDiscord<haxscramper> Now 1.4.9 is available, and it breaks some things in my code, so I need to pin it to specific pathc
14:45:13FromDiscord<haxscramper> Just doing ` nim: ['version-1-4-8']` results in `Error: Could not find any release named 'latest-version-1-4-8'. The provided branch (version-1-4-8) might not be tracked by nightlies, or is being updated.`
14:48:46FromDiscord<ynfle (ynfle)> What does "in scope" mean regarding `declaredInScope`?
14:51:57FromDiscord<haxscramper> I would assume it means "identifier can be accessed from current scope"
14:52:37FromDiscord<ynfle (ynfle)> and `declared`?
14:52:43FromDiscord<haxscramper> identifier exists
14:52:43FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3ynr
14:53:25FromDiscord<haxscramper> ... this gets tricky when you consider templates/generics etc
14:54:02FromDiscord<bolino> What would be the best way to remove/delete several items from a sequence?↵If I loop over it to get the indexes to delete, then delete one, it changes the indexes.
14:54:07FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3yns
14:54:51FromDiscord<Archion> This is
14:54:59FromDiscord<Archion> Too complicated for me
14:56:20FromDiscord<enthus1ast> i would return a new sequence
14:56:45FromDiscord<bolino> In reply to @enthus1ast "i would return a": Yeah I guess no choice...
14:59:30FromDiscord<enthus1ast> with the items filtered you dont want
14:59:32FromDiscord<haxscramper> If you only need to filter out the sequence you can do `import std/sequtils; mySeq.filterIt(predicate it)`
14:59:33FromDiscord<ynfle (ynfle)> is the playground down?
14:59:39FromDiscord<haxscramper> seems like it
15:00:30FromDiscord<haxscramper> https://tio.run/##y8vM/f@/oCg/WSE/OzokViOxKN1KIURTwVYhNTkjXyElNTknsSg1RQPK8EksSS3SVODKz9YwNNLkykktUUCWAWozNDIGIpACpZLy1JIiJU2o4v//AQ
15:00:44FromDiscord<haxscramper> god, this link is like
15:01:29FromDiscord<haxscramper> Absolutely insane, especially compared to ix.io or wandbox
15:01:31FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3ynD
15:01:35FromDiscord<haxscramper> sent a code paste, see https://paste.rs/eZq
15:02:14FromDiscord<haxscramper> This code outputs true/false invocations after because `declared` seems to check that entry is declared in the scope of the first instantiation
15:02:33FromDiscord<haxscramper> second `ok(12)` does not instantiate anything new, so it uses old definition
15:03:05FromDiscord<haxscramper> and old defn. was first instantiated in place where `declaredLater` was `not declared`
15:03:43FromDiscord<haxscramper> declaredInScope just does false on all, but I'm not sure why
15:07:46FromDiscord<enthus1ast> mh [haxscramper](https://matrix.to/#/@haxscramper:matrix.org) when i try fromLit real quick i get " `false` not yet supported\: Foo [AssertionDefect]"
15:08:10FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3ynI
15:08:16FromDiscord<haxscramper> from Lit?
15:08:17FromDiscord<enthus1ast> (even withouth the seq)
15:08:20FromDiscord<enthus1ast> yep
15:08:26FromDiscord<enthus1ast> i want to get data from the vm
15:08:29FromDiscord<haxscramper> I've never used from lit
15:08:48FromDiscord<haxscramper> If you need to get data from vm you need to `newLit()`
15:08:59FromDiscord<haxscramper> Take VM data and generate literal value
15:09:11FromDiscord<haxscramper> And then assign literal value to some runtime whatever
15:09:55FromDiscord<enthus1ast> https://nim-lang.org/docs/compiler/vmconv.html#fromLit%2CPNode%2Ctypedesc
15:10:59FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3ynJ
15:11:03FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3ynK
15:11:05FromDiscord<haxscramper> asdf
15:11:16FromDiscord<haxscramper> you were talking vm, like nim VM
15:11:44FromDiscord<haxscramper> Not in context of macros
15:12:15FromDiscord<enthus1ast> yes
15:12:35FromDiscord<haxscramper> Well, moving data across VM boundaries is an open question for now, but when 1.6 comes out with `cast(uncheckedAssign)` I think I would be able to make pretty simple deserialization tool
15:12:45FromDiscord<haxscramper> But VM data is just `PNode`
15:13:56FromDiscord<haxscramper> https://discord.com/channels/371759389889003530/371759389889003532/866296935077904404
15:15:30FromDiscord<haxscramper> So it all comes down to `PNode` deserialization, and there is no solution that works reliably for it
15:15:58FromDiscord<haxscramper> But again, with 1.6 I think I will implement this for hnimast, since I also need to for some things
15:16:47FromDiscord<haxscramper> PMunch also proposed using json IIRc
15:17:20FromDiscord<enthus1ast> yes
15:17:36FromDiscord<enthus1ast> i do this now and it works
15:17:56FromDiscord<enthus1ast> but it seems a little strange to me to leave nim land while deep in nim land
15:18:49FromDiscord<haxscramper> Yes. But as I said, my hypotheis is that direct (de)serialization via PNode is the fastests by definition method
15:19:09FromDiscord<haxscramper> But I need to implement it
15:19:46FromDiscord<haxscramper> "just"
15:21:43FromDiscord<enthus1ast> it seems that fromLit was made for this purpose?
15:22:02FromDiscord<haxscramper> well, does it work?
15:22:04FromDiscord<enthus1ast> but yeah
15:22:08FromDiscord<enthus1ast> no \:D
15:22:41FromDiscord<haxscramper> In cases like this I prefer to just roll my solution, since putting this in compiler/fixing fromLit would divert compiler dev's attention
15:23:09FromDiscord<haxscramper> and I get faster feedback loop, and can tweak what I need immediately
15:23:11FromDiscord<enthus1ast> i must admit that i was quite surpirsed that there is no good way to do this
15:23:26FromDiscord<haxscramper> well, nim vm officially "does not exist"
15:23:33FromDiscord<haxscramper> like, it is an internal compiler API
15:23:45FromDiscord<enthus1ast> naaah it is advertised as a scripting language \:)
15:23:59FromDiscord<haxscramper> And you are one of five? people that actually dived deep enough to hit the bottom
15:24:10FromDiscord<haxscramper> I"m not saying it takes a lot to do this, but
15:24:32FromDiscord<haxscramper> well, when yardanico made package graph there were two package group total, that required compier
15:24:33FromDiscord<haxscramper> My hnimast and godot
15:25:13FromDiscord<haxscramper> so it is not popular enough yet for official guide to appear. I just sit here/in telegram and answer question like this,
15:25:48FromDiscord<haxscramper> But I"m considering writing an article about this, at least when I will have somewhat clear(er) picture of what I should put in there
15:25:57FromDiscord<haxscramper> not vm, but in general
15:26:07FromDiscord<haxscramper> "getting started with nim comiler API"
15:26:47FromDiscord<enthus1ast> to me it seems like this question especially "how to use nimvm for my dynamic scripting" comes up more often lately
15:27:10FromDiscord<haxscramper> yes, once you know about it
15:27:18FromDiscord<haxscramper> then you want to put it everywhere
15:27:25FromDiscord<haxscramper> it's like macros
15:27:52FromDiscord<haxscramper> once you start using it to solve some specific kind of issues it is almost impossible to get back
15:28:24FromDiscord<enthus1ast> nim has replaced toml in my monitoring system, a LOT less configuration
15:28:46FromDiscord<enthus1ast> so it was worth it, even if i had to use json for serialisation
15:29:26FromDiscord<enthus1ast> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/885547194114015262): nim(s) has replaced toml in my monitoring system, a LOT less configuration
15:30:04FromDiscord<enthus1ast> +1
15:35:35FromDiscord<enthus1ast> when i look at the implementation of fromLit it seems quite doable (for me ;) ) to implement the stuff i need
15:35:57FromDiscord<enthus1ast> but i guess there are zillions of corner cases
15:44:05*mdbauman_ joined #nim
15:47:07*mdbauman quit (Ping timeout: 252 seconds)
15:53:24FromDiscord<haxscramper> `cast(uncheckedAssign)` is single best thing that happened for serialization
15:53:56FromDiscord<haxscramper> The main issue with pnode deserialization were handling discriminant objects
15:54:09FromDiscord<haxscramper> Well, not "singel best thing", but it is pretty good
16:05:30arkanoidcan I mix importc and importcpp in same project?
16:07:09FromDiscord<treeform> yes, as far as I understand it, importcpp is just a different calling convention.
16:07:53FromDiscord<treeform> it does not have anything to do with cpp, it just says `a.proc(b, c)` instead of `proc(a, b, c)`
16:09:02arkanoidI've already wrapped the C version of a library and it is working, but the C++ version has handy proxy objects that could improve the nim interface. Unsure about the payoff
16:20:41FromDiscord<haxscramper> having `importcpp` implicitly promotes file to use `C++` compiler
16:21:16FromDiscord<haxscramper> `type a {.importcpp.} = object` compiled with `nim c file.nim` fails with `hidden symbol `\_Z13systemInit000v' isn't defined`-`execution of an external program failed\: 'g++ -o /tmp/asdfasdf\`
16:21:20FromDiscord<haxscramper> g++
16:25:21FromDiscord<reilly> Does Nim provide a way of typing a proc argument based on whether or not a type implements a particular set of procs?
16:28:23FromDiscord<reilly> So, say I want a proc to accept any type so long as that type has the procs `proc a(x: T): int` and `proc b(x: T, y: int): string`.
16:30:29FromDiscord<reilly> You can just use a generic and the compiler will complain when you try and use an invalid type, but nimsuggest unhelpfully points the blame at the proc itself, and not the call that's causing the problem.
16:30:59FromDiscord<cabboose> wait what
16:31:05arkanoidI'm getting error with "@[myEnumValue][0].unsafeAddr", but "let foo = @[myEnumValue]\nfoo[0].unsafeAddr" works. I've been trying with parenthesis here and there but still returns error. How's the grammar here?
16:31:35FromDiscord<reilly> I mean, it does complain about a "generic/template instantiation from here" but that doesn't make it immediately obvious what the problem is.
16:32:14FromDiscord<cabboose> arkanoid does wrapping the seq in brackets create a tuple or does it still evaluate as a seq?
16:33:02FromDiscord<cabboose> @reilly I mean I don't event understand what you are asking
16:33:06FromDiscord<cabboose> I am probably too cooked and tired
16:33:08FromDiscord<cabboose> I should really study
16:33:12FromDiscord<cabboose> but medicine is boring
16:33:41FromDiscord<cabboose> @reilly can you provide code?
16:33:59arkanoidcabboose: it's still a seq
16:34:01FromDiscord<cabboose> In reply to @arkanoid "I'm getting error with": hahaha I didn't see you already said you tried with paranthesis; i'm definitely too tired
16:34:12FromDiscord<reilly> Yeah, it's kind of hard to explain well, I think. I've actually thought about it a little more after I wrote that and realized it's not really necessary, so don't worry about it.
16:35:09arkanoidthe error I'm getting is: Error: expression has no address
16:35:36arkanoidseems like the address of the seq can't be acquired on same line
16:35:44FromDiscord<cabboose> Yeah it's not a reference, it doesn't really have a address
16:35:48FromDiscord<cabboose> because its a enum
16:35:53FromDiscord<cabboose> right?
16:36:30FromDiscord<Rika> In reply to @reilly "Does Nim provide a": yes but its experimental
16:36:41FromDiscord<Rika> concepts i believe will do what you want
16:37:13FromDiscord<Rika> docs are on `manual_experimental`
16:39:39FromDiscord<cabboose> In reply to @arkanoid "seems like the address": Yeah I wonder if the building of the seq gets optimised out so you are just left trying to get the ref to a enum value
16:40:07FromDiscord<cabboose> But if you assign it then it builds the seq and you actually have a address in memory that has that assignment
16:40:28FromDiscord<cabboose> I am not making sense to myself
16:41:26FromDiscord<cabboose> sent a code paste, see https://play.nim-lang.org/#ix=3yo2
16:43:17FromDiscord<cabboose> or maybe even `@[MyEnumValue][0].unsafeAddr` still wouldn't work because without doing an assignment you aren't reserving any memory that would get referenced to on runtime and the compiler tries to evaluate that on compilation
16:44:24FromDiscord<reilly> In reply to @Rika "docs are on `manual_experimental`": I had no idea this existed!
16:44:32FromDiscord<Rika> i mean
16:44:36FromDiscord<Rika> its experimental
16:44:58FromDiscord<Rika> so if you're writing library code or prod code its not really something you'd use
16:46:29*jjido joined #nim
16:47:02FromDiscord<cabboose> Concepts are too much for me. Macros was enough of a hurdle to get (although in hindsight they are much simpler despite their verbosity)
16:51:57arkanoidcabboose: yeah, probably
16:52:22arkanoidI still have to find and use for concepts. What would you use it for?
16:52:54arkanoidI mean, I got the meaning, it's something like typeclasses in haskell
16:54:38*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
17:01:00arkanoiddo you know if there's a nim lib proc that splits "http://user:pass@url/path" into @[http,user,pass,url,path] ?
17:01:35FromDiscord<cabboose> https://github.com/treeform/urlly has really good parsing afaik
17:01:36nrds<R2D299> itHub: 7"Uri and Url parsing for Nim for C and JS backend. Similar api to Window.location."
17:11:43arkanoidyeah! thanks treeform
17:18:44arkanoidI'm getting "object constructor needs an object type" and I don't know what I'm doing wrong
17:23:21arkanoidplay.nim-lang.org is down?
17:24:36FromDiscord<Rika> yed
17:24:36FromDiscord<Rika> yes
17:24:44arkanoidI'm getting "type expected" and "object constructor needs an object type" on "initOnvif" call here https://termbin.com/l5ek
17:24:48FromDiscord<cabboose> Does it have something to do with the nim update lol
17:25:10FromDiscord<Rika> no
17:26:05FromDiscord<Rika> `host: purl...` -> `host = purl`
17:26:08FromDiscord<Rika> same with others
17:26:33arkanoidoh dear
17:26:43arkanoidshame on me
17:28:17arkanoidthanks
17:28:23*rockcavera quit (Remote host closed the connection)
17:31:41FromDiscord<aleclarson> any way to tell nim "hey this proc is side-effect free" even though `{.noSideEffect.}` says `'myProc' can have side effects`
17:31:47FromDiscord<aleclarson> ?
17:32:03FromDiscord<cabboose> Lying is bad
17:32:23FromDiscord<aleclarson> i've no choice, the proc calls into node.js so i can't enforce it
17:32:29FromDiscord<aleclarson> but the library i'm using wants a side-effect free proc
17:32:47FromDiscord<Rika> what part has side effects?
17:32:53FromDiscord<Rika> of the proc with side effects
17:33:05FromDiscord<aleclarson> the part that calls into node.js
17:33:12FromDiscord<cabboose> You can always use cast
17:33:43FromDiscord<aleclarson> (edit) "the part that calls into node.js ... " added "(but in reality, no side effects will be made)"
17:33:50FromDiscord<cabboose> sent a code paste, see https://play.nim-lang.org/#ix=3yop
17:33:58FromDiscord<aleclarson> oh interesting
17:34:35FromDiscord<cabboose> But your nose will grow 🤥 (jk)
17:35:53FromDiscord<aleclarson> i'm fine with a squidward nose tbh
17:37:50FromDiscord<cabboose> https://media.discordapp.net/attachments/371759389889003532/885579764549685298/5mexy4.png
17:38:46FromDiscord<leorize> not at the moment, a proper impl has to be done in nightlies which I haven't found the time to work on
17:39:43FromDiscord<leorize> I think iffy have a fork of my setup-nim that supports versioning via the current tags system, so you can try that one out.
17:41:23FromDiscord<Recruit_main707> In reply to @cabboose "": the compiler must obey me, i know whats better, until there is a sentinent compiler, i decide
17:43:13FromDiscord<cabboose> sent a code paste, see https://play.nim-lang.org/#ix=3yot
17:43:35FromDiscord<haxscramper> `{.push: overflowChecks:off.}`
17:43:40FromDiscord<haxscramper> and 8+ checks
17:43:47FromDiscord<haxscramper> also `uncheckedAssign`
17:44:09FromDiscord<haxscramper> how to write a nuclear bomb in nim under 1 minute
17:44:11FromDiscord<cabboose> Mate we were playing with sticks and you brought a sword
17:44:21FromDiscord<haxscramper> no, sword is like
17:44:24FromDiscord<haxscramper> `import compiler`
17:44:29FromDiscord<haxscramper> road to madness
18:20:57FromDiscord<aleclarson> In reply to @cabboose "": lol
18:32:25*rockcavera joined #nim
18:32:25*rockcavera quit (Changing host)
18:32:25*rockcavera joined #nim
18:38:01*vicfred joined #nim
18:54:16FromDiscord<ynfle (ynfle)> What does the error `Error: expression 'block: ...' has no type (or is ambiguous)` mean?
18:57:11*max22- quit (Quit: Leaving)
18:58:23FromDiscord<Rika> The block doesn't "return" anything but the left hand side expects something
18:59:20*jjido joined #nim
19:01:17FromDiscord<Varriount> @Zevv I broke NPeg. Apparently my grammar is too large for the computedGoto
19:03:38FromDiscord<Varriount> sent a code paste, see https://play.nim-lang.org/#ix=3yoY
19:04:05FromDiscord<ynfle (ynfle)> @Rika I don't think it should expect something... hmmm... I'm not sure
19:09:06arkanoiddo you know if there's a lib proc to turn an uncheckedArray + int size into a seq?
19:14:29FromDiscord<Rika> You must copy in such case
19:15:10FromDiscord<Varriount> arkanoid: `@cast[array[type, N](uncheckedArray)` might work.
19:15:25*max22- joined #nim
19:15:38*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
19:15:42FromDiscord<Varriount> Or wait, that won't work if `N` isn't static.
19:17:10FromDiscord<haxscramper> There is no safe way to do this, since internal structure of a `seq` is considered an implementation detail
19:17:39FromDiscord<haxscramper> Also seqs are subject to garbage collection, so it might be a little more involved than just constructing object
19:18:51FromDiscord<haxscramper> The safest way would be to copy data ... that is slow, but I don't think stdlib provides anything to deal with this
19:33:10FromDiscord<Varriount> In reply to @haxscramper "The safest way would": You can use one of the unsafe copying mechanisms, but that will only work for types that aren't or don't contain references.
19:33:27*supakeen quit (Remote host closed the connection)
19:33:50*supakeen joined #nim
19:35:12FromDiscord<Varriount> @Zevv Zevv: Also, it seems that when I enable `npegTrace`, my program just crashes somewhere in the parsing code (this was in an attempt to debug a "backtrace depth exceeded" error).
19:44:00FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3yp8
19:44:12FromDiscord<aleclarson> (edit) "https://play.nim-lang.org/#ix=3yp8" => "https://play.nim-lang.org/#ix=3yp9"
19:46:07FromDiscord<haxscramper> this is not an error, it is a warning
19:46:59FromDiscord<haxscramper> also, please, don't raise `Defect` of all things
19:47:32FromDiscord<aleclarson> does it matter that i raise Defect? \:P
19:48:25FromDiscord<haxscramper> with `--panics:on` defects can't be caught, raising defect is probably second worst thing, with first one being `Exception` root - it does not provide any meaning whatsoever
19:48:34FromDiscord<haxscramper> There are things like `KeyError`, or `ValueError`
19:49:01FromDiscord<haxscramper> And `Cannot prove that 'result' is initialized.` is probably prover being stupid
19:49:07FromDiscord<haxscramper> this has been a warning for as long as I can remember
19:49:18FromDiscord<haxscramper> And I can bet it will never be turned into an error
19:49:36FromDiscord<aleclarson> good to know thx!
19:49:58FromDiscord<haxscramper> But back to `Defect` - I personally recommend never, ever touching it in any form
19:50:03FromDiscord<haxscramper> Especially raising it in your code
19:55:45FromDiscord<haxscramper> In reply to @aleclarson "good to know thx!": https://forum.nim-lang.org/t/7983#52131
19:56:52FromDiscord<haxscramper> If you need more thorough reasoning about `Defect`
20:24:42FromDiscord<ant1fact> In general, which approach is faster: strscans, parseutils or regex?
21:17:15FromDiscord<treeform> I think it always depends, you can just measure things with https://github.com/treeform/benchy
21:17:17nrds<R2D299> itHub: 7"Benchmarking."
21:18:36FromDiscord<treeform> my gut feeling that writing your own little parser would always be faster... that just walks the characters and populates the fields.
21:51:33arkanoidis there a shortcut for float countup for loops? like "for i in countup(0.0, 1.0, 0.2)"
21:52:42arkanoidsystem.countup likes ordinal only
21:54:41NimEventerNew post on r/nim by G_Lasso: Drawim: a simple drawing library in Nim, inspired by p5js, see https://reddit.com/r/nim/comments/pl7k4b/drawim_a_simple_drawing_library_in_nim_inspired/
21:55:28FromDiscord<Elegantbeef> Seems liike there is not arkanoid so time to make your own 😀
21:55:44arkanoidsure, it's trivial
21:55:56arkanoidbut quite surprised about the lack of it in system
21:57:50FromDiscord<Elegantbeef> Well it's relatively specialized as i dont think i've ever used that 😀
22:07:43arkanoidwell counting from 0.0 to 1.0 it quite important in many calculations. Geometry for example
22:36:24*Vladar quit (Quit: Leaving)
22:41:36FromDiscord<Varriount> arkanoid: There's no float countup because it's not accurate.
22:44:49FromDiscord<Varriount> arkanoid: For example, as I understand it, `var x = 0.0; for _ in 0..100: x += 20.0` will be different from `var x = 0.0; for _ in 0..20: x += 100.0`
22:51:50FromDiscord<RattleyCooper> In reply to @arkanoid "well counting from 0.0": Yeah, but counting up from 0.0 to 1.0 takes forever
22:52:15*audiophile_ joined #nim
22:52:45arkanoidVarriount sure, just like any other float operation
22:53:44FromDiscord<jos> is it expected that the destructor won't be called unless using the new operator? i don't understand why a ref type and new are being treated different
22:53:46FromDiscord<jos> using refcounting gc btw
22:53:50arkanoidinterpolation, lerping, and animations in general really like 0.0 to 1.0 stuff
22:54:06FromDiscord<Varriount> @RattleyCooper Reminds me of the Mathmagician's staircase to infinity in The Phantom Tollbooth
22:54:10arkanoidRattleyCooper, that's why I added a third argument
22:59:04*stkrdknmibalz joined #nim
22:59:47FromDiscord<RattleyCooper> In reply to @arkanoid "<@408056314342932491>, that's why I": Yeah I'm just making a bad joke 😛
23:04:34FromDiscord<jos> is there a way to have `type Test = ref object` have a destructor?
23:04:55FromDiscord<jos> when using one of the refcounting gcs
23:05:24FromDiscord<Elegantbeef> The destructor should work but it requires the GC to kick in afaik
23:05:52FromDiscord<jos> i can't even declare one because i get this error
23:05:53FromDiscord<jos> prog.nim(19, 1) Error: signature for '=destroy' must be proc[T: object](x: var T)
23:05:55FromDiscord<Elegantbeef> So it doesnt behave predictably
23:06:04FromDiscord<jos> type Test = ref object↵↵proc `=destroy`(test: var Test) = ↵ echo "destroy called"
23:06:23FromDiscord<jos> if there are no circular refs i would expect it to be predictable from what i read about ORC
23:06:28FromDiscord<jos> but i can't even declare it :S
23:06:54FromDiscord<jos> if i do `type Test = ref object` -> `type Test = object`, then that error goes away
23:07:03FromDiscord<jos> but then i have to manually heap allocate all my Test's with new()
23:07:13FromDiscord<jos> and i have to use `ref` whenever i pass em around
23:07:19FromDiscord<jos> i may be misunderstanding something tho
23:09:04FromDiscord<Elegantbeef> I havent used destructors so i could be wrong that they work with `ref`
23:09:36*vicfred quit (Quit: Leaving)
23:11:13FromDiscord<Elegantbeef> It does work with distincts
23:12:38arkanoidhow can I wait keyboard arrow press in terminal?
23:12:45arkanoidwithout waiting for following enter
23:16:44FromDiscord<jos> @ElegantBeef is a distinct like a unique ptr in other langs?
23:17:18FromDiscord<Elegantbeef> Nah distinct in nim is a type system unique type
23:17:42FromDiscord<Elegantbeef> `type NotInt = distinct int` `assert NotInt isnot int`
23:22:35FromDiscord<jos> i don't really understand, does this help me address the same use case as a ref somehow?
23:22:48FromDiscord<jos> from what i'm reading it's just a typedef that can't be coerced but idk
23:24:08*max22- quit (Remote host closed the connection)
23:24:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ypQ
23:24:16FromDiscord<Elegantbeef> But i dont know the proper way about this
23:24:23FromDiscord<Elegantbeef> So probably disregard me
23:26:38FromDiscord<jos> oh interesting
23:26:40FromDiscord<jos> that could work
23:26:41FromDiscord<jos> thanks
23:26:43FromDiscord<jos> (edit) "thanks" => "thanks!"
23:27:25FromDiscord<Elegantbeef> You will have to make your own properties to access the fields which kinda sucks, but like i said i dont know if there is a better way \:D
23:27:34*audiophile_ quit (Quit: Default Quit Message)
23:28:54FromDiscord<leorize> `{.borrow: `.`.}` to borrow all the fields
23:29:14*audiophile_ joined #nim
23:29:29FromDiscord<Elegantbeef> Ah yea that makes sense
23:35:09FromDiscord<jos> how do i construct the distinct type?
23:36:26FromDiscord<jos> is there a way to use the nice Type(field, field, field) syntax but still construct a type as a ref?
23:36:43FromDiscord<jos> i see new(Type) works with my distinct type
23:36:53FromDiscord<jos> but the other syntax doesn't work
23:37:18FromDiscord<leorize> you construct the original type then convert it to the distinct one
23:37:26FromDiscord<Elegantbeef> you can do `Inner(Test(a: 100))`
23:37:29FromDiscord<jos> oh nice!
23:37:31FromDiscord<jos> i like that 🙂
23:37:37FromDiscord<jos> nim is so cool
23:37:43FromDiscord<jos> i can't wait until it supports incremental compilation :^)
23:37:58FromDiscord<Elegantbeef> I'd expect most people would find what we had to do more annoying than cool P
23:38:51FromDiscord<jos> true but in a lot of other languages you're just screwed :^)