<< 17-03-2022 >>

00:21:47*xet7 quit (Ping timeout: 252 seconds)
00:35:05FromDiscord<Girvo> In reply to @soda "i havent programmed in": Same lol. To the point where we've ditched our existing (shit) C++ firmware for a new Nim-based one
00:35:33FromDiscord<Elegantbeef> Any compiler bugs so far girvo?
00:36:16*xet7 joined #nim
00:43:32*xet7 quit (Ping timeout: 240 seconds)
00:44:50*xet7 joined #nim
00:53:32*xet7 quit (Ping timeout: 240 seconds)
00:56:39FromDiscord<Girvo> Nothing so far!
00:56:58FromDiscord<Girvo> Running stable v1.6.4 at the moment. Any bug I've run into has been my own fault or a misconfig on my end
01:44:23FromDiscord<Girvo> One thing I want to take a crack at, is seeing if I can get Nim code running on the FreeRTOS windows port. Would be nice to be able to simulate some of our code. Dunno how thats going to go mind you
01:53:33*arkurious quit (Quit: Leaving)
02:07:05FromDiscord<exelotl> In reply to @whee "using db_odbc (so no": Yeah pretty much. I guess you want something like https://github.com/treeform/tabby but for DB results instead of CSV rows? That's starting to smell a lot like an ORM :P
02:15:54FromDiscord<congusbongus> maybe https://github.com/bluenote10/NimData which is pandas-like
02:20:46FromDiscord<exelotl> To roll it yourself I think you can't do it with just a template, you need a macro that takes a typedesc and generates the appropriate code to convert each field (`parseInt`, `parseFloat`, etc.)
02:50:15FromDiscord<whee> In reply to @exelotl "Yeah pretty much. I": It's kinda like an ORM, but not as heavy. What I really want is what db_sqlite/db_mysql/db_postgres do with DbColumns, but it's not available with db_odbc (probably because every database's implementation is unique and ODBC is more generic)
03:00:41FromDiscord<whee> I'll check these two repos out, though, I bet there's something in there that will give me ideas
03:54:11FromDiscord<Girvo> Like a Data Mapper?
04:23:21FromDiscord<soda> In reply to @Girvo "Same lol. To the": Nah C++ still has it's supremacy unfortunately and I'm sure i will code in it again, though maybe if in the future nim can produce smaller binaries and have a simpler memory mngmt model. then it could really replace it.
04:23:52FromDiscord<Elegantbeef> Is arc/orc not a simple memory management model?
04:25:03FromDiscord<soda> i really just want to be able to allocate and free memory on my own
04:25:09FromDiscord<Elegantbeef> You can
04:25:15FromDiscord<Girvo> You totally can, and I am right now 😄
04:25:20FromDiscord<soda> i was told i can't here
04:25:50FromDiscord<Girvo> Combined with ARC its quite nice actually. I control the memory for the things that I _really_ need to in the embedded space, but ARC handles everything thats less important or more transient
04:25:56FromDiscord<Elegantbeef> You can allocate and free your own memory, just `ref`, `string`, `seq` do not have easy means of freeing
04:26:07FromDiscord<soda> yeah
04:26:09FromDiscord<soda> was told that too
04:26:22FromDiscord<soda> and they should
04:26:35FromDiscord<Girvo> For my part though, the only time I'm managing memory directly is because I'm crossing the boundary over to C/C++ libraries
04:26:55FromDiscord<Elegantbeef> Yea arc is very efficient so i dont really see the point in making those manually managable
04:27:22FromDiscord<Girvo> I mean I wouldn't be opposed to being able to, in some manner, but I certainly haven't need to so far and thats in the embedded space
04:27:42FromDiscord<Elegantbeef> For references you can do `GcRef` and `GcUnref`
04:27:58FromDiscord<Elegantbeef> Oh same for string/seq
04:28:05FromDiscord<Elegantbeef> So there you go you can manually manage them
04:28:06FromDiscord<Girvo> Yeah, some of the "embedded Nim" stuff does that
04:28:45FromDiscord<soda> the inclusion of gc makes the binary larger than what i'd need at work for eg
04:28:56FromDiscord<Elegantbeef> Arc doesnt include a GC
04:29:04FromDiscord<Elegantbeef> It's all move semantics
04:29:12FromDiscord<Girvo> Its reference counting now, with very little space needed for it
04:29:19FromDiscord<Elegantbeef> Just like RAII
04:29:36FromDiscord<Girvo> ^ so much so that binding C++ libraries is a lot nicer now, in my experience
04:29:39FromDiscord<soda> yeah i know that one doesn't
04:29:45FromDiscord<soda> In reply to @Girvo "^ so much so": yeah for sure
04:29:54FromDiscord<Girvo> Used to be really painful lol
04:29:55FromDiscord<soda> the syntax sugar approach to C++ is really nice
04:30:05FromDiscord<soda> (edit) "C++" => "object orientation"
04:30:32FromDiscord<soda> (edit) "doesn't" => "doesn't. there are other reasons too."
04:30:58FromDiscord<Girvo> Interestingly, using Nim with ARC has lead to _less_ memory usage than our existing C++ firmware, though thats confounded by the sheer crappiness of the original firmwares code lol
04:32:16FromDiscord<Girvo> @ElegantBeef I haven't used it: does GcUnref immediately free, or will it free when the scope ends?
04:32:28FromDiscord<Elegantbeef> It abides by the GC mechanism
04:32:44FromDiscord<Girvo> Alrighty
04:34:47FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3SBQ
04:34:59FromDiscord<Girvo> Though its wrong, coz it's missing the GC_Ref needed
04:35:06FromDiscord<Elegantbeef> Yea something like that
04:35:17FromDiscord<Elegantbeef> Though i was more talking about using `ref` instead
04:35:47FromDiscord<Girvo> Oh yeah haha, sorry I'm down in C land right now. This looks like I might be able to remove some of the C code I've had to write and move it to Nim even easier
04:36:03FromDiscord<soda> hmm
04:36:16FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/czm
04:36:19FromDiscord<Elegantbeef> Lol element didnt liike that
04:36:27FromDiscord<Girvo> hahaha
04:36:30FromDiscord<Girvo> But yeah I get it
04:36:51FromDiscord<soda> is there documentation for how gcfree works with arc?
04:36:54FromDiscord<Girvo> I'm gonna have a look at the output and play, but yeah this looks super handy for some of the global-ish bits that I need to pass to ESP-IDF lol
04:36:55FromDiscord<Elegantbeef> This gives you that `malloc` like behaviour but with "safe" mechanism
04:36:59FromDiscord<Girvo> Yeah!
04:37:04FromDiscord<Girvo> (edit) "Yeah!" => "Yeah, nice!"
04:37:10FromDiscord<Elegantbeef> It decrements the reference counter and it's killed at end of scope just like normal
04:37:55FromDiscord<Elegantbeef> `GcRef` and `GcUnref` just decrement the reference counting mechanism and allow a collection of the memory after it
04:38:20FromDiscord<Girvo> Yeah. So its just scope-based then once the ref count is 0. Nice
04:38:35FromDiscord<Elegantbeef> Valgrind can ensure this
04:39:09FromDiscord<Girvo> Nice
04:39:28FromDiscord<Elegantbeef> Well it can show if it leaks(just use `-d:useMalloc`)
04:39:53FromDiscord<Girvo> In reply to @soda "is there documentation for": Not that I'm directly aware of. Most docs are around the more "vanilla" ways of programming Nim in my experience, though ARC itself is pretty conceptually simple, at least in practice anyway
04:40:53FromDiscord<soda> i need malloc(). free() and --gc:none
04:40:54FromDiscord<soda> 😂
04:40:59FromDiscord<soda> (edit) "malloc()." => "malloc(),"
04:41:44FromDiscord<Girvo> I mean those exist haha 🙂 You can absolutely write Nim as if it's a syntax-over-C basically. I did that ages ago writing some software for my Pebble smart watch
04:41:59FromDiscord<soda> yeah
04:42:01FromDiscord<Girvo> You do have to give up quite a bit of Nim's standard library though
04:42:13FromDiscord<Girvo> It very much ends up feeling like a different C syntax, including its lack-of-standard-library lol
04:42:22FromDiscord<soda> i have not spent a lot of time on this yet
04:42:27FromDiscord<soda> i might over the weekend
04:43:01FromDiscord<Girvo> Have a play! Inspecting the C output (esp. with `-d:danger`) is enlightening for this stuff too, I've found
04:43:14FromDiscord<soda> nice
04:44:00FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/pIb
04:44:30FromDiscord<Elegantbeef> with `-d:freeIt` all memory is freed, but without it we leak obviously
04:44:40FromDiscord<Girvo> ooooh interesting
04:45:09FromDiscord<Elegantbeef> So you can use `ref` and `GcRef` similarly to `malloc`
04:45:29FromDiscord<Elegantbeef> And since the data for the GC is written next to the heap allocation you can pass it as a pointer to C and nothing bad happens
04:45:51FromDiscord<Girvo> Hell yeah. My task list has acquired a new to-do item lol. Defintely going to replace the C lib that I wrote to manage some of the icky-er stuff this way
04:45:54FromDiscord<Elegantbeef> Infact `var` and `ref` are C interopable atm
04:46:24FromDiscord<Elegantbeef> Though `{.byRef.}` is probably better than using `var`
04:47:00FromDiscord<Girvo> In reply to @Elegantbeef "Though `{.byRef.}` is probably": Why is that? (Honest question, I've been using `var` for the most part as the nesper library uses it)
04:47:30FromDiscord<soda> yah nice
04:47:34FromDiscord<Elegantbeef> for C interop in the case where there are a lot of `T` it's just generally more desirable
04:47:43FromDiscord<Girvo> Yeah that makes sense
04:48:34FromDiscord<Girvo> Oh btw, pthreads from `import posix` with `{.thread.}` is working wonderfully on the ESP32 🙂
04:48:43FromDiscord<Girvo> So cheers for all the help on that
04:48:47FromDiscord<Elegantbeef> Nice!
04:49:11FromDiscord<Girvo> Even is working with my binding over the top of the `esp_pthreads.h` extensions, quite nicely too
04:49:23FromDiscord<Elegantbeef> Good to hear
04:49:48FromDiscord<Girvo> And fixed up a lot of the scoping/heap weirdness that working with straight FreeRTOS tasks had. Though I do want to go back and solve that once and for all too, at some point
04:50:27FromDiscord<Elegantbeef> Do you still need cdecl\`?
04:50:33FromDiscord<Girvo> Not that I need to: `pthreads.h` on FreeRTOS/ESP-IDF just wraps the Task stuff anyway, and the `esp_pthreads.h` extensions give you the extra RTOS functionality
04:50:45FromDiscord<Girvo> Nah, I am using `noconv` though
04:51:14FromDiscord<Girvo> Oh, its working great with a shared lock too
04:54:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SBS
04:54:28FromDiscord<Elegantbeef> Can safe a bit of typing
04:54:30FromDiscord<Elegantbeef> save even
04:54:47FromDiscord<Girvo> Yeah already done haha 🙂 Cheers though!
04:54:55FromDiscord<Elegantbeef> Ah
04:55:57FromDiscord<Elegantbeef> Good thing I do not drink if I drank every time you said "cheers" to me I'd be fucking dead 😛
04:56:00FromDiscord<Girvo> Actually question, is there a way to export a pragma? I'm currently just re-defining it
04:56:12FromDiscord<Girvo> hahaha not wrong 😉 I'd kill most of my coworkers too based on our Slack chat
04:56:41FromDiscord<Elegantbeef> Seems like you cannot
04:56:55FromDiscord<Elegantbeef> so probably best to make it a macro
04:57:04FromDiscord<Girvo> Yeah might do
04:57:15FromDiscord<Girvo> Not that it matters right now, it's only defined in two files anyway
05:00:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SBV
05:19:13FromDiscord<Elegantbeef> [evoalg](https://matrix.to/#/@evoalg:matrix.org)\: where are all your questions anyway?!
05:19:54FromDiscord<evoalg> hehe ummm I've been a little busy 😉
05:20:25FromDiscord<evoalg> but I'm glad you've been missing my questions 😉
05:22:57*slowButPresent quit (Quit: leaving)
05:46:59FromDiscord<demotomohiro> @Elegantbeef Why don't your `rtosThread` macro use `macros.expectKind` proc?
05:48:16FromDiscord<Elegantbeef> expect kind doesnt give nice errors
05:50:03FromDiscord<Elegantbeef> `Error: Expected one of {nnkProcDef, nnkFuncDef}, got nnkMethodDef` is a useless error message to a programmer
05:50:44FromDiscord<Elegantbeef> Completely fine for helper macro procedures, completely useless for user facing code
05:51:53FromDiscord<Elegantbeef> `error` to me really makes macros feel like language features
05:53:09FromDiscord<m4ul3r> I'm trying to create a static binary on windows that has threading. I'm passing the args `--passC:"-static" --threads:on` on my `nim c` but the resulting binary is the same size without.↵The issue I'm running in to is a windows error saying `libwinpthread-1.dll is missing` when trying to run the binary on a different machine. Looking into that it is because the different windows machine doesn't have wingw64, thus the need for static link
05:54:06FromDiscord<Elegantbeef> You need to override the dll and statically link it
05:54:18FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#dynliboverride
05:54:33FromDiscord<Elegantbeef> So you need to get a `.lib` file for that library
05:54:50FromDiscord<Elegantbeef> a static binary is not the same as static linking
05:55:21FromDiscord<m4ul3r> My bad, yes I do mean I need a static binary. I will check into this. Thanks!
05:56:42FromDiscord<demotomohiro> @Elegantbeef I see
05:57:40FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/953894872270663710/image.png
05:57:42FromDiscord<Elegantbeef> Just for example
05:58:19FromDiscord<demotomohiro> You can copy your excutable with .dll files to other machine
05:58:34FromDiscord<Elegantbeef> That's the "proper" solution
05:59:56FromDiscord<Rika> In reply to @Elegantbeef "Seems like you cannot": you can't but the trick that the stdlib uses is to make a pragma pragma only module and include it
06:00:45FromDiscord<Elegantbeef> I dont know what that `include` keyword means, personally i dont even think it exists
06:06:27*Gustavo6046 joined #nim
06:07:33FromDiscord<huantian> Include that seems like a good way to make clean code
06:10:31FromDiscord<Rika> i mean whatever, you do you, i would rather the include than to make a bulky macro
06:10:46FromDiscord<Rika> since in this case its not going to break anything
06:12:20FromDiscord<Elegantbeef> Well the annoying part is that you cannot export the pragma so if you had a `rtosthreads.nim` you also have to include the pragma for cleaner code
06:12:39FromDiscord<Elegantbeef> Having to include it everywhere suuuuuucks
06:21:01FromDiscord<Rika> only if it is userfacing then i guess
07:36:09*PMunch joined #nim
07:51:06*Gustavo6046_ joined #nim
07:51:10*Gustavo6046_ quit (Remote host closed the connection)
07:52:31*Gustavo6046 quit (Read error: Connection reset by peer)
08:06:32FromDiscord<nariod> Hello guys,↵New Nim programmer here! Is there a chan for win32 API related dev?
08:06:44FromDiscord<Elegantbeef> You can just ask here
08:07:08FromDiscord<Rika> No
08:07:15FromDiscord<Rika> There is no channel
08:07:40FromDiscord<nariod> OK thx!
08:16:10PMunchHmm, I have a small program which sends a bunch of request to my service and measures latencies. Is there a nice little library to display a list of values as a distribution graph?
08:20:01FromDiscord<Elegantbeef> Scinim has plotty
08:20:32PMunchHmm, I was thinking something simple in the terminal
08:21:21PMunchI guess I could easily hack something together with drawille
08:22:10FromDiscord<Rika> Doesn’t curses/-like libraries have graphing tools
08:22:48FromDiscord<Elegantbeef> There is also https://github.com/Yardanico/asciigraph
08:23:55PMunchHmm, asciigraph seems very close to what I want
08:24:48FromDiscord<Elegantbeef> Jesus it's like 3 functions
08:26:40PMunchI guess if I do a countTable and get them out ordered and pass it to asciigraph it might work
09:04:44PMunchHmm, I think I need a log scale for this..
09:09:21*[R] quit (Read error: Connection reset by peer)
09:22:01FromDiscord<Phil> Design question!
09:22:09PMunchDesign answer!
09:25:56FromDiscord<Phil> sent a long message, see https://paste.rs/M70
09:27:02FromDiscord<Phil> Ah, the deletion logic-wise also should happen in the service, because the repository shouldn't deal with what happens on the disk imo, only what happens in the database.
09:27:22FromDiscord<Phil> service, controller and repository are all separate modules
09:27:37FromDiscord<Elegantbeef> 'This must be in that order because only after storing it on disk do you know what filepath the file will have and thus which filepath you need to store in the database entry.' ?
09:28:26FromDiscord<Elegantbeef> How do you download the file to a directory without knowing what directory to store it to?
09:29:07FromDiscord<Phil> I know in which directory it will be, but I don't know for sure the filename it'll have after storing. ↵That is because if the user saves a file "lala.jpg" and that file already exists, I append a random string of 10 chars to the end of the filename
09:29:39FromDiscord<Phil> so even if the user uploads "lala.jpg" the final file path may be "/my/dir/lala_LFASH91m.jpg"
09:30:00PMunchIt depends on your database logic, but try/except sounds like the logical choice if it throws an exception
09:30:20PMunchAnd you probably wouldn't re-raise it, but that depends on what kind of logic you have further up
09:30:48FromDiscord<Phil> The std/db_sqlite module will be throwing a DBError essentially because the database itself will throw `CHECK constraint failed: wikientries.models_Only_One_Article`
09:31:46FromDiscord<Elegantbeef> I still dont understand how you wouldnt know that it's going to be named with the random characters
09:31:55FromDiscord<Phil> Ah, right, that piece of info is missing.↵In my controller I try-except my service calls because if something goes wrong, my except is returning a HTTP400/500 whatevs with a custom message attached
09:32:03FromDiscord<enthus1ast> I've build image upload service, by hashing the image, creating folder by the name of the hash and put the image there, this way i also could put a generated thumbnail next to the image↵(@Phil)
09:32:17FromDiscord<enthus1ast> and no naming issues
09:33:10PMunchYeah keeping the user-supplied filename is probably just going to cause issues
09:33:14FromDiscord<enthus1ast> must not be a crypto secure hash, something fast
09:33:49FromDiscord<enthus1ast> the other benefit of this is that you can just point the webserver to the public dir, an noone can guess the whole path because of this hash
09:33:57FromDiscord<katlyn> i think elegantbeef's point is that you can determine the file name, write to the database, then write the file just as easily as the order you do things now - you just swap the two storage steps
09:34:10PMunchBut yeah, catch the DBError where the file was created, delete the file, then re-raise it or wrap it in a new exception type.
09:34:16FromDiscord<Elegantbeef> Indeed my point
09:34:47PMunchWell that works until two people try to upload a file called the same at the same time
09:35:36FromDiscord<Phil> In reply to @Elegantbeef "I still dont understand": I mostly don't like the design that creates of splitting the proc that figures out the name from the proc that stores the file (which is logic that is housed in a separate utils module), it means my code in the service needs to be aware that there's a possible file-name-change inbound.↵And also the possible issue that you might have name-collisions (as unlikely as they might be) during
09:37:44FromDiscord<Phil> In reply to @enthus1ast "I've build image upload": I like this solution so far, though it might be more computationally intensive than strictly necessary (no idea how fast hashing an image to a string is, really). Why not only hash the image to a string and use that string as a normal filename instead of making a dir out of it?
09:38:58FromDiscord<Rika> I’m late; so you want a rollback outside of only the database?
09:39:07FromDiscord<Elegantbeef> Use the hash of `epochTime` and be very funny
09:39:10FromDiscord<Phil> In reply to @Rika "I’m late; so you": Pretty much
09:39:36FromDiscord<Phil> wait... why don't I just append a unix timestamp at each file's end....
09:39:47FromDiscord<Elegantbeef> Fuck what a magical idea
09:40:03FromDiscord<Phil> I mean, you were the one that had it 😛
09:40:07FromDiscord<Rika> I have no idea what you’re thinking
09:40:20FromDiscord<Elegantbeef> That someone likes to overcomplicate isues
09:40:37FromDiscord<Phil> No wait, false alarm, still don't like that logic flow.
09:41:02FromDiscord<Elegantbeef> I wasnt going to let you use it anyway
09:41:09FromDiscord<Elegantbeef> Under some weird IP law i own it probably
09:41:31FromDiscord<Phil> Runs into the same issue as before that I essentially insert database logic into the middle of file-storage-logic
09:41:31FromDiscord<enthus1ast> @Phil\: have you considered my folder solution?
09:41:39FromDiscord<enthus1ast> much more robust and deterministic
09:41:41FromDiscord<Phil> In reply to @enthus1ast "<@180601887916163073>\: have you considered": Yeh, I threw in the question for why folder
09:42:03FromDiscord<Elegantbeef> The fuck is a "database"?
09:42:18FromDiscord<Phil> A cookie
09:42:20FromDiscord<Phil> tasty too
09:42:33FromDiscord<Elegantbeef> One day I'll not be able to make that joke
09:42:54FromDiscord<Elegantbeef> I'll have the silly idea to make a game that needs a backend eventually and enter hell
09:43:34FromDiscord<Phil> Don't larger games need to store states of various places in the world in a database?
09:43:53FromDiscord<Phil> Assuming an RPG or something of the sort
09:44:31FromDiscord<Phil> In reply to @enthus1ast "I've build image upload": Ohhh you made the hash the folder so you could preserve the filename
09:45:04FromDiscord<enthus1ast> yes
09:45:14*krux02 quit (Remote host closed the connection)
09:45:17FromDiscord<enthus1ast> and was also generating thumbnails for the images
09:45:21FromDiscord<enthus1ast> and put them in the same folder
09:45:30FromDiscord<Phil> hmmmm
09:46:08FromDiscord<enthus1ast> this way i could do\: \<hash\>/thumb.x.y.png
09:46:27FromDiscord<Phil> On the one hand, that's some degree of complexity. On the other, it gives me a lot of flexibility to do things with the image without turning it into an insane mess, which is nice
09:46:35FromDiscord<enthus1ast> and its deterministric because i can easily create the whole path name from the original file
09:47:12FromDiscord<enthus1ast> AAAND it preserves the original filename even when hosted on a cdn or webserver
09:47:17FromDiscord<Phil> Yeh, I see the benefits, I think it's a really good solution, particularly if you do stuff like creating thumbnails etc.
09:47:29FromDiscord<Elegantbeef> Sure but i'm a failure of a dev so i'll never work on anything big
09:48:22FromDiscord<Phil> Denied, you're cool beef, if you put yourself in the oven you could even be hot beef
09:48:42PMunch@Elegantbeef, okay these are the two graphs: http://ix.io/3SCD
09:48:55PMunchNot sure if I did the bucketing correctly though..
09:49:10FromDiscord<Phil> CLI graphs?
09:49:12FromDiscord<Phil> I'm on board
09:49:17PMunchYup
09:49:35FromDiscord<Phil> I like the bottom representation
09:49:41FromDiscord<Phil> Really clear and easy to look at
09:50:16PMunchThe bottom one is from asciigraph, the top one is just something I threw together with drawille
09:50:37PMunchI like the resolution of the top one though
09:51:08FromDiscord<Phil> Hmm yeah you can go 4 times more precise
09:51:15FromDiscord<Phil> Is there a way to increase contrast to the background?
09:51:37FromDiscord<Rika> No
09:51:43FromDiscord<Rika> Well yes but it’s terminal dependent
09:51:59FromDiscord<Rika> Though tbf that pixel thing is also terminal dependent to some degree
09:52:04FromDiscord<Phil> In reply to @enthus1ast "AAAND it preserves the": What did you use for image hashing?
09:52:51FromDiscord<Rika> You could probably use xx hash
09:53:09FromDiscord<enthus1ast> back then i've used sha1
09:53:09PMunchNow I just need to figure out how to do log scales..
09:53:12FromDiscord<enthus1ast> but xx hash
09:53:15FromDiscord<enthus1ast> is faster i
09:53:28FromDiscord<Phil> is that something I can google or is xx a placeholder?
09:53:42FromDiscord<enthus1ast> https://github.com/OpenSystemsLab/xxhash.nim
09:54:07FromDiscord<Rika> https://github.com/khchen/hashlib if you want more hash algorithms
09:54:13FromDiscord<enthus1ast> have a look i cant remember which one was the fastest xx hash
09:55:14FromDiscord<Rika> xx hash is good because it isn’t cryptographic like SHA is lol
09:55:43FromDiscord<enthus1ast> yes, but there is even a higher speed version of xxhash
09:56:03FromDiscord<enthus1ast> Version Speed on 64-bit Speed on 32-bit↵XXH64 13.8 GB/s 1.9 GB/s↵XXH32 6.8 GB/s 6.0 GB/s
09:56:09FromDiscord<Phil> Anything majorly speaking against std/hashes?
09:56:26FromDiscord<enthus1ast> yes, you could not easily do them on commandline
09:56:47FromDiscord<enthus1ast> for a default hash you can generate your pathname on commandline
09:57:07FromDiscord<enthus1ast> and on the next nim hash change they'll break
09:57:50FromDiscord<Rika> In reply to @Isofruit "Anything majorly speaking against": Not really
09:58:16FromDiscord<Rika> In reply to @enthus1ast "and on the next": I am unsure about stability of the hashes module but I don’t think it will happen
09:58:23FromDiscord<Phil> I don't think I understand enthus1ast, why am I caring about commandline?
09:58:35FromDiscord<Rika> I don’t understand either
09:59:08FromDiscord<enthus1ast> there will be a day when you must administrate your website, ( i did in a 5+ years runtime of my service)
09:59:21FromDiscord<enthus1ast> then its nice when you can just generate the hash by commandline
10:00:07FromDiscord<Phil> Ah, to figure out where a given image was stored
10:00:13FromDiscord<Rika> You could just make the tool?
10:00:20FromDiscord<Rika> It’s not particularly hard I’d say
10:00:57FromDiscord<Rika> Nim used wy hash for reference
10:01:02FromDiscord<Rika> Uses
10:01:07FromDiscord<enthus1ast> echo /path/to/my/public/ `xxhash myFile`
10:02:11FromDiscord<enthus1ast> i do not claim this is the perfect solution, but its stuff i found useful for my service
10:02:17FromDiscord<Phil> check
10:05:29PMunchHmm, I really need to get a better font..
10:05:36FromDiscord<enthus1ast> also xxhash has a streaming api, i've used this for larger files
10:06:13FromDiscord<enthus1ast> (in another project though, but still)
10:09:57FromDiscord<Phil> I made a TODO to refactor image uploading to follow your suggestion since I like it, I'll get around to it when I find the time
10:23:33FromDiscord<fbpyr> sent a long message, see https://paste.rs/qAy
10:26:35FromDiscord<fbpyr> if I manually placed the `gitlib2.so` in the same directory, there were no complaints about the missing .so ..
10:43:54*dtan joined #nim
10:59:34*dtan quit (Quit: Quit)
10:59:50FromDiscord<abdu> How do we have build_all able to pause and then resume again in its build process ?↵Please help out
11:01:45*dtan joined #nim
11:08:32*dtan quit (Ping timeout: 240 seconds)
11:14:35FromDiscord<enthus1ast> [fbpyr](https://matrix.to/#/@fbpyr:tchncs.de)\: either load the so by hand useing dynlib (which requires a wrapper patch i guess) or use another programm that just unpacks your app and the so, then calls your app, or use a installer creator (or your distributions package manager), or bundle all in a zip file
11:15:40FromDiscord<enthus1ast> the correct solution would be imho to use your distributions package manager
11:15:50FromDiscord<enthus1ast> another solution is to statically link everything
11:16:45FromDiscord<enthus1ast> but depending on your distro, creating a package might be an even bigger project than your app \:) (hem hem .deb hem hem)
11:18:57FromDiscord<enthus1ast> @abdu\: why would you need this?
11:51:33FromDiscord<fbpyr> sent a long message, see http://ix.io/3SDh
11:56:50PMunchHey, Futhark has gotten 100 stars :)
12:16:40FromDiscord<enthus1ast> [fbpyr](https://matrix.to/#/@fbpyr:tchncs.de)\: for windows you could use nsis or inno setup
12:19:08FromDiscord<enthus1ast> or just a zip folder \:)
12:19:49FromDiscord<enthus1ast> but with such installer creators its easy to eg add desktop start menu shortcuts, create uninstallert etc
12:43:13*slowButPresent joined #nim
12:45:28FromDiscord<fbpyr> well my installer only installs a couple of small addins from git repos for existing applications (using git as autoupdater), so I would not need any desktop shortcuts. ↵but maybe more 'officially looking installers' are a better way for the users.. 🤔
12:49:39FromDiscord<demotomohiro> @PMunch Congratulations!
13:05:12*arkurious joined #nim
13:15:53*xet7 joined #nim
13:36:35*Guest67 joined #nim
13:44:33*Guest67 quit (Quit: Client closed)
13:44:55*juztziggs joined #nim
13:50:21*juztziggs quit (Quit: Client closed)
14:24:22FromDiscord<auxym> In reply to @fbpyr "well my installer only": you can use wix to build MSIs. it's a bit confusing but gets better once you wrap your head around the MSI format. It's basically a database with a dozen or so tables (eg there's a table with files to be installed), so you look up the reference for the tables.
14:24:58FromDiscord<auxym> this: https://wixtoolset.org/
14:25:30PMunchHmm, I did start working on a Nim based Windows installer generator after having to write InnoScript for some work project
14:25:47PMunchSomeone else took over the project however, so I never completed it
14:26:08PMunchWell, they took over creating the installer, not the project itself
14:52:31PMunchAnyone else having trouble with GitHub?
14:52:48nrds<Prestige99> yep
14:52:50nrds<Prestige99> lot of outages rn
14:54:43PMunchHmm, that's inconvenient..
14:58:36nrds<Prestige99> very :P https://www.githubstatus.com/
14:59:33FromDiscord<Rika> the whole thing is degraded xd
15:00:06nrds<Prestige99> Time to answer emails
15:00:24*vicecea quit (Remote host closed the connection)
15:00:52*vicecea joined #nim
15:02:42*PMunch quit (Quit: Leaving)
15:04:05FromDiscord<Rika> how dreadful
15:18:07FromDiscord<auxym> oh damn... is this why my platformio randomly stopped working? Here I am just spent an hour reinstalling vscode, nuking my profile, reinstalling Anaconda... D:
15:18:39FromDiscord<Rika> damn
15:19:33FromDiscord<auxym> I'm becoming less and less of a fan of PIO, not the first time it randomly breaks on me. but work is work :\ (and c++ ugh)
15:58:16*xet7 quit (Ping timeout: 245 seconds)
15:59:18*xet7 joined #nim
16:14:07*zgasma quit (Quit: nyaa~)
16:26:44FromDiscord<Daan Breur> matrixcheck
16:30:28FromDiscord<exelotl> matrix, heck
16:30:51FromDiscord<Daan Breur> lol
16:42:11*zgasma joined #nim
17:10:37FromDiscord<Shinyzenith> has anyone faced this issue before? https://github.com/PMunch/futhark/issues/22
17:10:51FromDiscord<Shinyzenith> and yes I have linked my binary with wayland-server
17:45:08*pro joined #nim
18:00:02FromDiscord<shrekman!> havent used nim yet, how much would an exe of hello world take in nim
18:01:24FromDiscord<Daan> In lines of code or in compiled file size?
18:01:53nrds<Prestige99> https://play.nim-lang.org/#ix=1Kcr <- in code
18:04:23Amun-Rashrekman!: a few KB, if you worry about the size write in asm
18:20:06*krux02 joined #nim
18:25:24FromDiscord<Rika> someone got hello world down to 160b in nim i believe
18:25:29FromDiscord<Rika> but its not idiomatic, naturally
18:28:52FromDiscord<mratsim> In reply to @shrekman! "havent used nim yet,": https://hookrace.net/blog/nim-binary-size/
18:29:19Amun-Rait needs a refresh tho
18:33:11FromDiscord<shrekman!> In reply to @Amun-Ra "shrekman!: a few KB,": im looking for an efficient, portable language
18:33:23FromDiscord<shrekman!> does it compile to cross platform easily?
18:34:01FromDiscord<Rika> i mean i guess, what platforms are we talking about
18:49:53FromDiscord<shrekman!> debian based systems, windows and maybe mac
18:50:11FromDiscord<Rika> then sure that's easy for nim
18:50:23FromDiscord<Rika> there's also other stuff like solaris haiku bsd embedded systems etc
18:50:35*pro quit (Quit: pro)
18:56:54Amun-Rashrekman!: well, imho you found it
19:05:50FromDiscord<TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SGL
19:06:39FromDiscord<huantian> seems good
19:07:30*Gustavo6046 joined #nim
19:07:32FromDiscord<Rika> probably needs the type for url, i dont remember types being inferrable in procedure signatures
19:07:48FromDiscord<Rika> !eval func initNodeInstance(url = ""): int = discard
19:07:51NimBot<no output>
19:07:56FromDiscord<Rika> huh they do
19:07:58FromDiscord<Rika> cool
19:08:09FromDiscord<huantian> you just have to make sure it's non ambiguous ig
19:08:27FromDiscord<Rika> status btw is by default false
19:08:54FromDiscord<TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SGN
19:09:05FromDiscord<TennisBowling> (edit) "https://play.nim-lang.org/#ix=3SGN" => "https://paste.rs/wuE"
19:09:07FromDiscord<TennisBowling> In reply to @Rika "probably needs the type": so should I do `url: string = ""`?
19:09:11FromDiscord<Rika> no no
19:09:13FromDiscord<Rika> it works
19:09:13FromDiscord<Rika> its fine
19:09:20FromDiscord<huantian> In reply to @TennisBowling "cool! I also try": this is because self is immutable
19:09:31FromDiscord<Rika> and you cannot make it mutable because your proc is async
19:10:09FromDiscord<Rika> you kinda can bodge it by using `ref`
19:10:42FromDiscord<TennisBowling> why can't it be mutable when async?
19:11:50FromDiscord<TennisBowling> In reply to @Rika "you kinda can bodge": so does this just set `self` to the pointer of the object?
19:12:04FromDiscord<Rika> semantics are weird, you can hold futures without `await`ing them so once you call it and take its future the value is now changed even if your proc hasnt "finished" running, i guess
19:12:08FromDiscord<Rika> this is just a guess
19:12:23FromDiscord<Rika> In reply to @TennisBowling "so does this just": no it means that you would have to pass in a reference which is annoying
19:12:41FromDiscord<Rika> or you'd have to deal with reference semantics everywhere else if youre making the type ref
19:12:47NimEventerNew thread by DMisener: Simple linked list questions: Correct proc signature for first(), see https://forum.nim-lang.org/t/9019
19:13:19FromDiscord<TennisBowling> wait but if I call it with `NodeInstance.setOnline()` do I need to pass the nodeinstance ref?
19:13:48FromDiscord<Rika> you'd need to create a reference as ive said and yes it is annoying
19:13:55FromDiscord<Rika> even then i guess it doesnt work
19:14:03FromDiscord<Rika> so your only option is to make the whole type ref
19:16:06FromDiscord<TennisBowling> In reply to @TennisBowling "hey. In python I": with the initNodeInstance I'm getting that it can make side effects, but how?
19:17:57reversem3[m]Getting illegal storage access running nimble runr for nico https://play.nim-lang.org/#ix=3SGO
19:17:59FromDiscord<huantian> In reply to @Rika "semantics are weird, you": <https://play.nim-lang.org/#ix=3SGV> it mentions violating memory safety which ig sure
19:18:25FromDiscord<huantian> In reply to @TennisBowling "with the initNodeInstance I'm": It's just a normal proc, you can do anything you want like `echo`ing
19:18:25FromDiscord<Rika> In reply to @TennisBowling "with the initNodeInstance I'm": is what you posted the whole code?
19:18:27FromDiscord<Rika> for the proc
19:18:38FromDiscord<Rika> In reply to @huantian "It's just a normal": he uses func here
19:18:43FromDiscord<huantian> oh huh
19:19:02FromDiscord<TennisBowling> In reply to @Rika "for the proc": what proc?
19:19:20FromDiscord<huantian> In reply to @Rika "he uses func here": oh I didn't notice
19:19:50FromDiscord<TennisBowling> should I use proc for the init?
19:19:57FromDiscord<huantian> if you want side effects you should use proc
19:20:33FromDiscord<huantian> func is a shortcut for `{.noSideEffect.}`
19:20:34*krux02 quit (Read error: Connection reset by peer)
19:20:52*krux02 joined #nim
19:21:13FromDiscord<huantian> In reply to @huantian "<https://play.nim-lang.org/#ix=3SGV> it mentions vi": hm actually maybe it does make sense, async does expand into iterators?
19:22:09FromDiscord<TennisBowling> In reply to @huantian "if you want side": right but I don't see how this func can make side effects
19:22:16FromDiscord<TennisBowling> I probably misunderstand side effects
19:23:04FromDiscord<Rika> side effects can be echoing or mutating a global
19:23:10FromDiscord<huantian> newHttpClient() has side effects, see your error message
19:23:13FromDiscord<Rika> ~~rather technically echoing is mutating a global~~
19:23:30FromDiscord<huantian> sent a code paste, see https://paste.rs/u7x
19:24:09FromDiscord<TennisBowling> oh I see
19:24:28FromDiscord<TennisBowling> this doesn't really matter so I'll just make it a proc?
19:24:34FromDiscord<Rika> sure
19:24:38FromDiscord<Rika> thats fine
19:24:55FromDiscord<TennisBowling> cool thank you!
19:24:57FromDiscord<huantian> oh yeah I forgot FutureVar exists, isn't that supposed to be used for var params in {.async.}
19:25:27FromDiscord<Rika> really
19:25:42arkanoidnimscript + async is a thing?
19:25:56FromDiscord<Rika> future var is a return type tho isnt it
19:26:04FromDiscord<huantian> yeah uh hm
19:26:24FromDiscord<Rika> its an async equivalent for returning a var T
19:26:42FromDiscord<Daan> What is recommended for a Type, tuple or object
19:26:59FromDiscord<huantian> In reply to @Rika "its an async equivalent": yeah I can't remember what I was thinking of
19:27:47FromDiscord<huantian> I guess either use ref, or just return a copy of your object when you can
19:28:13FromDiscord<huantian> In reply to @Daan "What is recommended for": somewhat depends but you probably want object
19:29:15FromDiscord<Daan> It is for Thread data↵(@huantian)
19:31:18FromDiscord<Rika> object
19:32:30FromDiscord<Daan B> @Rika\: Thanks
19:34:35FromDiscord<Daan B> sent a code paste, see https://play.nim-lang.org/#ix=3SGZ
19:34:50FromDiscord<Daan B> sent a code paste, see https://play.nim-lang.org/#ix=3SH0
19:34:51FromDiscord<Rika> exported
19:35:51FromDiscord<Daan B> So if you make the `Type` in a separate file you use an asterisks else you don't
19:38:25FromDiscord<Daan B> Or am I completely wrong?
19:38:26FromDiscord<Daan B> So if you make the `Type` in a separate file you use an asterisks else you don't
19:41:06arkanoidhow to use multiple cores in nimscript? Do I have to rely on threads?
19:41:35Amun-Rahmm, fork?
19:42:20arkanoidI just have a long list of "exec" commands that I can run in parallel. They are cpu bound so yeah I need thread or multiprocessing, but unsure which is easier/suggested in nimscript
19:51:57FromDiscord<exelotl> In reply to @Daan B "So if you make": Yes, if you make `Type` in some module and want it to be usable in other modules that import it, you need the asterisks (on the type itself and on all the fields that you want to be accessible)
19:53:19FromDiscord<Daan B> Thanks.
19:57:47FromDiscord<Elegantbeef> arkanoid you're going to have to use the shells forking capabilities, nimscript doesnt know what a thread is
19:58:31arkanoidElegantbeef, mmm ok. I guess exec is sent straight to the shell
19:58:45arkanoidso backgrounding with "&" would work
19:58:48FromDiscord<Elegantbeef> Unless you're calling compiled Nim 'nimscript' 😀
20:05:13arkanoidnope, I'm running "nim myscript.nims"
20:05:32arkanoidI'm trying to start replacing my daily bash and python script with nim
20:06:04arkanoidyou know, simple utils you drop in working directory to replace boring daily tasks
20:06:22FromDiscord<Elegantbeef> So are you using Nim then?
20:07:13FromDiscord<Daan B> Arkanoid, what do you mean?
20:07:16FromDiscord<Elegantbeef> If so you can use https://nim-lang.org/docs/osproc.html#execProcesses%2CopenArray%5Bstring%5D%2Cproc%28int%29%2Cproc%28int%2CProcess%29 or similar
20:08:09FromDiscord<TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SHd
20:10:05FromDiscord<Elegantbeef> Which line is the source of that error?
20:10:57arkanoidElegantbeef, why you call running "nim myscript.nims" compiled nim? Is't code like this executed in nim vm?
20:11:19FromDiscord<Elegantbeef> I mean i dont get why you're using nimscript
20:11:47FromDiscord<Elegantbeef> https://github.com/PMunch/nimcr and carry on
20:13:53FromDiscord<Elegantbeef> Nimscript running in the normal compiler lacks many things that makes it as capable as other scripting languages, so you're just setting yourself up for tedium using it for automating tasks imo
20:18:30FromDiscord<Mysterysib> What compiler does nim use?
20:18:46FromDiscord<Elegantbeef> 'any' C compiler
20:18:49FromDiscord<Mysterysib> does it compile to C and then ASM, or straight to ASM?
20:19:07FromDiscord<Elegantbeef> On linux it defaults to gcc, on windows it defaults to mingw, on mac defaults to clang
20:19:09FromDiscord<Mysterysib> Ahh, so you could use LLVM
20:19:34FromDiscord<Elegantbeef> https://github.com/arnetheduck/nlvm does exist
20:19:40FromDiscord<Elegantbeef> There isnt much benefit to using llvm but yes you can
20:20:07FromDiscord<Mysterysib> Mhmm cool
20:20:41FromDiscord<Mysterysib> You know that site where you could see the ASM various compilers produce? Would be interesting to compare to what's produced from Nim!
20:20:54FromDiscord<Elegantbeef> Godbolt supports nim
20:20:56FromDiscord<Rika> Godbolt
20:21:46reversem3[m]I have tried 4 different versions of nim to run this nico example and all of tell me "illegal storage"
20:21:51FromDiscord<Mysterysib> Woah proc square is a lot longer than C++
20:21:52Amun-RaI often type goldbot instead
20:24:09reversem3[m]I tried to get advice in the nim-gamedev but seems pretty empty , https://play.nim-lang.org/#ix=3SGO
20:25:05reversem3[m]It's probably an osx issue. Later I'll try a new nico template and see if that runs by itself.
20:31:57FromDiscord<TennisBowling> In reply to @Elegantbeef "Which line is the": not sure
21:01:02*krux02 quit (Ping timeout: 240 seconds)
21:09:06FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=3SHm
21:13:16FromDiscord<Generic> well you could have something exactly like this in C++
21:13:49FromDiscord<Generic> sent a code paste, see https://play.nim-lang.org/#ix=3SHo
21:13:56FromDiscord<Generic> but there's no function like this in the standard library
21:15:24FromDiscord<Generic> more importantly being eable to just implicitly pass variables as mutable is the groundwork for lots very common things in Nim
21:15:40FromDiscord<Generic> like all seq or Table operations
21:16:01FromDiscord<Generic> because they are value objects, they're passed in as the first parameter as a var parameter
21:16:51FromDiscord<demotomohiro> Nim add runtime error checks (overflow, out of bound etc) and stack trace. When you wanto to compare assembly output of Nim and C/C++ add -d:danger option to optimize code and remove runtime checks.
21:17:36FromDiscord<mattrb> In reply to @Generic "well you could have": Are there other languages in which an array access on a value type isn't a copy?
21:18:13FromDiscord<Generic> like I demonstrated, in C++, the same thing can be done
21:18:31FromDiscord<Recruit_main707> other than c++ i guess
21:19:28FromDiscord<Generic> none I can think of atm, though there aren't really that many languages with non primitive value types
21:22:47FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3SHt
21:24:32FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=3SHu
21:24:42FromDiscord<mattrb> It does inc the second array value like nim, though
21:25:01FromDiscord<Generic> C++ doesn't initialise values by default
21:25:05FromDiscord<mattrb> Ah
21:25:14FromDiscord<Generic> so you get what was already there before
21:25:21FromDiscord<mattrb> Makes sense then, so it behaves just like nim aside from zeroing the array
21:25:26FromDiscord<Generic> also int a = arr[0];
21:25:31FromDiscord<Generic> copies
21:25:59FromDiscord<Generic> it's the int& (C++) or var int (Nim) in the function signature which says that no copy should be done
21:26:05FromDiscord<mattrb> Right, the part that's unintuitive to me for both nim anc c++ is that `inc(arr[1])` _doesn't_ copy
21:26:07FromDiscord<Generic> but instead the value passed should be modified
21:26:32FromDiscord<mattrb> It's useful, but coming from other languages it just wasn't intuitive to me that that wouldn't copy the value on access
21:27:30FromDiscord<mattrb> It's useful, don't get me wrong. I just only caught it in my unit tests and was confused at first
21:27:42FromDiscord<demotomohiro> Incrementing with `arr[1] += 1` is also unintuitive for you?
21:28:27FromDiscord<mattrb> Hmm
21:28:48FromDiscord<mattrb> That makes sense, which I guess means my intuition wasn't very solid 🤔
21:30:12FromDiscord<mattrb> Is there a way in nim or in another language to make a variable assignment like `var a = arr[0]; inc(a)` behave more like `inc(arr[0])` and _not_ copy?
21:30:48FromDiscord<mattrb> My usecase being that I want to pull out a mutable reference to a value in the array, mess with it, and not have to stick it back in the array (or have to index off of the array for every operation)
21:31:17FromDiscord<Generic> https://nim-lang.org/docs/sugar.html#dup.m%2CT%2Cvarargs%5Buntyped%5D
21:33:47FromDiscord<demotomohiro> https://demotomohiro.github.io/littlesugar/withAliases.html↵https://github.com/demotomohiro/littlesugar
21:36:18FromDiscord<Elegantbeef> In the world of macros anything is possible 😛↵(@mattrb)
21:38:49FromDiscord<mattrb> In reply to @demotomohiro "Incrementing with `arr[1] +=": Actually, my intuition would be that `arr[0] += 1` is actually just sugar for `arr[0] = arr[0] + 1`, which wouldn't break my intuition since it's a set rather than a get operation on the array, which I _would_ assume behaves that way
21:39:22FromDiscord<Elegantbeef> I mean it is
21:39:44FromDiscord<Elegantbeef> and `inc(arr[0])` is sugar for `arr[0] = arr[0] + 1` 😛
21:40:56FromDiscord<mattrb> Isn't `inc` a proc though?
21:41:03FromDiscord<Elegantbeef> so is `+=`
21:41:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SHz
21:41:49FromDiscord<demotomohiro> @Elegantbeef, Why view type is not implemented as library when anything is possible in the world of macros?↵https://nim-lang.org/docs/manual_experimental.html#view-types
21:41:49FromDiscord<Elegantbeef> Which means "successive value" or in the case of integers `val + 1`
21:42:09FromDiscord<mattrb> Which is still unintuitive to me then, since it's accessing a value from an array then passing it to a proc. I would have assumed the array access would always copy
21:42:14FromDiscord<Elegantbeef> Cause it's easier and more intuitive to implement in compiler
21:42:15*wyrd quit (Ping timeout: 240 seconds)
21:42:33FromDiscord<Elegantbeef> Well it only copies on assignment for optimizations and feature reasons↵(@mattrb)
21:42:57FromDiscord<Mysterysib> Is there an auto null I can define globally?
21:43:14FromDiscord<mattrb> It's unintuitive to me that array access copies on assignment (even to a `var` variable), but not on calling a proc with a `var` parameter
21:43:32FromDiscord<mattrb> I think the fact that those behave differently is the root of my confusion
21:43:36FromDiscord<demotomohiro> C++ has container types that a[x] returns reference not copy.
21:47:49FromDiscord<mattrb> In reply to @Elegantbeef "In the world of": How would you address this with a macro?
21:49:24*wyrd joined #nim
21:50:53FromDiscord<demotomohiro> `var x: int` and arr[1] are both locations somewhere in the memory. So they can work same way.
21:54:06FromDiscord<mattrb> But `var x = arr[1]` is a copy of `arr[1]`, so if I want to the mutate x, I'll need to stick it back in the array when I'm done
21:54:26FromDiscord<Elegantbeef> Well except when view types exist
21:57:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SHG
21:57:54FromDiscord<Elegantbeef> Nim has declarative mutability which informs dispatch on what procedure to call to give us reference properties, it's hard to do it any other way
21:59:13FromDiscord<demotomohiro> Maybe `with` module can help you.↵https://nim-lang.org/docs/with.html
22:00:03FromDiscord<Elegantbeef> Well it's quite simple anything that takes a `var T` either mutates that or returns from it
22:00:29FromDiscord<Elegantbeef> I dont see how `with` helps
22:00:51FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=3SHI
22:01:11FromDiscord<demotomohiro> `byAddr` can be dangrous whe you use it to a element of seq or string.
22:01:28FromDiscord<mattrb> I'm currently building a lox interpreter in nim. I'd be curious to have some input when I'm done on how I could make it more idiomatic
22:01:29FromDiscord<Elegantbeef> Well yea it's an unsafe version of `views`
22:01:52FromDiscord<mattrb> But it's in the stdlib, which makes it a better version of views 👀
22:02:16FromDiscord<Elegantbeef> Views is in the compiler?
22:02:17FromDiscord<Elegantbeef> It's an experimental flag to get a borrow checker
22:02:39FromDiscord<mattrb> Ah, just behind a flag. Got it
22:02:53FromDiscord<demotomohiro> View types is much safer than `byAddr` but experimal.
22:03:31FromDiscord<Elegantbeef> Yea views is like Rust's borrow checker, allowing some nicer APIs
22:03:58FromDiscord<Elegantbeef> Dont need things like `byaddr` when you have a view
22:06:13FromDiscord<mattrb> Using byAddr allowed for this at least, which is nice. Haven't looked at the output, but I'd imagine it's better optimized too since it doesn't have to index off of the array constantly https://gist.github.com/mattrberry/040dd950e9e9caffbc3103ef327a9578
22:07:38FromDiscord<Elegantbeef> is frame supposed to be static?
22:08:34FromDiscord<mattrb> At the moment, since I haven't implemented function calls :p
22:09:40FromDiscord<Elegantbeef> Is that supposed to run until no more frames?
22:12:13FromDiscord<mattrb> It will run until returning from the top-level function, defined by the first CallFrame in vm.frames
22:12:32FromDiscord<Elegantbeef> ah was wondering if we could just use a iterator
22:13:21FromDiscord<mattrb> The callframes are a stack that the vm will push and pop to. Would probably be weird to lay an iterator over that
22:13:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SHP
22:15:10FromDiscord<Elegantbeef> It's the same as the byaddr i guess just without using byaddr/decls 😛
22:16:57FromDiscord<demotomohiro> Using iterator without loop looks strange but looks good.
22:17:24FromDiscord<Elegantbeef> Yea it's kinda a hack of course
22:21:54FromDiscord<mattrb> Thanks for the help today, as usual :)
22:33:52FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3SHT there we go a less hacky version \:PO
22:48:17*kayabaNerve quit (Ping timeout: 240 seconds)
22:58:26*arkurious quit (Quit: Leaving)
23:16:38FromDiscord<Girvo> Morning all
23:16:57FromDiscord<Elegantbeef> Afternoon
23:17:43FromDiscord<Girvo> I'm likely ahead of you time-wise, so my time is more correct than yours 😉
23:18:05FromDiscord<Elegantbeef> Time is a construct of man only the sun knows which is more accurate
23:18:42FromDiscord<Girvo> Haha not wrong
23:18:47FromDiscord<abdu> How do we do inserted body block of argument in macro ?↵just like inserted body block of template on: `template foo( i:int, codes:untyped) =`↵Please help!
23:21:07FromDiscord<Elegantbeef> `template foo( i:int, codes:untyped) = codes`
23:38:46NimEventerNew question by itil memek cantik: Do some insertion of body block of argument in macro, see https://stackoverflow.com/questions/71520262/do-some-insertion-of-body-block-of-argument-in-macro
23:39:38FromDiscord<Girvo> Does anyone know what the performance implications of `pegs` are? I wonder if it's suitable for my embedded use-case for parsing some AT command responses. Might not even need it really, it's mostly `CRLF` line separated data
23:40:58FromDiscord<mattrb> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=3SHT there we go": Seems like play.nim-lang.org is down :/
23:46:49FromDiscord<Elegantbeef> I think it's' generally efficent, best thing would to be to benchmark it↵(@Girvo)
23:47:06FromDiscord<Elegantbeef> Yea @mattrb https://wandbox.org use this for now