<< 29-03-2023 >>

00:03:33*onetwo385 joined #nim
00:05:01*onetwo38 quit (Ping timeout: 240 seconds)
00:05:01*onetwo385 is now known as onetwo38
00:07:08FromDiscord<sOkam!> i don't quite get which of the two options happen
00:07:35FromDiscord<sOkam!> is memory copied or just referenced (without using ref seq, just a regular seq)?
00:07:59FromDiscord<Yardanico> it's all copied, I just meant that references (any ref X stuff you have in your seq) will still point to the same memory
00:08:04FromDiscord<sOkam!> desired behavior is referencing, i don't need the copying
00:08:11FromDiscord<Yardanico> since references themselves will get copied
00:09:01FromDiscord<sOkam!> what if i made the sequences be fields of a ref object... does that change anything?
00:09:24FromDiscord<Yardanico> this is what I mean
00:09:25FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4s5Y
00:09:55FromDiscord<Elegantbeef> Sequences are values types but Nim has some optimisations 😄
00:09:56FromDiscord<Yardanico> In reply to @sOkam! "what if i made": nope, you'll still be copying sequences themselves around, it doesn't really matter if they're inside a ref object
00:10:26FromDiscord<sOkam!> i just want to avoid the copying of the data↵is there any way to avoid it in some way?
00:10:37FromDiscord<Elegantbeef> `ref seq`
00:10:58FromDiscord<Elegantbeef> Use the cursor annotation so it aliases the sequence instead of copying
00:11:37FromDiscord<sOkam!> but then that means my entire app relies on ref seq, and the idea is to avoid the extra time of loading, then moving to a new obj, but still use normal seq
00:12:20FromDiscord<sOkam!> what is cursor notation?
00:13:06FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation
00:13:16FromDiscord<Elegantbeef> I think it works with seqs i cannot recall
00:13:46FromDiscord<Elegantbeef> What extra time of loading anywho?
00:15:15FromDiscord<sOkam!> thousands of vec3+color+uvec3 for models
00:16:03FromDiscord<Elegantbeef> I do not follow
00:16:12FromDiscord<Elegantbeef> How does a `ref seq` cause any more extra time
00:19:34FromDiscord<Elegantbeef> With orc/arc you can sink a sequence if you're so worried about copying
00:21:22FromDiscord<sOkam!> ref seq does not take any extra time, it just forces me to work with ref seq instead of normal seq
00:22:05FromDiscord<sOkam!> In reply to @Elegantbeef "With orc/arc you can": never used sink. do you have any minimal example on how to do so?
00:22:24FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html#sink-parameters
00:24:08FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4s61
00:24:23*fallback_ quit (Read error: Connection reset by peer)
00:24:38FromDiscord<Elegantbeef> You have a sequence of value types to move it to another you have to copy
00:25:16FromDiscord<Elegantbeef> Sink allows you to not copy the sequence but to give ownership to another object
00:25:20FromDiscord<sOkam!> beef, its me sokam. i fucking suck at details, remember? it might be in front of my face and obvious, but i don't get it
00:26:52FromDiscord<sOkam!> i have an `oneObject.firstseq`, and i want all its contents, as they are literally, to `otherObject.destSeq`, without copying them one by one
00:27:12FromDiscord<sOkam!> the contents themselves are the same, in the same shape and seq format and order. all the same
00:27:23FromDiscord<sOkam!> just stored in a different object
00:27:40FromDiscord<Yardanico> yes, just use ref seq then
00:28:01FromDiscord<Yardanico> if you have firstseq and destSeq as `ref seq[whatevertype]`, you'll only store one instance of that seq in memory
00:28:16FromDiscord<Yardanico> so you could literally do otherObjec.destSeq = oneObject.firstSeq and they will share the same memory
00:28:58FromDiscord<sOkam!> the question was if there is a way around ref, since the first object is just gonna be deleted after the loading function ends
00:29:32FromDiscord<Yardanico> yes, but how does that matter
00:29:34FromDiscord<sOkam!> and the rest of the code will need to use ref seq just because of it, which i would prefer to avoid if there is some way to just move the memory in some way without copying it
00:29:40FromDiscord<Yardanico> ah you mean that way
00:30:22FromDiscord<Elegantbeef> `myOtherObject.destSeq = myObject.mySeq`
00:30:24FromDiscord<Elegantbeef> There you go
00:30:34FromDiscord<Elegantbeef> If that's the last usage of `myObject` it'll move it
00:30:42FromDiscord<Elegantbeef> Otherwise you do `myOtherObject.destSeq = move(...)`
00:36:14FromDiscord<sOkam!> kk ty ✍️
00:38:45*jmdaemon quit (Ping timeout: 255 seconds)
00:49:38*fallback_ joined #nim
01:10:54*nanxiao joined #nim
01:44:15*derpydoo quit (Quit: derpydoo)
01:46:30*derpydoo joined #nim
01:51:41*jmdaemon joined #nim
02:10:16*nanxiao quit (Quit: Client closed)
02:15:55*nanxiao joined #nim
02:32:25*fallback_ quit (Quit: IRCNow and Forever!)
02:42:20*nanxiao quit (Quit: Client closed)
02:42:49*xet7 joined #nim
02:46:09*nanxiao joined #nim
03:51:31NimEventerNew Nimble package! happyx - Asynchronous web-framework written with ♥, see https://github.com/HapticX/happyx
04:01:57*xet7 quit (Quit: Leaving)
04:05:34*fallback_ joined #nim
04:19:53*arkurious quit (Quit: Leaving)
04:22:41*nanxiao quit (Quit: Client closed)
04:25:33*derpydoo quit (Read error: Connection reset by peer)
04:34:56*fallback_ quit (Read error: Connection reset by peer)
04:45:27*xet7 joined #nim
04:46:57FromDiscord<Hourglass [She/Her]> I wonder how hard would it be to get BrainFuck to be able to draw to the screen
04:47:27FromDiscord<Hourglass [She/Her]> Probably not that hard, but getting something readable is probably the more difficult part
04:47:46FromDiscord<Hourglass [She/Her]> After I finally get BrainFuckVM finished I'll see how hard it is :)
04:53:07*nanxiao joined #nim
05:45:39*nanxiao quit (Quit: Client closed)
06:01:32*advesperacit joined #nim
06:03:26*derpydoo joined #nim
06:05:46FromDiscord<Hourglass [She/Her]> I have no idea why this isn't working anymore
06:05:53FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4s6O
06:06:03FromDiscord<Hourglass [She/Her]> For some unknown reason, reading from a stream doesn't work anymore?
06:06:52FromDiscord<Hourglass [She/Her]> The path exists, and Nim can read it if I use `echo readFile(filename)`
06:07:04FromDiscord<Hourglass [She/Her]> But the streams module seems broken on Termux for some weird reason?
06:07:56*nanxiao joined #nim
06:08:59FromDiscord<Hourglass [She/Her]> So `inim` can read it just fine apparently
06:09:05FromDiscord<Hourglass [She/Her]> This is Nim 1.6.12 btw
06:15:03FromDiscord<Hourglass [She/Her]> Could it be a special character breaking the stream or something? Seems unlikely since the file is read just fine elsewhere
06:15:09FromDiscord<Hourglass [She/Her]> But that's the only file it happens to
06:15:19FromDiscord<Hourglass [She/Her]> Which is so weird
06:17:24FromDiscord<Hourglass [She/Her]> Issue was my shitty code, yet again
06:21:32*PMunch joined #nim
06:26:24FromDiscord<Hourglass [She/Her]> Now I can't figure out where the index defect is
06:26:31FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4s6R
06:27:21FromDiscord<Hourglass [She/Her]> https://hastebin.com/share/qutibuxazu.csharp
06:33:20*azimut quit (Ping timeout: 255 seconds)
06:39:09*jjido joined #nim
06:43:32*jjido quit (Client Quit)
06:58:55FromDiscord<morgan> In reply to @Elegantbeef "https://nim-lang.org/docs/destructors.html#the-dotc": so im working on a graph datastructure for something, and cursor pragma looks like it would be cool for compiling with arc, but im not sure where i should put it, and the bit about it being a raw pointer has me wondering if it'll be a footgun i should wait to add
06:59:03PMunchWild guess is that ub2Val can be 30_000 and you forgot that Nim ranges are inclusive
06:59:55PMunchAh nvm, same issue but it's currentCell which grows too large
07:00:05FromDiscord<Elegantbeef> Well cursor is there for when you need a unowned reference
07:01:38FromDiscord<morgan> guessing that it being unowned and it being a managed reference are somewhat mutually exclusive
07:02:09FromDiscord<morgan> also gotta figure out plotting the graph before i work too much on procs to modify it
07:02:14FromDiscord<Elegantbeef> It doesnt tick the ref counter and can dangle if you do not do it properly
07:04:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4s6W
07:10:59FromDiscord<Hourglass [She/Her]> In reply to @PMunch "Ah nvm, same issue": It's more of an issue that the brainfuck code seems to be missing or adding steps that shouldn't be there
07:11:37FromDiscord<Hourglass [She/Her]> But also either way, it's very weird that currentCell grows to 30000
07:12:02FromDiscord<Hourglass [She/Her]> I don't think it's my compiler logic but I don't know what else it could be
07:13:30FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4s6X
07:14:14FromDiscord<Hourglass [She/Her]> Any working Brainfuck runtime can run the code but my compiler seems to crash
07:23:17*rockcavera quit (Remote host closed the connection)
07:27:58*fallback_ joined #nim
07:41:40FromDiscord<Hourglass [She/Her]> Figured out one issue
08:08:09PMunchWithout the common file it's kinda hard to debug as I can't run it
08:09:38*nanxiao quit (Quit: Client closed)
08:13:10*nanxiao joined #nim
08:21:20*Notxor joined #nim
08:27:14*fallback_ quit (Quit: IRCNow and Forever!)
08:29:25*fredrikhr joined #nim
08:43:49FromDiscord<Hourglass [She/Her]> Ah yeah sorry
08:44:30FromDiscord<Hourglass [She/Her]> https://github.com/Yu-Vitaqua-fer-Chronos/NimBrainFuck it's the `bfvm` folder you want to look at :p
09:07:23*nanxiao quit (Quit: Client closed)
09:08:49*nanxiao joined #nim
09:11:23*nanxiao quit (Client Quit)
09:15:40*nanxiao joined #nim
09:37:00*fallback_ joined #nim
09:47:21FromDiscord<kcvinker> How to determine my code is running under Windows 10 or Windows 11 ?
09:51:08PMunchCheck if the start menu is full of adds?
09:51:17PMunchOh wait, that's a feature of both isn't it?
09:53:22PMunchOn a more serious note I think you could try the osinfo package
10:00:37*nanxiao quit (Quit: Client closed)
10:06:21*fallback_ quit (Read error: Connection reset by peer)
10:22:45*PMunch_ joined #nim
10:22:56*PMunch quit (Killed (NickServ (GHOST command used by PMunch_)))
10:22:58*PMunch_ is now known as PMunch
10:41:07*Notxor quit (Remote host closed the connection)
10:45:29*azimut joined #nim
10:58:43Amun-Racheck build number
10:59:42Amun-Rabut… Win11 pre 2H2 and post have different build numbers
11:00:13Amun-Ra22H2
11:06:23FromDiscord<kcvinker> Thank you @Amun-Ra & @PMunch
11:38:09FromDiscord<ricky> the perfect lang doesn't exi- :nimGlow2:
11:38:16FromDiscord<ricky> (edit) ":nimGlow2:" => ":nim2:"
11:43:32*fredrikhr92 joined #nim
11:44:26PMunchfredrikhr92, well well well, so you're still allowed IRC on your machine? :P
11:47:40*fredrikhr quit (Ping timeout: 276 seconds)
11:51:38fredrikhr92PMunch, yeah... NSM hasn't said anything about that (yet) :P
11:54:02PMunchAt least IRC doesn't have any pretense of security
11:54:09PMunchOr confidentiality rather
11:58:05FromDiscord<firasuke> Do we have a working library for xxhash `XXH3_128bits`?
13:27:14*PMunch_ joined #nim
13:29:42*PMunch quit (Ping timeout: 250 seconds)
13:30:12*beholders_eye joined #nim
13:36:43*xet7 quit (Ping timeout: 248 seconds)
13:49:24*xet7 joined #nim
13:54:08*jmdaemon quit (Ping timeout: 248 seconds)
13:59:20*derpydoo quit (Quit: derpydoo)
14:12:09*PMunch_ quit (Quit: Leaving)
14:29:26*rockcavera joined #nim
14:38:35*beholders_eye quit (Ping timeout: 248 seconds)
14:49:41FromDiscord<Andreas> recently on vs-code i typed `cast{}` clearly the wrong brackets here, but then hell-broke-lose.. -> nimlsp crashing/restarting again and again and again ? Is there some button/setting to suppresses the full-screen-crash-log(s) that come flying right into the face ?-) I got used to one crash-log when vs-code starts, but with `cast{}` it seems to go into a infinite loop 8=)
14:50:12FromDiscord<Andreas> (edit) "the" => "my"
14:52:02*fallback_ joined #nim
14:52:19FromDiscord<ringabout> In reply to @Andreas "recently on vs-code i": 1.6.12 ?
14:53:10FromDiscord<ringabout> See also => https://github.com/PMunch/nimlsp/issues/154
14:57:10FromDiscord<Andreas> In reply to @ringabout "1.6.12 ?": nope that was devel 1.9.1
14:57:31FromDiscord<ringabout> `nim -v`?
14:58:04FromDiscord<Andreas> `Nim Compiler Version 1.9.1 [MacOSX: amd64]↵Compiled at 2023-03-14``
14:58:27FromDiscord<Andreas> (edit) "`Nim" => "`↵Nim" | "2023-03-14``" => "2023-03-14↵`"
14:58:42FromDiscord<ringabout> You might try the latest devel as well.
14:59:08*Notxor joined #nim
14:59:30FromDiscord<ringabout> Because the regression is introduced to the devel branch as well, see also the fix => https://github.com/nim-lang/Nim/pull/21555
15:00:22FromDiscord<Gumbercules> In reply to @firasuke "Do we have a": Why not just PR this? https://github.com/OpenSystemsLab/xxhash.nim/blob/master/src/xxhash.nim
15:01:20FromDiscord<Andreas> In reply to @ringabout "Because the regression is": thx, i did `choosenim upgrade devel` and now i should be good ?
15:01:32FromDiscord<ringabout> Perhaps
15:01:40FromDiscord<Andreas> (edit) "In reply to @ringabout "Because the regression is": thx, i did `choosenim upgrade devel` and now i should be good ? ... " added "`cast{}`works now"
15:02:00FromDiscord<Gumbercules> Or just port it even - it's not that much code
15:02:09FromDiscord<ringabout> In reply to @firasuke "Do we have a": See also https://github.com/khchen/hashlib/blob/master/hashlib/misc/xxhash.nim
15:02:14FromDiscord<Gumbercules> and then you'd have a pure Nim implementation of xxhash
15:02:35FromDiscord<Gumbercules> In reply to @ringabout "See also https://github.com/khchen/hashlib/blob/mas": nice find
15:09:21FromDiscord<firasuke> In reply to @ringabout "See also https://github.com/khchen/hashlib/blob/mas": I was using this, but it is generating wrong checksums for files with uneven chunks like tarballs
15:21:48ormiretfirasuke: how are you deciding checksums are wrong? If you can share your code, data and expected results folks might be able to help...
15:22:07*jmdaemon joined #nim
15:22:52FromDiscord<spoon> sent a code paste, see https://play.nim-lang.org/#ix=4s9H
15:28:08FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4s9K
15:28:15FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=4s9K" => "https://play.nim-lang.org/#ix=4s9L"
15:29:07FromDiscord<spoon> ah, declaration stuff
15:29:10FromDiscord<spoon> thanks
15:34:43FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4s9N
15:41:29*Notxor quit (Remote host closed the connection)
15:43:56*fallback_ quit (Read error: Connection reset by peer)
15:48:20FromDiscord<Yardanico> In reply to @spoon "ah, declaration stuff": it's because {} is just syntax sugar for openArray of tuples
15:48:26FromDiscord<Yardanico> to actually make it a hash table you need to use toTable as Andreas showed
15:48:51FromDiscord<Yardanico> which means that you're not limited to using {} just for tables, you can use this sugar everywhere where you need key: value pairs
15:48:58FromDiscord<Yardanico> <https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor>
16:00:11*Notxor joined #nim
16:07:54*anddam quit (Quit: WeeChat 3.8)
16:12:55*derpydoo joined #nim
16:15:57*arkurious joined #nim
16:31:41FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4saa
16:35:13FromDiscord<michaelb.eth> given `@["FOO", "BAR", ...]` where the strings are names of constant arrays of different types, I'm trying to write a macro/template that converts each string to identifier and then loops over the array
16:35:58FromDiscord<michaelb.eth> at this point I'm doing some head scratching, and realizing I don't understand macros very well
16:36:17FromDiscord<michaelb.eth> (edit) "given `@["FOO", "BAR", ...]` where the strings are names of constant arrays of different types, I'm trying to write a macro/template that converts each string to identifier and then loops over the ... array" added "identified"
16:41:38FromDiscord<Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4sab
16:41:51FromDiscord<Nerve> Even a FileStream would be cleaner
16:41:57FromDiscord<Nerve> (edit) "FileStream" => "`FileStream`"
16:42:45FromDiscord<Nerve> With Nim, a good rule of thumb: When in doubt, don't do it like C would, do it like Python would. It's probably idiomatic and it will compile to be as fast or faster.
16:44:45NimEventerNew thread by sls1005: Is the escape sequence case-insensitive?, see https://forum.nim-lang.org/t/10044
16:45:11FromDiscord<Andreas> In reply to @Nerve "Using `read_file` you can": i know nims `system.readFile` cuts it, but this is a C-API and i should workk somehow - well i can just trash it..
16:45:26FromDiscord<Andreas> (edit) "workk" => "work"
16:46:35FromDiscord<Nerve> If it's a C interface, I'd 1) Return a `cstring`, not a `ptr uint8`, 2) wrap it in a Nim proc that encapsulates that mess by taking a filename as `string` and returning the file contents as `string` by just calling `$` on the returned `cstring`.
16:46:46FromDiscord<Nerve> (edit) "I'd 1)" => "I'd↵1)" | "uint8`, 2)" => "uint8`,↵2)"
16:47:11FromDiscord<Nerve> Does the function itself point to a `char`?
16:47:27FromDiscord<Nerve> I think you can turn that into a `cstring` but I'm not sure
16:48:23FromDiscord<Nerve> But `cstring` will take a pointer and automatically look for a `\0` terminator
16:52:34FromDiscord<Andreas> In reply to @Nerve "But `cstring` will take": thx, `uint8_t js_load_file(` this is what it returns and you're right - why care, since i'll have a nim-dependency i can simply replace that c-wierdness..
16:53:31*jmdaemon quit (Ping timeout: 248 seconds)
17:04:32FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4sai
17:04:55FromDiscord<michaelb.eth> In reply to @Andreas "i'd try `myElem =": thanks, I figured it out
17:05:28FromDiscord<Andreas> In reply to @michaelb.eth "thanks, I figured it": ok, how did you do it ?
17:08:20FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4saj
17:12:58FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4san
17:14:13FromDiscord<michaelb.eth> not sure what you mean by "though ..."
17:14:19*xet7 quit (Ping timeout: 248 seconds)
17:15:47FromDiscord<Andreas> In reply to @michaelb.eth "not sure what you": from your first description i thought you'd have `foo @[BAR, BAZ]` not `foo @["BAR", "BAZ"]`
17:16:18FromDiscord<Andreas> (edit) ""BAZ"]`" => ""BAZ"]`, anyway it works"
17:16:36FromDiscord<michaelb.eth> I have the latter, maybe I wasn't clear
17:17:13*beholders_eye joined #nim
17:26:09*jmdaemon joined #nim
17:26:20FromDiscord<Andreas> In reply to @michaelb.eth "I have the latter,": 😉 be carefull with macros - they lead to adiction..
17:26:29FromDiscord<Andreas> (edit) "adiction.." => "addiction.."
17:26:34FromDiscord<michaelb.eth> In reply to @Andreas "😉 be carefull with": indeed!
17:27:08*xet7 joined #nim
17:27:09FromDiscord<michaelb.eth> I try to use them sparingly, fwiw
17:30:49FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4sar
17:31:22FromDiscord<firasuke> In reply to @ormiret "<@248208053952970752>: how are you": I am using this as reference: https://github.com/khchen/hashlib/blob/master/hashlib/lean.nim#L46
17:31:40*Notxor quit (Remote host closed the connection)
17:33:54*jjido joined #nim
17:57:41*fallback_ joined #nim
17:59:40FromDiscord<firasuke> In reply to @firasuke "ok, here's what I": file is a `.tar.gz` tarball, I already have its checksum using `xxh128sum` cli app
18:13:08FromDiscord<firasuke> any ideas?
18:26:17*Notxor joined #nim
18:27:38*fallback_ quit (Read error: Connection reset by peer)
18:35:41*zgasma quit (Quit: leaving)
18:38:17FromDiscord<Elegantbeef> `macro doThing(s: static openArray[string], ...)`↵(@michaelb.eth)
18:47:57*xaltsc joined #nim
18:56:53*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
19:05:37*fallback_ joined #nim
19:10:30FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4saR
19:10:38FromDiscord<System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#ix=4saR" => "https://play.nim-lang.org/#ix=4saS"
19:15:20FromDiscord<turbo> If I'm trying to use a JS library which has an API along the lines of `foobar(name, func)`, where `name` is a string, but `func` is a function with any number of parameters (of any type), how can I declare a `{.importc.}` for it in Nim?
19:16:26*zgasma joined #nim
19:24:57FromDiscord<Andreas> In reply to @turbo "If I'm trying to": in QuickJS the typical function-signature is like so :↵`proc( this_obj: JSValue, argc: int, argv: seq[JSValue] )`, with the scope first, the count of arguments second and finally a list of Values. It's a bit simplified, but you get the idea - since JS has no types, everything is a JSValue(::Array|::Object|::Number etc. ). These values are in argv, which is a pointer to the list.. maybe that helps
19:26:27FromDiscord<Andreas> (edit) "In reply to @turbo "If I'm trying to": in QuickJS the typical function-signature is like so :↵`proc( this_obj: JSValue, argc: int, argv: seq[JSValue] )`, with the scope first, the count of arguments second and finally" => "sent" | "list of Values. It's a bit simplified, but you get the idea - since JS has no types, everything is a JSValue(::Array|::Object|::Number etc. ). These values are in argv, which is a pointer to the li
19:26:42FromDiscord<turbo> Not sure I follow. In my scenario I'm interfacing with a web JS library from code compiled from Nim to JS (running in the browser).
19:27:27FromDiscord<Yardanico> In reply to @turbo "Not sure I follow.": just check the examples in jsffi or dom
19:27:41FromDiscord<Yardanico> Andreas is talking about a different thing specific to binding with quickjs, not about the Nim JS backend
19:28:07FromDiscord<turbo> In reply to @Yardanico "just check the examples": I looked at dom, but those are either void or have a well-defined type. Will look at jsffi
19:28:16FromDiscord<Andreas> In reply to @turbo "Not sure I follow.": ohh, ic, thats a different thing, maybe you can use `varargs`but i have no idea about the JS-backend and howto deal with dynamic signatures..
19:33:39FromDiscord<turbo> Looks like `toJs` for the proc and `JsObject` for the arg is what I'm looking for
19:56:06*fallback_ quit (Read error: Connection reset by peer)
20:25:55FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=4sbd
20:28:06*ltriant quit (Ping timeout: 255 seconds)
20:39:31FromDiscord<Hourglass [She/Her]> Hey so if I want to implement things like functions and modules in my Brainfuck runtime, how would i go about structuring it?
20:45:07ormiretfirasuke: this agrees with xxh128sum for the few files I tried it on: https://play.nim-lang.org/#ix=4sbj
20:47:02FromDiscord<firasuke> sent a long message, see http://ix.io/4sbk
20:49:07*gshumway quit (Quit: .)
20:49:38FromDiscord<firasuke> In reply to @ormiret "<@248208053952970752>: this agrees with": May I ask what does the `$` do? also what is the difference between the two procs, and what does the size const do?
20:50:06FromDiscord<firasuke> I read std/hashes but it mentions `!&` and `!$` but not `$` alone.
20:50:52FromDiscord<morgan> the amount of times i get confused over some error message before realizing i didn't put var before the Type on the proc inputs
20:53:10NimEventerNew post on r/nim by shuten_mind: How to generate all possible combinations of characters in a string using Nim?", see https://reddit.com/r/nim/comments/1260d1p/how_to_generate_all_possible_combinations_of/
20:54:21*gshumway_ joined #nim
20:54:32ormiret$ is standard nim operator to turn something into a string, `hashFile` is the simple read whole file into memory and then calculate has of it approach, `hashFileChunk` reads in chunks of `size` bytes and updates the partial has with each in turn
20:55:23FromDiscord<Elegantbeef> Damn chatgpt in the realtime chat
20:56:01FromDiscord<firasuke> In reply to @ormiret "$ is standard nim": I see, I am still getting the wrong hash
20:56:06FromDiscord<firasuke> I tried it on some files it worked
20:56:15FromDiscord<firasuke> but on tarballs it is failing
20:57:00FromDiscord<firasuke> for example, `make-4.4.tar.gz` (https://ftpmirror.gnu.org/make/make-4.4.tar.gz):↵- hashfile returns: `faae50855f65ad63b1c4c71c19166a3c`↵- `xxh128sum` returns: `15bf27bd70e74eb8c4f71a1028513adf`
20:57:07FromDiscord<firasuke> (edit) "for example, `make-4.4.tar.gz` (https://ftpmirror.gnu.org/make/make-4.4.tar.gz):↵- ... hashfile" added "proc"
21:00:39FromDiscord<Andreas> In reply to @firasuke "for example, `make-4.4.tar.gz` (https://ftpmirror.g": have you tested if the hashes for the null-msg are the same ?
21:00:53FromDiscord<firasuke> In reply to @Andreas "have you tested if": nope, lemme check
21:01:08FromDiscord<Andreas> just give him ""
21:01:51FromDiscord<firasuke> yes it is identical
21:02:02FromDiscord<firasuke> even regular uncompressed files are hashing just fine
21:02:06FromDiscord<firasuke> but compressed tarballs are not
21:02:50FromDiscord<Andreas> In reply to @firasuke "but compressed tarballs are": hmm, strange, how is the blob processed - taken into the function..
21:02:57ormiretI get the same hash ending a3c from both procs and xxh128sum for that make tar.gz...
21:03:27FromDiscord<firasuke> In reply to @ormiret "I get the same": exactly, both hashes are wrong, check with `xxh128sum`
21:03:42*fallback_ joined #nim
21:03:48FromDiscord<firasuke> it should end with `adf` (`15bf27bd70e74eb8c4f71a1028513adf`)
21:03:55ormiretI did, I get the same result from xxh128sum
21:04:23FromDiscord<firasuke> In reply to @ormiret "I did, I get": wait xxh128sum outputted `faae50855f65ad63b1c4c71c19166a3c`?
21:04:30ormiretyes
21:04:39FromDiscord<firasuke> lol, why is not doing that on my machine
21:06:19FromDiscord<Andreas> In reply to @firasuke "lol, why is not": check your test-material size, date etc.
21:06:46FromDiscord<firasuke> https://media.discordapp.net/attachments/371759389889003532/1090743878434439248/image.png
21:07:23FromDiscord<firasuke> just downloaded the archive again
21:09:08FromDiscord<Andreas> In reply to @firasuke "just downloaded the archive": and for this file the makers of thew algo provide a reference-hash ?
21:09:18FromDiscord<Andreas> (edit) "thew" => "the"
21:09:47FromDiscord<firasuke> In reply to @Andreas "and for this file": I don't think they provide a reference xxh128sum
21:10:16FromDiscord<morgan> ok so if i have a type that is not a ref object, and another type that stores the first one as a ref, how do i create a ref version of the first one to store when i create the second one>
21:10:17FromDiscord<morgan> (edit) "one>" => "one?"
21:11:06FromDiscord<firasuke> In reply to @firasuke "I don't think they": it's not just this file, I have around 100 tarballs, and all are getting wrong checksums
21:12:17FromDiscord<Andreas> In reply to @firasuke "it's not just this": and where does the 'correct' hashvalue come from ? So that you can know if its correct ?
21:12:40FromDiscord<firasuke> In reply to @Andreas "and where does the": `xxh128sum` and rust's version of `xxhash`
21:13:32FromDiscord<Andreas> In reply to @firasuke "`xxh128sum` and rust's version": ic, and you see the difference only on tar-files ?
21:13:48FromDiscord<firasuke> In reply to @Andreas "ic, and you see": precisely
21:14:34FromDiscord<Andreas> is there a paper on that hashing-method ? i'd expect to find real reference values form the authors of the algo ?
21:14:54FromDiscord<firasuke> https://cyan4973.github.io/xxHash/
21:15:09FromDiscord<Andreas> (edit) "?" => "?↵which means, even rust-people might get things wrong 🙂"
21:16:23FromDiscord<morgan> In reply to @MorganAlyssa "ok so if i": nvm i just changed them to be ref types
21:16:57FromDiscord<Elegantbeef> Do not use `ref T` as a shortcut! 😄
21:17:36FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement is a better way to save on typing without making heap allocations and adding in ref semantics
21:19:51FromDiscord<firasuke> ok `xxh64sum` worked
21:21:26FromDiscord<Andreas> In reply to @firasuke "ok `xxh64sum` worked": there is no formal specification - i'd stay away from that ...
21:21:38FromDiscord<firasuke> In reply to @Andreas "there is no formal": oh ok
21:22:15FromDiscord<Andreas> (edit) "..." => "...↵I mean, come on - a cryptographic-hash-function without a specification - bye bye"
21:23:43*Notxor quit (Remote host closed the connection)
21:28:43FromDiscord<Andreas> In reply to @firasuke "oh ok": would you feel good about, say using such a hash to produce a digital signature for e.g. your next house purchase ?
21:29:09FromDiscord<Andreas> (edit) "In reply to @firasuke "oh ok": would you feel good about, say using such a hash to produce a digital signature for e.g. your next house purchase ? ... " added "or any other form of digital contract ?"
21:29:34FromDiscord<firasuke> Not really
21:29:47FromDiscord<firasuke> It is barely for verifying the integrity of downloaded files
21:29:52FromDiscord<firasuke> I need to be as fast as possible
21:30:40FromDiscord<Andreas> In reply to @firasuke "Not really": same with me - thats prbly. the reason my nobody would seriously consider such a algo for anything cryptographic - and speed does not matter here, its about correctness
21:31:25FromDiscord<firasuke> So sha1sum?
21:32:10FromDiscord<System64 ~ Flandre Scarlet> In reply to @treeform "Sorry I don't support": Seems it works↵And does it work with entire arrays too?
21:32:21FromDiscord<Andreas> In reply to @firasuke "So sha1sum?": i'd go for any algo that is used in the real world - that has seen lots of review and is accepted in the crypto-community
21:32:40*fallback_ quit (Read error: Connection reset by peer)
21:32:59*adium_ quit (Read error: Connection reset by peer)
21:32:59FromDiscord<firasuke> One of the blakes then
21:34:09FromDiscord<firasuke> And maybe choose a 256 width
21:34:18FromDiscord<Andreas> In reply to @firasuke "One of the blakes": yepp, anything that has blessing of the crypto-scene and is therefore recommended
21:34:34FromDiscord<firasuke> Ok, thanks for your insight
21:34:38FromDiscord<firasuke> Much appreciated
21:36:14FromDiscord<Andreas> In reply to @firasuke "Much appreciated": in germany theres a goverment-agency that publishes recommendations for algorithms to use ... same in the us
21:36:31FromDiscord<firasuke> Care to link to it?
21:37:55FromDiscord<Andreas> in germany its the BSI https://www.bsi.bund.de/DE/Themen/Oeffentliche-Verwaltung/Moderner-Staat/ElektronischeSignatur/TechnischeRealisierung/Kryptoalgorithmen/kryptoalgorithmen_node.html
21:38:12FromDiscord<firasuke> Thanks
21:38:29FromDiscord<Andreas> they have a english page too
21:38:43FromDiscord<Andreas> (edit) "they have a english page too ... " added "https://www.bsi.bund.de/EN/Themen/Oeffentliche-Verwaltung/Moderner-Staat/ElektronischeSignatur/TechnischeRealisierung/Kryptoalgorithmen/kryptoalgorithmen_node.html"
21:41:47*adium joined #nim
21:46:47*derpydoo quit (Ping timeout: 265 seconds)
21:50:38*jjido joined #nim
21:55:06*advesperacit quit ()
22:08:20*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
22:11:06FromDiscord<firasuke> oh saved me there
22:11:14FromDiscord<firasuke> do we have a blake3 library for nim?
22:27:38ormiretlooks to be in hashlib https://github.com/khchen/hashlib/blob/master/hashlib/misc.nim#L39
22:28:20FromDiscord<firasuke> hashlib has it all lol
22:28:23FromDiscord<firasuke> thanks a lot
22:55:31*ltriant joined #nim
22:55:56*derpydoo joined #nim