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:08 | FromDiscord | <sOkam!> i don't quite get which of the two options happen |
00:07:35 | FromDiscord | <sOkam!> is memory copied or just referenced (without using ref seq, just a regular seq)? |
00:07:59 | FromDiscord | <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:04 | FromDiscord | <sOkam!> desired behavior is referencing, i don't need the copying |
00:08:11 | FromDiscord | <Yardanico> since references themselves will get copied |
00:09:01 | FromDiscord | <sOkam!> what if i made the sequences be fields of a ref object... does that change anything? |
00:09:24 | FromDiscord | <Yardanico> this is what I mean |
00:09:25 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4s5Y |
00:09:55 | FromDiscord | <Elegantbeef> Sequences are values types but Nim has some optimisations 😄 |
00:09:56 | FromDiscord | <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:26 | FromDiscord | <sOkam!> i just want to avoid the copying of the data↵is there any way to avoid it in some way? |
00:10:37 | FromDiscord | <Elegantbeef> `ref seq` |
00:10:58 | FromDiscord | <Elegantbeef> Use the cursor annotation so it aliases the sequence instead of copying |
00:11:37 | FromDiscord | <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:20 | FromDiscord | <sOkam!> what is cursor notation? |
00:13:06 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation |
00:13:16 | FromDiscord | <Elegantbeef> I think it works with seqs i cannot recall |
00:13:46 | FromDiscord | <Elegantbeef> What extra time of loading anywho? |
00:15:15 | FromDiscord | <sOkam!> thousands of vec3+color+uvec3 for models |
00:16:03 | FromDiscord | <Elegantbeef> I do not follow |
00:16:12 | FromDiscord | <Elegantbeef> How does a `ref seq` cause any more extra time |
00:19:34 | FromDiscord | <Elegantbeef> With orc/arc you can sink a sequence if you're so worried about copying |
00:21:22 | FromDiscord | <sOkam!> ref seq does not take any extra time, it just forces me to work with ref seq instead of normal seq |
00:22:05 | FromDiscord | <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:24 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/destructors.html#sink-parameters |
00:24:08 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> You have a sequence of value types to move it to another you have to copy |
00:25:16 | FromDiscord | <Elegantbeef> Sink allows you to not copy the sequence but to give ownership to another object |
00:25:20 | FromDiscord | <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:52 | FromDiscord | <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:12 | FromDiscord | <sOkam!> the contents themselves are the same, in the same shape and seq format and order. all the same |
00:27:23 | FromDiscord | <sOkam!> just stored in a different object |
00:27:40 | FromDiscord | <Yardanico> yes, just use ref seq then |
00:28:01 | FromDiscord | <Yardanico> if you have firstseq and destSeq as `ref seq[whatevertype]`, you'll only store one instance of that seq in memory |
00:28:16 | FromDiscord | <Yardanico> so you could literally do otherObjec.destSeq = oneObject.firstSeq and they will share the same memory |
00:28:58 | FromDiscord | <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:32 | FromDiscord | <Yardanico> yes, but how does that matter |
00:29:34 | FromDiscord | <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:40 | FromDiscord | <Yardanico> ah you mean that way |
00:30:22 | FromDiscord | <Elegantbeef> `myOtherObject.destSeq = myObject.mySeq` |
00:30:24 | FromDiscord | <Elegantbeef> There you go |
00:30:34 | FromDiscord | <Elegantbeef> If that's the last usage of `myObject` it'll move it |
00:30:42 | FromDiscord | <Elegantbeef> Otherwise you do `myOtherObject.destSeq = move(...)` |
00:36:14 | FromDiscord | <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:31 | NimEventer | New 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:57 | FromDiscord | <Hourglass [She/Her]> I wonder how hard would it be to get BrainFuck to be able to draw to the screen |
04:47:27 | FromDiscord | <Hourglass [She/Her]> Probably not that hard, but getting something readable is probably the more difficult part |
04:47:46 | FromDiscord | <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:46 | FromDiscord | <Hourglass [She/Her]> I have no idea why this isn't working anymore |
06:05:53 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4s6O |
06:06:03 | FromDiscord | <Hourglass [She/Her]> For some unknown reason, reading from a stream doesn't work anymore? |
06:06:52 | FromDiscord | <Hourglass [She/Her]> The path exists, and Nim can read it if I use `echo readFile(filename)` |
06:07:04 | FromDiscord | <Hourglass [She/Her]> But the streams module seems broken on Termux for some weird reason? |
06:07:56 | * | nanxiao joined #nim |
06:08:59 | FromDiscord | <Hourglass [She/Her]> So `inim` can read it just fine apparently |
06:09:05 | FromDiscord | <Hourglass [She/Her]> This is Nim 1.6.12 btw |
06:15:03 | FromDiscord | <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:09 | FromDiscord | <Hourglass [She/Her]> But that's the only file it happens to |
06:15:19 | FromDiscord | <Hourglass [She/Her]> Which is so weird |
06:17:24 | FromDiscord | <Hourglass [She/Her]> Issue was my shitty code, yet again |
06:21:32 | * | PMunch joined #nim |
06:26:24 | FromDiscord | <Hourglass [She/Her]> Now I can't figure out where the index defect is |
06:26:31 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4s6R |
06:27:21 | FromDiscord | <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:55 | FromDiscord | <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:03 | PMunch | Wild guess is that ub2Val can be 30_000 and you forgot that Nim ranges are inclusive |
06:59:55 | PMunch | Ah nvm, same issue but it's currentCell which grows too large |
07:00:05 | FromDiscord | <Elegantbeef> Well cursor is there for when you need a unowned reference |
07:01:38 | FromDiscord | <morgan> guessing that it being unowned and it being a managed reference are somewhat mutually exclusive |
07:02:09 | FromDiscord | <morgan> also gotta figure out plotting the graph before i work too much on procs to modify it |
07:02:14 | FromDiscord | <Elegantbeef> It doesnt tick the ref counter and can dangle if you do not do it properly |
07:04:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4s6W |
07:10:59 | FromDiscord | <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:37 | FromDiscord | <Hourglass [She/Her]> But also either way, it's very weird that currentCell grows to 30000 |
07:12:02 | FromDiscord | <Hourglass [She/Her]> I don't think it's my compiler logic but I don't know what else it could be |
07:13:30 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4s6X |
07:14:14 | FromDiscord | <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:40 | FromDiscord | <Hourglass [She/Her]> Figured out one issue |
08:08:09 | PMunch | Without 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:49 | FromDiscord | <Hourglass [She/Her]> Ah yeah sorry |
08:44:30 | FromDiscord | <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:21 | FromDiscord | <kcvinker> How to determine my code is running under Windows 10 or Windows 11 ? |
09:51:08 | PMunch | Check if the start menu is full of adds? |
09:51:17 | PMunch | Oh wait, that's a feature of both isn't it? |
09:53:22 | PMunch | On 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:43 | Amun-Ra | check build number |
10:59:42 | Amun-Ra | but… Win11 pre 2H2 and post have different build numbers |
11:00:13 | Amun-Ra | 22H2 |
11:06:23 | FromDiscord | <kcvinker> Thank you @Amun-Ra & @PMunch |
11:38:09 | FromDiscord | <ricky> the perfect lang doesn't exi- :nimGlow2: |
11:38:16 | FromDiscord | <ricky> (edit) ":nimGlow2:" => ":nim2:" |
11:43:32 | * | fredrikhr92 joined #nim |
11:44:26 | PMunch | fredrikhr92, well well well, so you're still allowed IRC on your machine? :P |
11:47:40 | * | fredrikhr quit (Ping timeout: 276 seconds) |
11:51:38 | fredrikhr92 | PMunch, yeah... NSM hasn't said anything about that (yet) :P |
11:54:02 | PMunch | At least IRC doesn't have any pretense of security |
11:54:09 | PMunch | Or confidentiality rather |
11:58:05 | FromDiscord | <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:41 | FromDiscord | <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:12 | FromDiscord | <Andreas> (edit) "the" => "my" |
14:52:02 | * | fallback_ joined #nim |
14:52:19 | FromDiscord | <ringabout> In reply to @Andreas "recently on vs-code i": 1.6.12 ? |
14:53:10 | FromDiscord | <ringabout> See also => https://github.com/PMunch/nimlsp/issues/154 |
14:57:10 | FromDiscord | <Andreas> In reply to @ringabout "1.6.12 ?": nope that was devel 1.9.1 |
14:57:31 | FromDiscord | <ringabout> `nim -v`? |
14:58:04 | FromDiscord | <Andreas> `Nim Compiler Version 1.9.1 [MacOSX: amd64]↵Compiled at 2023-03-14`` |
14:58:27 | FromDiscord | <Andreas> (edit) "`Nim" => "`↵Nim" | "2023-03-14``" => "2023-03-14↵`" |
14:58:42 | FromDiscord | <ringabout> You might try the latest devel as well. |
14:59:08 | * | Notxor joined #nim |
14:59:30 | FromDiscord | <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:22 | FromDiscord | <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:20 | FromDiscord | <Andreas> In reply to @ringabout "Because the regression is": thx, i did `choosenim upgrade devel` and now i should be good ? |
15:01:32 | FromDiscord | <ringabout> Perhaps |
15:01:40 | FromDiscord | <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:00 | FromDiscord | <Gumbercules> Or just port it even - it's not that much code |
15:02:09 | FromDiscord | <ringabout> In reply to @firasuke "Do we have a": See also https://github.com/khchen/hashlib/blob/master/hashlib/misc/xxhash.nim |
15:02:14 | FromDiscord | <Gumbercules> and then you'd have a pure Nim implementation of xxhash |
15:02:35 | FromDiscord | <Gumbercules> In reply to @ringabout "See also https://github.com/khchen/hashlib/blob/mas": nice find |
15:09:21 | FromDiscord | <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:48 | ormiret | firasuke: 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:52 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=4s9H |
15:28:08 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4s9K |
15:28:15 | FromDiscord | <Andreas> (edit) "https://play.nim-lang.org/#ix=4s9K" => "https://play.nim-lang.org/#ix=4s9L" |
15:29:07 | FromDiscord | <spoon> ah, declaration stuff |
15:29:10 | FromDiscord | <spoon> thanks |
15:34:43 | FromDiscord | <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:20 | FromDiscord | <Yardanico> In reply to @spoon "ah, declaration stuff": it's because {} is just syntax sugar for openArray of tuples |
15:48:26 | FromDiscord | <Yardanico> to actually make it a hash table you need to use toTable as Andreas showed |
15:48:51 | FromDiscord | <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:58 | FromDiscord | <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:41 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4saa |
16:35:13 | FromDiscord | <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:58 | FromDiscord | <michaelb.eth> at this point I'm doing some head scratching, and realizing I don't understand macros very well |
16:36:17 | FromDiscord | <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:38 | FromDiscord | <Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4sab |
16:41:51 | FromDiscord | <Nerve> Even a FileStream would be cleaner |
16:41:57 | FromDiscord | <Nerve> (edit) "FileStream" => "`FileStream`" |
16:42:45 | FromDiscord | <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:45 | NimEventer | New thread by sls1005: Is the escape sequence case-insensitive?, see https://forum.nim-lang.org/t/10044 |
16:45:11 | FromDiscord | <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:26 | FromDiscord | <Andreas> (edit) "workk" => "work" |
16:46:35 | FromDiscord | <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:46 | FromDiscord | <Nerve> (edit) "I'd 1)" => "I'd↵1)" | "uint8`, 2)" => "uint8`,↵2)" |
16:47:11 | FromDiscord | <Nerve> Does the function itself point to a `char`? |
16:47:27 | FromDiscord | <Nerve> I think you can turn that into a `cstring` but I'm not sure |
16:48:23 | FromDiscord | <Nerve> But `cstring` will take a pointer and automatically look for a `\0` terminator |
16:52:34 | FromDiscord | <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:32 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4sai |
17:04:55 | FromDiscord | <michaelb.eth> In reply to @Andreas "i'd try `myElem =": thanks, I figured it out |
17:05:28 | FromDiscord | <Andreas> In reply to @michaelb.eth "thanks, I figured it": ok, how did you do it ? |
17:08:20 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4saj |
17:12:58 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4san |
17:14:13 | FromDiscord | <michaelb.eth> not sure what you mean by "though ..." |
17:14:19 | * | xet7 quit (Ping timeout: 248 seconds) |
17:15:47 | FromDiscord | <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:18 | FromDiscord | <Andreas> (edit) ""BAZ"]`" => ""BAZ"]`, anyway it works" |
17:16:36 | FromDiscord | <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:20 | FromDiscord | <Andreas> In reply to @michaelb.eth "I have the latter,": 😉 be carefull with macros - they lead to adiction.. |
17:26:29 | FromDiscord | <Andreas> (edit) "adiction.." => "addiction.." |
17:26:34 | FromDiscord | <michaelb.eth> In reply to @Andreas "😉 be carefull with": indeed! |
17:27:08 | * | xet7 joined #nim |
17:27:09 | FromDiscord | <michaelb.eth> I try to use them sparingly, fwiw |
17:30:49 | FromDiscord | <firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4sar |
17:31:22 | FromDiscord | <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:40 | FromDiscord | <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:08 | FromDiscord | <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:17 | FromDiscord | <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:30 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4saR |
19:10:38 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#ix=4saR" => "https://play.nim-lang.org/#ix=4saS" |
19:15:20 | FromDiscord | <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:57 | FromDiscord | <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:27 | FromDiscord | <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:42 | FromDiscord | <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:27 | FromDiscord | <Yardanico> In reply to @turbo "Not sure I follow.": just check the examples in jsffi or dom |
19:27:41 | FromDiscord | <Yardanico> Andreas is talking about a different thing specific to binding with quickjs, not about the Nim JS backend |
19:28:07 | FromDiscord | <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:16 | FromDiscord | <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:39 | FromDiscord | <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:55 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=4sbd |
20:28:06 | * | ltriant quit (Ping timeout: 255 seconds) |
20:39:31 | FromDiscord | <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:07 | ormiret | firasuke: this agrees with xxh128sum for the few files I tried it on: https://play.nim-lang.org/#ix=4sbj |
20:47:02 | FromDiscord | <firasuke> sent a long message, see http://ix.io/4sbk |
20:49:07 | * | gshumway quit (Quit: .) |
20:49:38 | FromDiscord | <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:06 | FromDiscord | <firasuke> I read std/hashes but it mentions `!&` and `!$` but not `$` alone. |
20:50:52 | FromDiscord | <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:10 | NimEventer | New 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:32 | ormiret | $ 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:23 | FromDiscord | <Elegantbeef> Damn chatgpt in the realtime chat |
20:56:01 | FromDiscord | <firasuke> In reply to @ormiret "$ is standard nim": I see, I am still getting the wrong hash |
20:56:06 | FromDiscord | <firasuke> I tried it on some files it worked |
20:56:15 | FromDiscord | <firasuke> but on tarballs it is failing |
20:57:00 | FromDiscord | <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:07 | FromDiscord | <firasuke> (edit) "for example, `make-4.4.tar.gz` (https://ftpmirror.gnu.org/make/make-4.4.tar.gz):↵- ... hashfile" added "proc" |
21:00:39 | FromDiscord | <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:53 | FromDiscord | <firasuke> In reply to @Andreas "have you tested if": nope, lemme check |
21:01:08 | FromDiscord | <Andreas> just give him "" |
21:01:51 | FromDiscord | <firasuke> yes it is identical |
21:02:02 | FromDiscord | <firasuke> even regular uncompressed files are hashing just fine |
21:02:06 | FromDiscord | <firasuke> but compressed tarballs are not |
21:02:50 | FromDiscord | <Andreas> In reply to @firasuke "but compressed tarballs are": hmm, strange, how is the blob processed - taken into the function.. |
21:02:57 | ormiret | I get the same hash ending a3c from both procs and xxh128sum for that make tar.gz... |
21:03:27 | FromDiscord | <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:48 | FromDiscord | <firasuke> it should end with `adf` (`15bf27bd70e74eb8c4f71a1028513adf`) |
21:03:55 | ormiret | I did, I get the same result from xxh128sum |
21:04:23 | FromDiscord | <firasuke> In reply to @ormiret "I did, I get": wait xxh128sum outputted `faae50855f65ad63b1c4c71c19166a3c`? |
21:04:30 | ormiret | yes |
21:04:39 | FromDiscord | <firasuke> lol, why is not doing that on my machine |
21:06:19 | FromDiscord | <Andreas> In reply to @firasuke "lol, why is not": check your test-material size, date etc. |
21:06:46 | FromDiscord | <firasuke> https://media.discordapp.net/attachments/371759389889003532/1090743878434439248/image.png |
21:07:23 | FromDiscord | <firasuke> just downloaded the archive again |
21:09:08 | FromDiscord | <Andreas> In reply to @firasuke "just downloaded the archive": and for this file the makers of thew algo provide a reference-hash ? |
21:09:18 | FromDiscord | <Andreas> (edit) "thew" => "the" |
21:09:47 | FromDiscord | <firasuke> In reply to @Andreas "and for this file": I don't think they provide a reference xxh128sum |
21:10:16 | FromDiscord | <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:17 | FromDiscord | <morgan> (edit) "one>" => "one?" |
21:11:06 | FromDiscord | <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:17 | FromDiscord | <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:40 | FromDiscord | <firasuke> In reply to @Andreas "and where does the": `xxh128sum` and rust's version of `xxhash` |
21:13:32 | FromDiscord | <Andreas> In reply to @firasuke "`xxh128sum` and rust's version": ic, and you see the difference only on tar-files ? |
21:13:48 | FromDiscord | <firasuke> In reply to @Andreas "ic, and you see": precisely |
21:14:34 | FromDiscord | <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:54 | FromDiscord | <firasuke> https://cyan4973.github.io/xxHash/ |
21:15:09 | FromDiscord | <Andreas> (edit) "?" => "?↵which means, even rust-people might get things wrong 🙂" |
21:16:23 | FromDiscord | <morgan> In reply to @MorganAlyssa "ok so if i": nvm i just changed them to be ref types |
21:16:57 | FromDiscord | <Elegantbeef> Do not use `ref T` as a shortcut! 😄 |
21:17:36 | FromDiscord | <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:51 | FromDiscord | <firasuke> ok `xxh64sum` worked |
21:21:26 | FromDiscord | <Andreas> In reply to @firasuke "ok `xxh64sum` worked": there is no formal specification - i'd stay away from that ... |
21:21:38 | FromDiscord | <firasuke> In reply to @Andreas "there is no formal": oh ok |
21:22:15 | FromDiscord | <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:43 | FromDiscord | <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:09 | FromDiscord | <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:34 | FromDiscord | <firasuke> Not really |
21:29:47 | FromDiscord | <firasuke> It is barely for verifying the integrity of downloaded files |
21:29:52 | FromDiscord | <firasuke> I need to be as fast as possible |
21:30:40 | FromDiscord | <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:25 | FromDiscord | <firasuke> So sha1sum? |
21:32:10 | FromDiscord | <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:21 | FromDiscord | <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:59 | FromDiscord | <firasuke> One of the blakes then |
21:34:09 | FromDiscord | <firasuke> And maybe choose a 256 width |
21:34:18 | FromDiscord | <Andreas> In reply to @firasuke "One of the blakes": yepp, anything that has blessing of the crypto-scene and is therefore recommended |
21:34:34 | FromDiscord | <firasuke> Ok, thanks for your insight |
21:34:38 | FromDiscord | <firasuke> Much appreciated |
21:36:14 | FromDiscord | <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:31 | FromDiscord | <firasuke> Care to link to it? |
21:37:55 | FromDiscord | <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:12 | FromDiscord | <firasuke> Thanks |
21:38:29 | FromDiscord | <Andreas> they have a english page too |
21:38:43 | FromDiscord | <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:06 | FromDiscord | <firasuke> oh saved me there |
22:11:14 | FromDiscord | <firasuke> do we have a blake3 library for nim? |
22:27:38 | ormiret | looks to be in hashlib https://github.com/khchen/hashlib/blob/master/hashlib/misc.nim#L39 |
22:28:20 | FromDiscord | <firasuke> hashlib has it all lol |
22:28:23 | FromDiscord | <firasuke> thanks a lot |
22:55:31 | * | ltriant joined #nim |
22:55:56 | * | derpydoo joined #nim |