<< 05-06-2023 >>

00:02:07*beholders_eye quit (Ping timeout: 240 seconds)
00:25:40*def- quit (Quit: -)
00:25:52*def- joined #nim
00:48:08*oprypin quit (Ping timeout: 240 seconds)
00:54:23*xet7 quit (Quit: Leaving)
01:00:42FromDiscord<auxym> In reply to @Arathanis "just anything stack only": basically you can't use seqs, strings and refs at all, which therefore also excludes a good chunk of the stdlib. You can use stack-allocated values, including arrays, and for heap allocation you can use `alloc/alloc0`, `dealloc` (free), pointers and `UncheckedArray`. Not really recommended tbh.
01:03:13FromDiscord<Arathanis> In reply to @auxym "basically you can't use": i was thinking more if you were doing embedded with extremely limited resources what the ramifications of --gc:off would be
01:04:29FromDiscord<Arathanis> i guess is --gc:none, not --gc:off
01:04:54FromDiscord<auxym> well, what I said. no strings/seqs/refs, and enjoy using C-style alloc/free and pointers. There's little reason though, ARC works great on embedded, as long as you are careful where you are allocating
01:05:04FromDiscord<SkynWalker> Guys is there an isPrime proc anywhere I didnโ€™t find one in math
01:05:15FromDiscord<auxym> (eg don't alloc/free a thousand times in a loop)
01:06:19FromDiscord<auxym> In reply to @SkynWalker "Guys is there an": there's an optimized sieve algorithm implementation in https://nim-lang.org/blog/2021/07/28/Nim-Efficient-Expressive-Elegant-Benchmarking.html
01:06:57FromDiscord<SkynWalker> Ngl gang idk what all that means but ty
01:07:17FromDiscord<SkynWalker> Imma take a look
01:07:45FromDiscord<auxym> sieve of erasthothenes is an algorithm to check if a number is prime: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
01:09:56FromDiscord<SkynWalker> Nice ty
01:20:13FromDiscord<auxym> In reply to @SkynWalker "Nice ty": also check out https://rosettacode.org/wiki/AKS_test_for_primes#Nim
01:20:55FromDiscord<SkynWalker> Nvm I just made my own lol
01:20:59FromDiscord<SkynWalker> Ty tho
02:32:33termerI'm trying to work with the IUP (https://github.com/nim-lang/iup) Nim wrapper right now, and it looks like it needs the IUP shared library to be installed on my system. Is there any way to link statically against the .so file so that my final binary will contain everything needed to run without requiring a .so somewhere?
02:32:50termerI'm not very familiar with linking to libraries in Nim, and definitely not in C (I was never a C developer)
02:46:07FromDiscord<Graveflo> I think you need a library file instead of the shared library. Instead of .so it should say .a
02:47:11FromDiscord<Graveflo> Also you can compile from code with the `compile` pragma. Check the compiler switches and pragmas on the nim website for details on how to link
02:47:56FromDiscord<Elegantbeef> Just use https://github.com/neroist/uing
03:11:04FromDiscord<demotomohiro> @termer This article would help you to understand how to use a static library: https://internet-of-tomohiro.netlify.app/nim/clibrary.en.html
03:13:16termerI'll take a look, thanks
03:24:22*beholders_eye joined #nim
03:50:17FromDiscord<Arathanis> does nim have some kind of importlib where I can define imports/includes using const variables?
03:52:26FromDiscord<Elegantbeef> God that's awful
03:52:30FromDiscord<Elegantbeef> Just make a module that imports and exports them
03:54:43FromDiscord<Elegantbeef> Unless you mean like "Import the entire directory"
03:55:26FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xv8
03:56:26FromDiscord<Elegantbeef> Does that not work?
03:56:39FromDiscord<Elegantbeef> Ah nvm i see the issue
03:56:39FromDiscord<Arathanis> it works, I just wnat to be able to have a single place with the name
03:56:57FromDiscord<Arathanis> maybe write a macro that hands this entire construct for me
03:57:06FromDiscord<Elegantbeef> How many times do you need this?
03:57:11FromDiscord<Elegantbeef> Just make this a module and import it ๐Ÿ˜„
03:57:43FromDiscord<Arathanis> make it a module, export the wrapped functions, and just import where i need it?
03:57:54FromDiscord<Arathanis> also: https://media.discordapp.net/attachments/371759389889003532/1115127328138334298/image.png
03:58:06FromDiscord<Arathanis> why the heck is this undefined its in the docs, was it removed and the docs not updated?
03:58:36FromDiscord<Elegantbeef> Why not, gotta be less horrendous than your suggestion
03:59:20FromDiscord<Arathanis> just wanted to clarify what you were suggesting
04:00:32FromDiscord<Elegantbeef> It's basically what i do for wasm3 https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim
04:21:48*beholders_eye quit (Ping timeout: 265 seconds)
04:27:35FromDiscord<huantian> Beef rq idea that I have a bit more fleshed out in my head, but thoughts on a macro that can check procs that take new concepts as parameters for any procs that might not be defined in the concept, by creating an object with the dummy procs defined by the concept
04:27:38FromDiscord<huantian> Idk if that makes sense
04:28:18FromDiscord<huantian> But it would allow you to like make sure you didnโ€™t misspell a proc name or use a proc that the concept didnโ€™t guarantee without having to instantiate the peoc
04:28:48FromDiscord<Elegantbeef> You're basically talking about constrained concepts
04:28:53FromDiscord<huantian> Yes
04:29:16FromDiscord<Elegantbeef> That works for new style concepts, not so much for old style
04:29:16FromDiscord<huantian> It would be constrained concepts using current infra and opt in per proc
04:29:24FromDiscord<huantian> Yeah I donโ€™t think itโ€™d work for old style
04:29:31FromDiscord<huantian> Unfortunately
04:29:39FromDiscord<Elegantbeef> It's not too bad you only have to implement a type/proc per concept
04:30:18FromDiscord<huantian> Somewhat viable idea right?
04:30:44FromDiscord<Elegantbeef> Yea I do a similar thing for traitor
04:31:12FromDiscord<Elegantbeef> you just need to cache the instantiated type and it's procedures
04:31:12FromDiscord<huantian> I think it could be helpful to make concepts more ergonomic for certain usecases
04:32:28FromDiscord<huantian> Donโ€™t know how itโ€™d work if the concept or proc had a generic argument though, or like a typeclass argument
04:32:55FromDiscord<Elegantbeef> The more concerning thing is `proc doThing[T: Concept]`
04:33:55FromDiscord<Elegantbeef> In your case if it's an unconstrained generic you can just instantiated an `uint8` or sometheing
04:34:37FromDiscord<Elegantbeef> If it's constrained you can implement the first `or` branch if there is one, otherwise just do nothing
04:34:56FromDiscord<Elegantbeef> Like `X and Y` is a constraint that's hard to implement
04:35:35FromDiscord<huantian> Hmm
04:36:54FromDiscord<huantian> Also, would you want to do the check in the scope the proc is declared in, or does that compromise the process
04:37:25FromDiscord<huantian> Because then youโ€™d be able to use other procs you defined for your concept in the current checked proc
04:38:23FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/rYmVn
04:38:29FromDiscord<Prestige> Just checking before I try implementing this on my own, are there any existing libraries that implement Fortune's algorithm for voronoi diagrams?
04:38:50FromDiscord<Elegantbeef> Just cause you say fancy words doesnt make you fancy
04:39:18FromDiscord<Prestige> :(
04:39:33FromDiscord<Elegantbeef> I joke cause i have no idea
04:39:44FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=4xvd
04:40:52FromDiscord<huantian> But what if yourProc calls foo(arg) inside of itself, and previously in the scope you define foo(arg: object)
04:41:29FromDiscord<Elegantbeef> What you're constraining on a generic if an implementation doesnt allow compilation that's a bug
04:42:07FromDiscord<huantian> Then the check succeeds, because you use an object , but would fail at instantistion for a int that fits the concept
04:42:36FromDiscord<Elegantbeef> Right, the only way to know if a generic compiles is to attempt to call it for every single type
04:43:06FromDiscord<demotomohiro> In reply to @Avahe "Just checking before I": Did you check this? https://github.com/ringabout/awesome-nim
04:46:42FromDiscord<huantian> In reply to @Elegantbeef "Right, the only way": Right so we could guarantee the proc works if itโ€™s just the concept
04:46:49FromDiscord<huantian> But as soon as we add generics it falls apart
04:47:16FromDiscord<Elegantbeef> The is of course one of the issues with mixins over traits
04:48:26FromDiscord<Elegantbeef> Traits explicitly state "this is required for this interface and only works for this", so they're more concrete but also way less reusable
04:48:56FromDiscord<Elegantbeef> If a third party type does not implement a trait you have to make your own distinct type to have it work
04:50:19FromDiscord<huantian> Yeahhh
04:50:33FromDiscord<huantian> I wish there was a way to get the best of both worlds
04:53:19FromDiscord<Graveflo> Why would you use an overly specific trait then?
04:55:44FromDiscord<Prestige> In reply to @demotomohiro "Did you check this?": haven't found it so far on there
04:56:21FromDiscord<SkynWalker> Hey guys how do I do ^ on 4 digit numbers without running out of memeory
04:56:24FromDiscord<SkynWalker> Memory
04:57:47FromDiscord<huantian> Maybe the macro check could still be helpful if it just worked on new concepts and approximated unconstrained generics
04:59:38FromDiscord<Elegantbeef> I mean AFAIK rust traits require being implemented on type declarationโ†ต(@Graveflo)
05:04:02FromDiscord<Graveflo> It's weird to me how concepts are thought of as near duck typing and near interfaces at the same time. Those two things are on the opposite side of the room imo. I think concepts work better for duck typing scenarios.
05:04:48FromDiscord<Elegantbeef> They work for both really
05:06:57FromDiscord<Elegantbeef> You can use them for interfaces the same way you can use a rust trait dynamically
05:07:15FromDiscord<Elegantbeef> As long as you know the type matches you can bind the procedures to a vtable and life the type to a ref
05:07:24FromDiscord<Elegantbeef> I know this is true cause my traitor library exists ๐Ÿ˜„
05:07:25FromDiscord<SkynWalker> Does anyone know how to factor large numbers without running out of memory
05:07:33FromDiscord<Elegantbeef> Get smaller numbers
05:08:21FromDiscord<Graveflo> isn't factoring large numbers one of those things that are quintessentially difficult for a computer to do
05:08:40FromDiscord<SkynWalker> ๐Ÿ˜ž๐Ÿ˜ž๐Ÿ˜ž
05:09:20FromDiscord<Elegantbeef> My abacus isnt much better
05:09:41FromDiscord<demotomohiro> In reply to @SkynWalker "Does anyone know how": I think this is what you want: https://github.com/nim-lang/bigints
05:10:06FromDiscord<Graveflo> I don't know much about it off the top of my head but I can assure you that there has been quite a lot of research on that topic. If you figure out how to do it too well you might break the bank
05:12:48termerElegantbeef, "Just use https://github.com/neroist/uing" I just got finished catching up with messages
05:12:51FromDiscord<demotomohiro> bigints seems doesn't have factorization.
05:12:55termerI can't use this because I need to support Windows XP
05:13:15termerit's a very weird application
05:13:38termerbasically it's an application targeting Linux and XP or later
05:14:14FromDiscord<Arathanis> whats the difference between std/async and std/asyncdispatch?
05:14:59termerI had no idea std/async existed
05:15:12termerit looks like it exports a bunch of things from asyncdispatch
05:15:16FromDiscord<Arathanis> me either, until just a moment ago
05:15:25FromDiscord<Arathanis> In reply to @termer "it looks like it": it seems to import std/asyncmacros and std/asyncfutures
05:15:49termeroh, it uses either asyncjs or asyncmacro and asyncfutures
05:16:01termerwould be nice if someone bothered to actually document that
05:16:04FromDiscord<demotomohiro> Are there people on this planet who still use WindowsXP and developing app for it?
05:16:15FromDiscord<Graveflo> yes. not i but yes
05:16:31FromDiscord<Arathanis> In reply to @termer "oh, it uses either": seems like you figued out the difference? can you demystify it for me? :P
05:16:33FromDiscord<Graveflo> I've been there are feel your pain btw
05:16:53termerNo need to demystify, just look at the source https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/async.nim#L1
05:17:17termerdemotomohiro, I'm building a game launcher for a website of retro PC game enthusiasts
05:17:32termerso I have to support basically every version of Windows past the year 2003 lol
05:17:38FromDiscord<Arathanis> so what is asyncmacros for as compared to asyncdispatch O-o?
05:17:54termerasyncmacro is await
05:18:03termerand {.async.}
05:18:17FromDiscord<Arathanis> ohhh asyncdispatch literally includes asyncmacros
05:18:19FromDiscord<Arathanis> doesnt even import
05:18:20termerasyncdispatch is the event loop
05:19:03FromDiscord<Arathanis> so std/async is all the async without the stdlib implementation of the event loop
05:19:15FromDiscord<Arathanis> so you could use chronos instead for example?
05:19:31termerno, what it does is:
05:19:37termerif you're targeting JS, imports asyncjs
05:19:47termerif not, imports asyncmacro and asyncfutures
05:19:56*derpydoo quit (Ping timeout: 250 seconds)
05:20:13FromDiscord<demotomohiro> @termer supporting every version of windows sounds very hard.
05:20:17FromDiscord<Arathanis> i guess im just not understand when you would use it as opposed to asyncdispatch
05:20:38termerdemotomohiro, Well, Windows has decent backwards compatibility, and I already know Nim runs on XP
05:21:30termerArathanis, It would have been nice if this was documented, but I assume this is for procs that aren't directly interacting with the event loop, like some async utils that you want to share between a JS and native project
05:22:02FromDiscord<Arathanis> ohhh ok, i think that is a solid assumption
05:22:09FromDiscord<Arathanis> some documentation in the lib for what it is for would be nice though
05:22:23termergo ahead and submit a PR, as Araq says
05:23:34FromDiscord<Arathanis> just gotta figure out exactly what it is for first, though i think you are right. its for writing async code that need not care about the event loop
05:23:39termerover time I've realized that Nim is exceptionally good for projects with bizarre requirements, but painful for things like a typical webapp
05:23:41FromDiscord<demotomohiro> @termer I saw PRs on Nim github repo for supporting XP. I thought there are very few people still use XP. But it seems wrong.
05:23:53termerThere are very few people using it
05:24:00termerbut some people do for various reasons
05:24:24termerand at this point it's one of the few modern languages you can use for XP, besides recent versions of C++ using GCC
05:24:33termerGCC and MinGW actually still support XP
05:26:06FromDiscord<Graveflo> not that python is in the same vicinity as a language like C but python 2.7 runs on XP also
05:26:36termerI suppose, but I'm sure as hell not dealing with pip
05:27:00FromDiscord<Arathanis> only psychopaths deal with raw pip
05:27:19FromDiscord<Elegantbeef> You're telling me python has something more than a "requirement.txt"?
05:27:20FromDiscord<Graveflo> poor pip ๐Ÿ˜ฆ
05:27:31FromDiscord<Arathanis> In reply to @Elegantbeef "You're telling me python": yes
05:27:31termerrequirements.txt is what pip uses
05:27:33termerit's absurd
05:27:39termerit CAN use other things
05:27:41FromDiscord<Arathanis> requirements.sad
05:27:58termerit's seriously the worst dependency management system I've seen in my entire life
05:28:14termermy success rate for getting a python project with pip running is probably below 50%
05:28:27termerI don't have the deep hidden knowledge of the language and tooling to fix bizarre dependency conflicts
05:28:32FromDiscord<Graveflo> I'm curious what the hang up is
05:28:42termerconflicts with dependency versions
05:28:47termerbecause guess what, there's no lockfile
05:28:53FromDiscord<Arathanis> not using virtualenvs?
05:29:03termerI use venvs when I'm told how to
05:29:05termerI'm not a python developer
05:29:09FromDiscord<Arathanis> fair
05:29:22FromDiscord<Arathanis> but yeah, requirements.txt is not the way lol
05:29:43termernimble also has the lack of lockfile problem, but nim projects tend to use very few dependencies relative to what you see in the python world
05:29:47termerso it's rarely an issue
05:29:52termerI'd like to see wider use of atlas though
05:30:20FromDiscord<Arathanis> i wish `atlas` came with `choosenim devel`
05:30:32FromDiscord<Arathanis> ive only gotten it by manually building the 2.0 preview off the tagged branch
05:30:52termerthat'd be nice
05:31:00FromDiscord<Elegantbeef> Maybe with nim2.0 people will use gitnim and atlas more
05:31:13FromDiscord<Arathanis> im not aware of gitnim
05:31:22FromDiscord<Elegantbeef> It's choosenim but with style
05:31:51FromDiscord<Elegantbeef> Dont even need curl to install it, you just clone a git repo and then build it
05:32:01FromDiscord<Elegantbeef> then suddenly you an do `git nim devel`
05:32:09FromDiscord<Graveflo> I've been hoping that I like atlas because nimble seems to work well but I don't know what it's doing sometimes. I had to mess around quite a bit to get my packages to see eachother without complaints
05:32:26FromDiscord<Graveflo> I'd like to just do a deep dive and learn one of them
05:32:30termerthe way it structures package directories is a nightmare
05:32:38termerit gets really bad once you're using git submodules
05:32:46termerand basically anything that depends on a path relative to the project root
05:32:59termeryou'd think they could just git clone your repo and be done with it
05:33:03termerbut nimble does all sorts of fuckery
05:33:22FromDiscord<Elegantbeef> I find it that nimble gets worse as time goes on
05:33:31FromDiscord<Arathanis> ill have to try gitnim
05:33:33FromDiscord<Arathanis> i found the repo
05:33:35termerthe fact that it doesn't have a lockfile is already a problem
05:33:45termerI always require all my dependencies by git hash because of that
05:33:51FromDiscord<Elegantbeef> Meh I do not find that really useful ime
05:33:52termeronly way to ensure I always get what I need
05:34:00FromDiscord<Elegantbeef> I properly use semver cause i'm not a silly billy
05:34:16termerI'm talking transitive dependencies too
05:34:21termerthat's the real point of a lockfile
05:34:27FromDiscord<Elegantbeef> I know it gets reproducible builds, but that's not even where i run into troubles
05:34:48FromDiscord<Elegantbeef> I'm using `nimble develop --global` and there is no way to uninstall a package
05:34:56FromDiscord<Arathanis> so beef, sell me on gitnim. How is it better than choosenim?
05:35:12termerElegantbeef, lol what
05:35:25FromDiscord<Elegantbeef> You cannot uninstall a globally linked package afaict
05:35:31FromDiscord<Elegantbeef> You have to manually delete the link file
05:35:55termeralso I can't see how a new choosenim will be any improvement considering choosenim basically has two commands: "choosenim devel" "choosenim stable"
05:36:02FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1115152024066084874/image.png
05:36:02FromDiscord<Elegantbeef> Or this travesty
05:37:05termerthat's awesome
05:37:26FromDiscord<Elegantbeef> I just want to uninstall gooey, but no I'm not allowed to
05:37:46termerit's too gooey and sticky to remove
05:37:50termeryou just have to live with it now
05:38:10termerok so I've got another thing I've wanted to find out
05:38:19termerI've heard the -d:openssl ships with a hardcoded list of CAs
05:38:20termeris that true
05:38:47termerbecause while that would be terrible in most cases, that'd actually be awesome for my WinXP client
05:38:57termersince it probably doesn't have the necessary CAs on the system
05:39:17*derpydoo joined #nim
05:39:51FromDiscord<Elegantbeef> On linux it uses your systems no?
05:39:52FromDiscord<Elegantbeef> On windows you need to ship a file
05:40:02termerhmm
05:40:09FromDiscord<Arathanis> In reply to @Elegantbeef "I just want to": `rm -rf $(nimble path gooey)`
05:40:18FromDiscord<Arathanis> ๐Ÿ˜Ž
05:40:20FromDiscord<Graveflo> wait windows XP has security features?
05:40:22FromDiscord<Elegantbeef> Ah yes a package manager
05:40:22termerit statically links against openssl also, right?
05:40:32FromDiscord<Elegantbeef> Nope
05:40:36termerwell shit
05:40:41FromDiscord<Elegantbeef> You have to manually statically link openssl
05:40:51termerI need to find a way to support modern TLS
05:40:57FromDiscord<Elegantbeef> Use status' bearssl bindings
05:41:03termerI was looking into that
05:41:07termerit seemed promising
05:43:02termerSince I'm not touching any significant outside libraries, this project will probably be a good opportunity to properly give chronos a try
05:43:10termerI can actually use arc if I want given the fact that it doesn't have cycles
05:43:39termerI used to think cycles were a fact of life until I realized Rust doesn't even protect you from them, so people writing software in Rust just have to not write cycles
05:43:46termerif they can do it, so can we (I)
05:44:50FromDiscord<Elegantbeef> I mean cycle-less code is great, but just remember linked lists exist
05:45:01FromDiscord<Elegantbeef> Cycles are sometimes the lesser evil
05:45:15FromDiscord<Graveflo> linked lists dont have to be circularly linked
05:46:15FromDiscord<Graveflo> well thats a bad example bc breaking the head is as simple as tracking the tail but still graph structures only need circular structure when they need it
05:46:17FromDiscord<demotomohiro> @termer Even if you link C static library to your executable, it might not work on XP if it uses windows APIs not supported on XP but newer windows version.
05:46:18FromDiscord<Elegantbeef> Nim's doubly list linked is anyway
05:46:29termerdemotomohiro, I'm aware
05:46:56termerit should be fine
05:46:57FromDiscord<Elegantbeef> Some of Rust's design is encourages good code, but lack of cycles is just ugh
05:47:06termerI know at the very least that asyncdispatch works on XP
05:47:11termerchronos should also be ok
05:47:36termerElegantbeef, Just know where you're doing your cycles and have a system for handling them
05:47:45termerdoubly linked lists are not things I use very often at all
05:47:50FromDiscord<Elegantbeef> Lol
05:47:50termerin fact I can't remember the last time I used one
05:47:58termerat least in my own code
05:48:06termercan't say for 3rd party libs
05:48:08FromDiscord<Elegantbeef> I just brought them up as an example
05:48:46FromDiscord<Graveflo> It's not a good feeling to avoid cycles when they are nice to use but it's also easy to realize that your doing it. They aren't hard to avoid unless you are really stuck
05:48:51FromDiscord<Elegantbeef> I of course avoid cycles for sanity reasons, but if I need them I'm not going to avoid cycles
05:51:00termerright, no reason to completely abandon them
05:51:10termerbut I'd rather stick to ARC as much as possible since ORC is just horrible in its current state
05:51:16termerORC leaks so much
05:51:27FromDiscord<Elegantbeef> I dont think it technically leaks
05:51:31termerno, it does
05:51:38termerat least when using asyncdispatch
05:51:42FromDiscord<Elegantbeef> Proper leaks or just not freeing memory
05:51:52termerexplain the difference
05:51:54FromDiscord<Elegantbeef> I use orc for my game and have a steady like 40mb of memory usage
05:52:02termermemory keeps going up and is never freed
05:52:06FromDiscord<Elegantbeef> Leaking is when the memory is actually lost and not freeable
05:52:19FromDiscord<Elegantbeef> Not freeing memory means the memory is still accessible just not returned
05:52:21termerI don't think it's freeable because I don't have access to it
05:52:35termerit's not like I'm filling up and array or hashmap and forgetting to delete stuff
05:52:35FromDiscord<Elegantbeef> You do not need access to it
05:52:48FromDiscord<Elegantbeef> It's just if the memory management knows about it
05:52:51FromDiscord<Graveflo> yea if it freed the memory as soon as you couldnt access it it'd be arc
05:53:15FromDiscord<Elegantbeef> If the cycle collector knows about the memory and can free it, it's not technically a leak
05:53:38FromDiscord<Elegantbeef> I dont thread or use async so my memory under orc is fine
05:53:41FromDiscord<Graveflo> but that is also a good reason to avoid orc if you have trust issues bc testing for leaks would be a bugger
05:53:50termerwell, it's either a leak or ORC's logic is so fucked up that it chooses to hang onto 12GiB of memory for hours and never free it for a simple webserver
05:54:04FromDiscord<Graveflo> ok thats not normal I hope
05:54:04FromDiscord<Elegantbeef> It's not that hard to check grave just `-d:useMalloc` and valgrind
05:54:17FromDiscord<Elegantbeef> devel or stable?
05:54:20termerboth
05:54:35termerthis was something I was testing a lot last month that ultimately ended with me giving up using Nim for my project
05:54:42termerI'm not a C dev so I have a hard time understanding valgrind
05:54:52termerespecially in async where things are really hard to understand already
05:55:02termercall stacks really don't mean anything at that point
05:55:12FromDiscord<Elegantbeef> It's not complicated memcheck says explcitly how many blocks of memory were returned
05:55:18FromDiscord<Elegantbeef> I'm not a C dev either ๐Ÿ˜›
05:55:19termerThe issue was definitely inherent to ORC though, since it's not an issue with refc
05:55:47termerperhaps someday I'll return to it
05:56:00termerbut my resolve is now firmly to use chronos if I ever bother with async under Nim again
05:56:21termerno need to worry about ORC if you barely have any cycles to begin with
06:34:55*ntat joined #nim
06:38:36FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xvt
06:39:48FromDiscord<mratsim> In reply to @termer "I used to think": Swift has a disclaimer about that xD
06:40:18FromDiscord<mratsim> In reply to @termer "nimble also has the": There are lockfiles since last year
06:40:42FromDiscord<mratsim> Probably not documented or advertised though
06:40:45FromDiscord<Elegantbeef> @Graveflo\: that looks like a big ol' error in the process
06:41:23FromDiscord<mratsim> https://github.com/status-im/nimbus-eth2/blob/stable/nimble.lock
06:41:28FromDiscord<Elegantbeef> What's the point of using `ref` if you're wanting `ptr T`?
06:41:31termermratsim, "Probably not documented or advertised though" And this is why I'm still finding new Nim features after using it for 3 and a half years
06:41:57FromDiscord<Elegantbeef> You have a dangling pointer
06:42:35FromDiscord<Graveflo> I get that because main returned `Book` but if it didn't it should be safe. I just don't know why it works. It doesn't crash
06:42:42termermratsim, Does your eth client support proof of stake with the new network and everything
06:42:53termerI'm not an ethereum user but I'm curious
06:42:56FromDiscord<Elegantbeef> Give me a second I'll make it crash
06:43:28FromDiscord<Graveflo> This is the... questionable way I have been trying to make an object not care if it is encapsulating a stack allocated object or a heap allocated object
06:43:32FromDiscord<mratsim> In reply to @termer "<@570268431522201601>, Does your eth": Yes, it's one of the main Ethereum proof-of-stake clients. From the very beginning in Dec 2020
06:43:38termersweet
06:43:59FromDiscord<mratsim> Also the one that uses the less memory (2x less than Rust and 3x less than Go)
06:43:59FromDiscord<Elegantbeef> There you go it errors
06:44:02FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/nwVoR
06:44:08termerI'm still amazed you're at least somewhat enthusiastic about Nim after having to roll your own async I/O lib
06:44:13termerand everything else
06:44:16FromDiscord<mratsim> Anf that sync the fastest
06:44:26FromDiscord<Elegantbeef> A generic or an object variant is the only way to do that grave
06:44:26termerno idea how status even began using Nim in the first place
06:44:31FromDiscord<Elegantbeef> Unsafe code is unsafe
06:44:36FromDiscord<mratsim> In reply to @termer "I'm still amazed you're": Rolling your own async was due in part to cycles issues in asyncdispatch ๐Ÿ˜‰
06:44:50FromDiscord<mratsim> In reply to @termer "no idea how status": CEO is a tinkerer ๐Ÿ˜‰
06:44:54FromDiscord<Graveflo> ok I was wondering if it was just some sort of lagging. Looks like I was too dumb to trick the compiler after all
06:44:56termerapparently lol
06:45:07termersounds like the kind of ballsy tech choice I would have made a couple of years ago
06:45:14FromDiscord<Elegantbeef> You just made a dangling pointer and then never wrote to the memory
06:45:19FromDiscord<Elegantbeef> You have a stack address
06:45:19termerI'm surprised it uses less than the Rust one
06:45:34FromDiscord<Elegantbeef> Since you didnt call a proc afterwards the stack was 0'd and you got an empty string
06:45:35termernot that there's anything inherently more performant or efficient about either lang
06:46:38FromDiscord<Graveflo> oh right. that makes perfect sense. At some point I'm going to investigate or try to make a way to tell the mm to auto zero memory for certain secure structures but yea I wasnt considering that the data was just hanging out right where it was
06:46:49FromDiscord<Elegantbeef> I'm absolutely confused why you do not just use a generic or a variant here ๐Ÿ˜„
06:46:55FromDiscord<Elegantbeef> Or just make `MyObject` always a ref
06:47:10FromDiscord<Elegantbeef> If you say "binary size" I'm going to come over there and slap you
06:47:11FromDiscord<mratsim> sent a long message, see http://ix.io/4xvw
06:47:49termerI've seen some big things written in Clojurescript
06:47:51FromDiscord<Elegantbeef> Now only if i had marketable skills and status wasnt crypto related
06:47:59termernever understood why people would bother with it, but whatever
06:48:00FromDiscord<mratsim> I think the Rust one needs to allocate a lot for async futures.โ†ตโ†ตZero-cost alloc doesn't mean shit if your futures have to survive
06:48:10FromDiscord<Graveflo> Okay this has been weighing on my mind. I don't know when nim is going to create duplicates of my procs. The more generics I use the more I feel like I am bloating the hell out of my executable. SLAP ME IF YOU CAN
06:48:30termerTalking to some Rust people, I heard their futures are on the stack
06:48:34FromDiscord<mratsim> In reply to @Graveflo "Okay this has been": Read on monomorphization
06:48:36termermaybe I misunderstood
06:48:46termerbut Nim's have always been heap objects which turned me off to it
06:48:49FromDiscord<Elegantbeef> It will bloat the executable but not nearly as much as you think
06:49:01termerI've personally always wanted Kotlin-like coroutines in Nim
06:49:18FromDiscord<mratsim> In reply to @termer "Talking to some Rust": They are, but if you don't await the future in the creating scope you need to put them on the heap
06:49:25FromDiscord<Elegantbeef> It's not going to shit endlessly on your small embedded memory
06:49:36*PMunch joined #nim
06:49:39FromDiscord<mratsim> And in the scheduler (Tokio or async std) you need them on the heap to pass to other threads
06:49:40FromDiscord<Elegantbeef> You only use a few instances of a generic anyway
06:50:03termermratsim, That makes sense. I figured something like that would have to happen since there's no way you can keep a stack object around in other cases
06:50:20FromDiscord<mratsim> I like kotlin coroutines as well, god design
06:50:24FromDiscord<mratsim> Good
06:50:31FromDiscord<Elegantbeef> Why not both
06:50:42termerWhen I learned how Kotlin coroutines worked, I thought "why isn't every lang doing this"
06:50:48termerI used Kotlin before Nim
06:51:01termerbut only learned how its coroutines worked in the past year
06:51:19FromDiscord<Elegantbeef> It's odd that kotlin can have good designed APIs given it's a bitch and a half to read bytes ๐Ÿ˜›
06:51:32termerit's not hard to read bytes in kotlin
06:51:35FromDiscord<mratsim> Maybe when crypto makes 1000x and I can retire, I'll follow up on my coroutines/async/continuations research: https://github.com/mratsim/weave-io-research/blob/master/research/README.md
06:51:40termernot sure where you're getting that from
06:51:47FromDiscord<mratsim> Might even hire @ElegantBeef to write macros
06:52:00termermratsim, Then I sure hope it goes TO THE MOON
06:52:17FromDiscord<Elegantbeef> BE to LE and vice versa is a ballache from my recollection helping my friend
06:52:22termerI hate 90% of crypto and tolerate 5%, liking the other 5%
06:52:30termerEthereum is one of the ones I tolerate
06:53:07FromDiscord<mratsim> In reply to @termer "<@570268431522201601>, Then I sure": The issue is that for technologists it's better to build when crypto is down. Less hype, less marketing, only genuine companies
06:53:28FromDiscord<Elegantbeef> Hiring me to write macros is like paying a crack addict to taste crack
06:53:30termerMakes sense
06:53:33FromDiscord<Elegantbeef> Wait you're telling me these bored toaster NFTs arent genuine?!
06:53:42termer"Hiring me to write macros is like paying a crack addict to taste crack" I laughed out loud
06:54:13PMunchYeah I felt that
06:54:48FromDiscord<Elegantbeef> Honestly there might be less sniffling and arm scratching with the crack addict
06:55:07termermratsim, I've always wondered with intellisense and basic IDE tooling looks like on a huge Nim codebase
06:55:16termerI've heard horror stories, like the guy working on Nim4UE
06:55:23termersaying nimsuggest basically doesn't work
06:55:25FromDiscord<Elegantbeef> Imagine writing C in 1968
06:55:30FromDiscord<mratsim> In reply to @termer "<@570268431522201601>, I've always wondered": nim check: off, nimsuggest: off
06:55:38termerLOL
06:55:42termerthat's a bitch
06:55:43FromDiscord<mratsim> I don't want to deal with jet engine
06:56:01FromDiscord<mratsim> Well nim check is better
06:56:13termerGo To Symbol almost never works for me on anything approaching a "big" codebase
06:56:14FromDiscord<Elegantbeef> Hey we're promised IC and nimbleh any year now
06:56:21termerthings start chugging once I added Chronos to the mix, for example
06:56:48termerdoes hot code reloading work, I've thought about using that to speed things up but I have a sneaking suspicion that it's either a myth or a legend
06:57:09termerI have no idea how it even works if it does exist
06:57:32FromDiscord<mratsim> Nimsuggest, meh,
06:57:38FromDiscord<mratsim> To quote Linkin Park
06:57:40FromDiscord<mratsim> I tried so hard and got so farโ†ตBut in the end, it doesnโ€™t even matterโ†ตI had to fall to lose it allโ†ตBut in the end, it doesnโ€™t even matter
06:57:51termer:|
06:57:55termeryou have a point
06:58:19FromDiscord<mratsim> So induction of new devs is a bitch
06:58:26FromDiscord<Elegantbeef> HCR doesnt
06:58:35FromDiscord<mratsim> Which is why there is someone on Status payroll for dev tooling
06:58:44FromDiscord<Elegantbeef> Just hire me to be the suggestion
06:58:55FromDiscord<Elegantbeef> "Yea that's an error, don't do that"
06:58:58FromDiscord<mratsim> We'll train elegantGPT
06:59:02termeryeah, who needs dev tooling when you're around to answer every question every single time I visit this channel
06:59:20FromDiscord<Elegantbeef> Maybe one day I'll get a life
06:59:27termeryou oughtta be paid
06:59:28termernot by me
06:59:32termerbut you oughtta be paid
07:00:09FromDiscord<Elegantbeef> The village idiot does it for the thril
07:00:18FromDiscord<Elegantbeef> thrill\
07:00:45termerit still blows my mind
07:00:47FromDiscord<mratsim> In reply to @Graveflo "Okay this has been": Same issue in C++ or Rust.โ†ตโ†ตCompilers have something called ICF for identical code folding to help vs that
07:01:21FromDiscord<Elegantbeef> I have considered setting up github sponsor or similar payment, but it just seems tedious to have to do taxes for it
07:01:31FromDiscord<mratsim> But the alternative is to hide all your types under a pointer (i.e. boxing) and having cache misses for everything.
07:01:36termeraccept crypto and pretend taxes don't exist
07:01:48FromDiscord<Elegantbeef> lol
07:01:57FromDiscord<Elegantbeef> Nah that goes against everything my little brain agrees with
07:02:34termerI disagree with taxation morally so I will tell people about the virtues of tax evasion without actually doing it myself, because I don't want to go to jail
07:02:35FromDiscord<mratsim> In reply to @Elegantbeef "I have considered setting": Same. Worst, nothing in French tax code is ready for donations, so Patreon/Ko-Fi and Github Sponsors don't know how to file taxes except by creating a company (for 5โ‚ฌ a month? Lol)
07:03:01FromDiscord<Elegantbeef> Well I disagree with the disagreement with taxation
07:03:13FromDiscord<Elegantbeef> Worst is I'm Canadian which has the same sort of tax protocol as the US ๐Ÿ˜›
07:03:16FromDiscord<Graveflo> In reply to @mratsim "Same issue in C++": yea that helps. I havent learned much about compiler design but I figured that getting to the bottom of how much I am paying for stuff like exponential generics would take a lot of knowledge. Especially when nim and C are likely both doing things of this nature. It's ok. I'll get over it I just need to act up first
07:03:32FromDiscord<Elegantbeef> So even these simple taxes are a pain in the arse cause fuck you use turbo tax
07:03:37FromDiscord<mratsim> Taxes are OK if they are used for healthcare, infrastructure, education. Not if they are squandered because some lobby allow Nestle to drain all the water in a region
07:03:40termerUnless you're targeting embedded hardware, don't worry so much about your generics
07:04:06termerlike mratsim said, if you want everything to be a single implementation, box everything
07:04:10termerbut you don't really want to do that
07:04:10FromDiscord<Elegantbeef> grave over here making dangling pointers to avoid generics ๐Ÿ˜›
07:04:17FromDiscord<Elegantbeef> Or just write swift
07:04:24termerif you want to get really funny, use "auto" for all your types and write entirely with type inference
07:04:37termerwrite your Nim like you write JavaScript
07:04:59FromDiscord<Elegantbeef> You forgot about using dot operators that discard incorrect field access
07:05:00termerit's almost entirely possible and yields some of the most confusing semantics you can imagine
07:05:05termerahahahaha
07:05:11termeryeah, how could I forget that
07:05:21termerdot macro that rewrites bad access
07:05:41termerwhat a disaster that would be
07:05:48FromDiscord<Elegantbeef> No helpful error just `"Expected expression for : a.b"`
07:06:11termersee this is why I'm always worried about working on Nim with someone else
07:06:28termerall it takes is one silly macro being introduced into the module you're working on for everything to stop making sense
07:07:20FromDiscord<Graveflo> Is this what's to show for the "expressiveness"
07:07:30termersometimes, yes
07:07:39termerI think expressiveness is overrated, although not to the degree Go believes that
07:07:54termerI *do* however like all the different ways to call Nim procs
07:08:06termerand, heresy alert, I also like style-insensitivity
07:08:20termerit means I can work with foreign libraries without their conventions clashing with my own
07:08:46termerI believe there are genuine benefits to this, not just stylistically
07:09:25FromDiscord<Graveflo> like what?
07:09:56termerthe ability to use other libraries without dealing with conforming to their style
07:10:26termeralso, when dealing with serialized data that came from, say, JSON, you can access the properties without having to switch to different cases
07:10:41termerlike cool_thing can be accessed as coolThing
07:11:09termerthis was personally helpful when I was writing a wrapper around the ffprobe CLI
07:11:10FromDiscord<Graveflo> wouldn't those be distinct dictionary keys in JSON?
07:11:24termeryes, but once you serialize them to an object, you can access them however you want
07:11:44termerit also helps when dealing with C libraries
07:11:49termerfor the same reason
07:12:01FromDiscord<Graveflo> Alright that's fair
07:12:15termerin theory it's a bad thing because of ambiguity, but in practice, it reaps far more rewards than problems
07:12:43termerPeople get hung up on the hypothetical problems without actually using it
07:12:53termerand chances are you've already taken advantage of it without knowing it if you've wrapped C code
07:13:17FromDiscord<Graveflo> yea I haven't had an issue with it. Even if there were issues tooling could make it better. Tooling is one of the main issues that I've had with nim from an annoyance / typing standpoint
07:13:29FromDiscord<ElegantBeef> Bridge has died
07:13:33FromDiscord<ElegantBeef> "Nim has tooling" ๐Ÿ˜„
07:13:56termerfuthark is your tooling for wrapped C code lol
07:14:01FromDiscord<Graveflo> T.T sometimes if I wait for 5 secs it'll notice that I declared a variable 1 line above
07:14:09termeryeah
07:14:16FromDiscord<Graveflo> and I think thats not even nimsuggest
07:14:29termerbut the problem isn't that bad compared to the fact that absolutely everything is brought into the current namespace
07:14:32FromDiscord<ElegantBeef> I mean I'm still on the fence with futhark, I do like it for massive projects, but I still prefer concrete Nim files
07:14:33termerthat's a real problem for me
07:14:50termerElegantBeef, I considered using Futhark but decided against it
07:14:52termertoo huge
07:14:53FromDiscord<ElegantBeef> That's never a problem
07:14:54termertoo magical
07:15:13termerEverything being brought into the current namespace makes some things very confusing
07:15:16FromDiscord<ElegantBeef> I really like the premise, but I also like concrete definitions I know pmunch was working in that regard i think
07:15:27FromDiscord<Graveflo> When I used futhark I just had to spit out the code and then I ripped it and edited it. It was just a moderate time save
07:15:38termerthat's probably what I'd do
07:15:43FromDiscord<Elegantbeef> > Not if they are squandered because some lobby allow Nestle to drain all the water in a regionโ†ตHow is it a democracy if nestle cannot 'lobby' politicians
07:15:44FromDiscord<Elegantbeef> Corruption is as old as democracy!
07:15:49termerif I remember correctly, it uses a giant C parser, which was enough to scare me off
07:16:10termerElegantbeef, https://old.reddit.com/r/Libertarian/comments/9vg9e2/best_programming_language_for_those_who_love/#
07:16:14FromDiscord<ElegantBeef> Futhark uses libclang
07:16:17termerThis is one of the funniest things I ever read about Nim
07:16:38FromDiscord<ElegantBeef> Jesus christ
07:16:42FromDiscord<Arathanis> In reply to @termer "<@145405730571288577>, https://old.reddit.com/r/Lib": what is the
07:16:44FromDiscord<Arathanis> (edit) "is" => "in"
07:16:59FromDiscord<Arathanis> this is one of the most ridiculous things ive ever seen
07:17:04termerI'm pretty libertarian myself, but imagine writing this
07:17:14FromDiscord<Arathanis> > Is this the programming language for Libertarians everywhere? ๐Ÿค”
07:17:31termerI've actually sold someone on Nim with this post, and the fact that it runs on XP
07:17:47termerboth of which are some of the least useful ways to value the language
07:18:02FromDiscord<ElegantBeef> I mean I'm technically the impossible left wing libertarian so uhh hah?
07:18:07FromDiscord<Arathanis> this has to be satire
07:18:18FromDiscord<Arathanis> this can't possibly be genuine
07:18:31FromDiscord<ElegantBeef> If you use the term "commie" unironically you're a tosspot
07:18:39FromDiscord<ElegantBeef> It's just satire
07:18:45FromDiscord<ElegantBeef> Or the person is deranged
07:18:47FromDiscord<Arathanis> sent a long message, see http://ix.io/4xvD
07:19:02FromDiscord<Arathanis> (edit) "http://ix.io/4xvD" => "http://ix.io/4xvE"
07:19:08termerit's not satire, almost certainly not
07:19:14termerit would be good satire if it was
07:19:27FromDiscord<Arathanis> > Nim is a language that was designed for high-IQ programmers
07:19:30FromDiscord<ElegantBeef> Well they're just deranged
07:19:30FromDiscord<Arathanis> WOW
07:19:42FromDiscord<Graveflo> That would be a comedian who is targeting such a niche audience. Theres no way
07:19:50FromDiscord<Arathanis> i didn't realize it was popular to jerk it that hard
07:19:55FromDiscord<Arathanis> (edit) "popular" => "possible"
07:20:01termerbasically, the people who are politically motivated and rightwing tend to get drawn to Nim because of Araq's abrasive and opinionated personality
07:20:05FromDiscord<ElegantBeef> Sorry to termer but that's libertarians for you ๐Ÿ˜›
07:20:17termerI am a libertarian, I know a lot about these retards
07:20:25FromDiscord<Arathanis> what the fuck is "libertarian syntax"
07:20:44termerok I'll concede that Nim does have libertarian/liberal/non-conservative syntax
07:20:45FromDiscord<Graveflo> the syntax doesn't tell you what to do
07:20:47FromDiscord<ElegantBeef> What's the joke again "A libertarian's wet dream is a 8 year old overdosing from heroine they purchased after working their day shift in the mines" ๐Ÿ˜„
07:20:50termeraka you really can write whatever you want however you want
07:21:00termerElegantBeef, Something like that
07:21:01termeralso McNukes
07:21:41FromDiscord<ElegantBeef> Gotta appreciate that account has been suspended
07:21:54termermost accounts that post funny things on Reddit have been suspended
07:21:57FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xvF
07:22:00FromDiscord<Arathanis> so much for libertarian
07:22:02termerit's almost as bad as Twitter in that regard
07:22:24termerArathanis, See bullet point "Despite being a high-productivity language, Nim is very type-safe, for conservative programmers who care about quality."
07:22:34termerwhich is somewhat contradictory to previous points
07:22:41FromDiscord<Arathanis> for conservative programmers ๐Ÿ˜‚
07:22:55termerconservative, I'm assuming not politically because libertarians hate conservatives
07:23:05termerI think it means literally conservative
07:23:48FromDiscord<Graveflo> still bad word choice tbh
07:23:55termerin a political post, yes
07:23:58termerin other contexts, no
07:24:15termerThe thing about this post is that it has a lot of truths in it framed in the funniest and least relevant ways possible
07:24:15*ntat quit (Quit: Leaving)
07:24:50FromDiscord<Graveflo> that's a good way to put it
07:25:11FromDiscord<Graveflo> it's just bizarre
07:25:38termerI also think the idea of a language having a BDFL being inherently libertarian is pretty shaky given that's effectively monarchism
07:25:56FromDiscord<ElegantBeef> It literally has dictator in it
07:26:05FromDiscord<ElegantBeef> It's literally a form of governence and must be abolished
07:26:11termerI like Araq and his language so I don't care about him being BDFL, but it's not an inherently good system
07:26:15termerbasically I like this king
07:26:19termeryou know, that sort of thing
07:26:29FromDiscord<ElegantBeef> No I only know it's good to be king
07:26:40termerI just can't wait to be king
07:27:15termerIt's interesting seeing posts from back when Nim reached 1.0 where there was a lot of genuine hype around the lang
07:27:16termerI miss it
07:27:17FromDiscord<Arathanis> i can't believe how self-aggrandizing this is
07:27:25FromDiscord<Arathanis> even the sources are steeped in it
07:27:39FromDiscord<ElegantBeef> In reply to @Arathanis "i can't believe how": This is that end of the libertarian spectrum
07:27:48termercan't remember how in the world I even found this post
07:27:55termerI don't use Reddit
07:27:57FromDiscord<ElegantBeef> The good ol' big brain ayn rand reading libertarians
07:28:49FromDiscord<Arathanis> i can just see this writing this out while smoking a cigar made from shredded pages of Atlas Shrugged wrapped in pages of The Fountainhead
07:28:54FromDiscord<Arathanis> (edit) "i can just see this ... writing" added "guy"
07:28:59FromDiscord<ElegantBeef> Exactly
07:29:34FromDiscord<ElegantBeef> No laughter was in the room whilst writing just the mechanical noise of their typewriter
07:30:18FromDiscord<ElegantBeef> Tip tap tip tap, "This will show the commies" thought the elusive lbmn as he puffed his cigar. ๐Ÿ˜„
07:30:22termerhttps://forum.nim-lang.org/t/10234
07:31:34FromDiscord<ElegantBeef> inb4 lbmn is araq's account
07:31:55termerahahaha
07:32:26FromDiscord<ElegantBeef> I had to investigate further
07:32:34FromDiscord<ElegantBeef> > I AM BOYCOTTING GITHUB FOR THEIR "NET NEUTRALITY" (COMMUNIST GOVERNMENT CONTROL OF THE INTERNET) PROPAGANDA SPAMMING! BOYCOTT ALL PROJECTS THAT USE GITHUB!
07:32:50FromDiscord<Arathanis> sent a long message, see http://ix.io/4xvM
07:32:58FromDiscord<Arathanis> (edit) "http://ix.io/4xvM" => "http://ix.io/4xvN"
07:33:17FromDiscord<ElegantBeef> Now now arathanis we both no the response is "Those are wifely duties and I a man will not do them"
07:33:21FromDiscord<ElegantBeef> both know
07:33:25FromDiscord<Arathanis> omg
07:33:40FromDiscord<Arathanis> lol
07:33:48termerdepends on what brand of libertarian you are
07:34:00termerif you're socially conservative with libertarian policy ideas then you may say that
07:34:14termeror you're one of the no-fucks-given libertarians then that post is probably exactly what you meant
07:34:30termerI've known both, and the latter is significantly more entertaining
07:34:45FromDiscord<Arathanis> now i have to go reread the libertarian harry potter spoof
07:35:32termerA friend of mine is a no-fucks-given libertarian and I convinced him Nim was good by showing him that post and showing that Windows XP was on the supported OS list
07:36:10termerhe doesn't even believe in marriage, not sure what he believes in besides freedom and chaos to be honest
07:36:41FromDiscord<ElegantBeef> Ah an anarchist
07:36:47termerpretty much
07:36:53termerwell
07:36:56termermore like minarchist
07:36:59termerso not full anarchist
07:37:02FromDiscord<ElegantBeef> holy shit the guys name is actually "libman" just noticed his url on his github
07:37:12termer"Further reading: r/NoNetNeutrality"
07:37:21termerthought this was r/NoNutNovember for a minute
07:37:25FromDiscord<ElegantBeef> His name is a moniker for libertarian man, he thinks he's a superhero
07:37:37termerummm... that's not what lib means
07:37:41termerit means LIBTARD
07:37:50FromDiscord<ElegantBeef> Shit you got me
07:38:37termerfuck you bastards for taking away my sleep in exchange for funny conversations
07:38:47termerno sleep tonight for me
07:38:55*boxuser joined #nim
07:39:01FromDiscord<ElegantBeef> Deprivation is theft
07:39:08FromDiscord<Graveflo> you can thank libman I guess
07:39:11termeryou didn't abide by the NAP
07:39:24FromDiscord<ElegantBeef> Sorry that's not a Canadian policy
07:39:30FromDiscord<ElegantBeef> We're commies dont you know
07:39:39termerCanadians are socialist and don't know what NAP is
07:39:46termerall they know is how to manufacture my maple syrup
07:39:48FromDiscord<mratsim> In reply to @termer "all it takes is": But you can grep `macro` and complain. Great powers, great responsibility and what not
07:39:58termerthat's true
07:40:06FromDiscord<ElegantBeef> If we're socialists where the hell is my free dental, pharma, and optometry
07:40:07termerwhich is why I prefer to write Nim code solo where nobody can mess up all my stuff
07:40:19FromDiscord<ElegantBeef> You can also write TRMs to detect macro calls
07:40:22termerElegantBeef, In your case it means you have high taxes
07:40:23FromDiscord<ElegantBeef> The chad way of doing it
07:40:31termerTRM?
07:40:31FromDiscord<ElegantBeef> "high taxes"
07:40:37FromDiscord<ElegantBeef> term rewriting macro
07:40:45termermacros to find macros
07:40:52termerthat's the Nim I know and love
07:40:55FromDiscord<ElegantBeef> Indeed
07:41:00FromDiscord<ElegantBeef> You can use TRMs as a whole linter
07:41:06FromDiscord<ElegantBeef> semantic linting in the language
07:41:06termerhahaha holy shit
07:41:09FromDiscord<ElegantBeef> What other language can do this?!
07:41:12termerRust
07:41:17termerI think
07:41:20FromDiscord<ElegantBeef> FREEDOM, put some eagles behind me
07:41:21termerkind of
07:41:25FromDiscord<ElegantBeef> Nah it doesnt have anything like TRMs
07:41:44FromDiscord<ElegantBeef> TRMs pattern match on ast and you run a macro on it
07:41:53FromDiscord<ElegantBeef> That's the antithesis of rust
07:42:02FromDiscord<mratsim> I have yet to try Rust procedural macros but I'm not hopeful
07:42:07FromDiscord<mratsim> Python has an AST module
07:42:08FromDiscord<ElegantBeef> It's supposed to be a ballache to use macros so you wish that macros are good
07:42:25termerI wanna create a macro for == that has a 1/10,000 chance of being != on each invocation
07:43:07FromDiscord<mratsim> and Julia is touted to have strong macro capacity and I do remember seeing a "if fooisExpression()" in a Julia macro that i would find useful in Nim. Instead I have to test `if typeof(T) is void`
07:43:21FromDiscord<ElegantBeef> Oh noes
07:43:28FromDiscord<ElegantBeef> https://forum.nim-lang.org/t/9739#64098 but yea cursed linter here
07:43:50termeroh god
07:44:05FromDiscord<ElegantBeef> I say cursed but I'm actually quite happy with that feature
07:44:24FromDiscord<ElegantBeef> It's actually a nice way of doing semantic linting
07:44:38termerthat'd be interesting but it's way over my head
07:45:15FromDiscord<ElegantBeef> Well anything you can detect and error/warn like `for x in a[b..c]` for instance
07:45:37FromDiscord<ElegantBeef> That should be a `toOpenArray` in 99% of cases ๐Ÿ˜„
07:45:46termerAha
07:46:03FromDiscord<ElegantBeef> Or if you have a `a & b & c`
07:46:37termerhas anyone actually done performance testing on NimVM
07:46:48FromDiscord<ElegantBeef> ring has a bit
07:46:50termerhaving far-reaching macros that do stuff like that must have some effect on compilation speed
07:47:03FromDiscord<ElegantBeef> No one uses patterns
07:47:06FromDiscord<ElegantBeef> So not really
07:47:50termerI hope not
07:47:58termerbut it always seemed like a very likely possibility to me
07:48:26FromDiscord<ElegantBeef> Meh the compiler is slow due to it's design
07:48:37FromDiscord<ElegantBeef> If we want a faster compiler move to DOD and it'll magically be faster
07:48:49termerDOD?
07:48:50FromDiscord<ElegantBeef> Good luck rewriting it to be that way though
07:48:55FromDiscord<ElegantBeef> data oriented design
07:49:07termerthere are rumors that the compiler is hard to work on and reason about
07:49:21FromDiscord<ElegantBeef> Depending on where you are that's certainly true
07:49:22termerI've personally felt inadequate to touch the compiler
07:49:35FromDiscord<ElegantBeef> I contribute to it and still feel that way ๐Ÿ˜›
07:49:36FromDiscord<mratsim> In reply to @termer "has anyone actually done": @Araq always said that the NimVM is as fast as python.
07:49:52FromDiscord<ElegantBeef> It's not anymore it's slower than python, but ringabout has been addressing some issues
07:50:02FromDiscord<mratsim> In reply to @termer "there are rumors that": don't touch the typesystem/generics/static. The rest is OK.
07:50:05termerthat sounds about right given that it's an interpreted lang effectively at that point
07:50:14FromDiscord<Graveflo> I looked at just the smallest surface proc of the compiler and I had 5 tabs open in browser and 4 splits in IDE
07:50:33FromDiscord<ElegantBeef> Once you learn how it works it's not too bad
07:50:43FromDiscord<ElegantBeef> inst modules will still be confusing though
07:50:56FromDiscord<ElegantBeef> There are some bugs there I have 0 clue how to resolve without breaking other things
07:51:02termergenerics shouldn't be TOO bad if you are able to reify early and be reasoning about real types
07:51:09termerbut Nim has a lot of theoretical types
07:51:09FromDiscord<mratsim> @ringabout in my cryptographic library, I do a few bigints operations in the VM for constants calculation or storing in an efficient form. I've had an auditor/professional fuzzer ask me if there are ways to improve the library compilation speed.
07:51:30FromDiscord<ElegantBeef> The generic logic is hard to follow in the compiler regardless what you imagien
07:51:34FromDiscord<mratsim> so that can be a nice real-world bench.
07:51:52FromDiscord<mratsim> the type system is a nest of if-then-else
07:52:31FromDiscord<mratsim> thankfully bugs only happen at compile-time with it, compared to say, closure iterators.
07:53:12FromDiscord<Graveflo> is it normal for GDB to jump into nim line comments and randomly exit / enter procs when debugging the compiler? because that's what happened when I tried it
07:53:23FromDiscord<ElegantBeef> No clue I never use a debugger on the compiler
07:53:36FromDiscord<ElegantBeef> `??` and `astalgo` works fine
07:56:11termerI used GDB to test GDB with Nim and it worked fine for hello world
07:56:16termercan't say anything else about it
08:02:44FromDiscord<mratsim> I used GDB and lldb to extensively debug all my libraries.
08:03:31FromDiscord<ringabout> In reply to @mratsim "<@658563905425244160> in my cryptographic": cool
08:14:13FromDiscord<mratsim> In reply to @ringabout "cool": Compiling this file does almost nothing but does trigger the whole VM stuff as it imports everything to provide a RNG for all types: https://github.com/mratsim/constantine/blob/master/helpers/prng_unsafe.nim
08:19:02*ntat joined #nim
08:24:01*boxuser quit (Ping timeout: 240 seconds)
08:26:10*boxuser joined #nim
08:29:25PMunchtermer, Graveflo, Elegantbeef, Futhark has the `nodeclguards` switch which makes the output much more readable and "concrete". Although you could end up running into situations where it clashes and you'd need to use a rename or renameCallback to make it compile.
08:30:48PMunchAnd that it puts everything into one namespace shouldn't be much of an issue, after all C doesn't have namespaces. But you could always import different things in different importc blocks in different files to make Nim modules out of it.
08:32:21PMunchAnd just to address the "too magic" point, it's not really magic at all. It just 1:1 translates the header to Nim so that you can use it. Sure it has a nice macro instead of a bunch of code you need to write to get there, but for the most part you just have to think about it as importing a C header.
08:42:43*Mister_Magister quit (Ping timeout: 268 seconds)
08:48:24*ntat quit (Quit: Leaving)
09:00:32FromDiscord<mratsim> In reply to @PMunch "And that it puts": Namespace would be helpful for doc generation in large libraries and to split the same namespace over multiple modules
09:03:58PMunchTrue, but as I said you can use importc in different modules
09:04:07FromDiscord<chmod222> Can Macros scan things outside of their scope? As in, I invoke somewhere down in the file "registerGlobals" and it allows me to iterate over already defined symbols or something like that?
09:04:58FromDiscord<chmod222> I have a bunch of macros that basically just take a proc definition, put its identifier into a map and echo the defiition as a no-op
09:05:05FromDiscord<chmod222> Would be nice to clean that up
09:05:23PMunchNot 100% sure how well that would work without nodeclguards though (which is useful for doc generation). It wouldn't be terribly hard for Futhark to store each generated symbol into files based on the header it came from though. Might look into that
09:05:40*Mister_Magister joined #nim
09:06:04PMunchchmod222, yes and no really
09:07:03PMunchYou can't change anything outside the macro scope (except global compile-time variables, but those are in your scope). But you can to a certain extent gather information about the context you're in.
09:07:39FromDiscord<chmod222> That would work for me, I don't need to change things around luckily
09:07:59FromDiscord<chmod222> Just scan them to generate boilerplate in case the user doesn't want to do it themselves
09:08:11FromDiscord<jmgomez> I think you may be interested in https://nim-lang.org/docs/macrocache.html instead of using globals
09:09:16FromDiscord<chmod222> Good to know, I'll check that out
09:09:16FromDiscord<chmod222> I have one {.compileTime.} only, but it irks me
09:10:07FromDiscord<chmod222> And .compileTime. breaks incremental compilation, didn't know that. All the more reason to get rid of it
09:13:30*boxuser quit (Ping timeout: 250 seconds)
09:32:55PMunchjmgomez, that is very interesting. I should definitely look into using that for some of my projects
09:56:35*ntat joined #nim
10:00:15*boxuser joined #nim
10:15:24*ntat quit (Quit: Leaving)
10:17:39*beholders_eye joined #nim
10:25:11NimEventerNew thread by IvanS: DLL crashes - can't figure out why, see https://forum.nim-lang.org/t/10247
10:28:18*derpydoo quit (Quit: derpydoo)
10:29:26FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4xw9
10:30:32FromDiscord<voidwalker> `DbError = object of IOError` - if I except IOError it works
10:36:32*ntat joined #nim
10:36:55FromDiscord<voidwalker> main problem is, I am trying to have insert or update with allographer. Anyone use it like that ?
10:38:07*beholders_eye quit (Ping timeout: 240 seconds)
10:57:45FromDiscord<mratsim> In reply to @chmod222 "Can Macros scan things": Yes
10:58:32FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4xwe
10:59:13FromDiscord<mratsim> In reply to @chmod222 "Can Macros scan things": I have a "registry" compileTime variable here to accumulate everything needed for codegen: https://github.com/mratsim/Synthesis/blob/09bef6df051b13baeb3a83d03f08b8886354839f/synthesis/factory.nim#L79
11:06:17*ntat quit (Quit: Leaving)
11:09:07FromDiscord<chmod222> I have something quite similar, basically I have a global table and a couple of macros that I tag procs and types with so they get registered into the table. The macros do little more than basic validation, enter the given thing into the table and return it unchanged. This seems redundant, much "cleaner" would be having one macro that scans over the entire surrounding environment and anything else just being {.pragma.} templates to mark
11:10:28FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4xwg
11:15:53FromDiscord<Prestige> Is there a way to have a generic be an extension of a concept so it could be used as a concrete type? E.g. https://play.nim-lang.org/#ix=4xwh
11:20:07PMunchPrestige, you can't have a seq of a concept, so that code won't work
11:21:54FromDiscord<Prestige> Yeah I was wondering if there was a way to provide a concrete type that would fit the concept
11:23:42PMunchLike this? https://play.nim-lang.org/#ix=4xwk
11:24:54FromDiscord<Prestige> Yeah, looks like I needed to use `:`
11:25:13FromDiscord<Prestige> did the playground just crash?
11:25:46PMunchNot unlikely :P
11:26:18PMunchRebooting it now
11:26:25FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/P27Ms
11:27:23FromDiscord<Andreas> In reply to @PMunch "Like this? https://play.nim-lang.org/#ix=4xwk": its gone, pls repost..
11:27:33*ntat joined #nim
11:27:42PMunchAndreas, no it's not?
11:28:30FromDiscord<Andreas> In reply to @PMunch "<@754284517316886598>, no it's not?": my bad, it just resurfaced, BIG THX
11:30:14PMunchSystem64_~_Flandre_Scarlet, yes: https://play.nim-lang.org/#ix=4xwn
11:30:25PMunchAndreas, no problem
11:31:04PMunchPrestige, never thought about this, but that is a great way to restrict a sequence actually
11:32:06PMunchYou could even do this if you don't need the object for anything else: https://play.nim-lang.org/#ix=4xwo
11:33:00FromDiscord<Prestige> That's pretty nice yeah, ty for the help btw
11:33:14FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "System64_~_Flandre_Scarlet, yes: https://play.nim-l": Ah yeah, it's copied
11:33:38FromDiscord<Prestige> I'm porting https://github.com/mapbox/delaunator to Nim
11:36:05PMunchOoh, nice
11:37:26PMunchI've had a sweet-spot in my heart for Delauney triangulation ever since I implemented it as a kid trying to replicate Teddy in 2D: https://www.cs.toronto.edu/~jacobson/seminar/igarashi-et-al-1999.pdf
11:38:39FromDiscord<Prestige> It's pretty amazing
11:38:44PMunchBasically I just wanted to do the triangulation and the spine-finding
11:39:26FromDiscord<Prestige> I'm writing it so I can use it for some gamedev stuff, should be a lot of fun
11:40:24FromDiscord<wrld> hey so
11:40:31PMunchThen combine it with this: https://www-ui.is.s.u-tokyo.ac.jp/~takeo/research/squirrel/index.html
11:40:32FromDiscord<wrld> im quite new to programming n stuf
11:40:44FromDiscord<wrld> but whats nim
11:40:54PMunchIt's a programming language
11:41:09FromDiscord<wrld> ik but what does it do
11:41:54FromDiscord<michaelb.eth> In reply to @wrld "ik but what does": in comparison with other computer programming languages, or what are you asking?
11:42:30FromDiscord<wrld> what does nim do?
11:42:50PMunchwrld, how new to programming are you? Have you written programs in a text-based programming language before? Tried Scratch or similar graphics/block based tools?
11:43:42FromDiscord<michaelb.eth> In reply to @wrld "what does nim do?": Thatโ€™s like asking what does JavaScript do? What does Python do? What does C++ do?
11:44:08FromDiscord<michaelb.eth> The answer is the same: language for expressing instructions to the computer
11:44:42PMunchmichaelb.eth, that's why I was asking what they meant by being new to programming. If they are very new they might not have a concept of what that even means
11:44:54FromDiscord<voidwalker> wrld I think you're looking for https://scratch.mit.edu/explore/projects/all
11:48:39FromDiscord<michaelb.eth> HtDP2e + DrRacket could also be a good starting point, depending on age of the person, etc.
11:49:20FromDiscord<michaelb.eth> https://htdp.org/2023-5-12/Book/part_prologue.html
11:49:32FromDiscord<wrld> yup, tried scratch n stufโ†ต(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
11:54:48PMunchRight, so Nim is your more typical programming language. Where scratch has organised the different logic elements into drag-and-drop boxes with specific fields you can fill out, Nim requires you to type everything out yourself. This might seem error prone and limited at first (and it can certainly be error prone), but if you're a proficient typer you will be able to get stuff done much faster than with drag-and-drop.
11:55:39*boxuser quit (Ping timeout: 265 seconds)
11:56:07PMunchNot sure Racket is the best way to start out michaelb.eth, reverse polish notation isn't very intuitive to most people :P
11:56:40PMunchUnless you grew up like me using an old HP-41C as your only calculator..
11:57:35PMunchwrld, if you like to learn from videos this might be a good place to start: https://www.youtube.com/playlist?list=PLvwc2YT9MFOlPPexrsY-t7BNTdg2Vsx06
11:58:41PMunchOr if you like to read stuff then this might be helpful: https://narimiran.github.io/nim-basics/
12:01:17*beholders_eye joined #nim
12:03:46FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4xwt
12:04:11FromDiscord<voidwalker> is there a better way to express this ? I want upsert (insert or update) using allographer, which doesn't seem to have a shortcut for this
12:04:57FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4xwt" => "https://play.nim-lang.org/#ix=4xwu"
12:05:07PMunchProbably by checking if the key exists before trying to insert it?
12:05:48FromDiscord<voidwalker> so I don't rely on exceptions hmm that might be a good direction
12:07:09PMunchYup
12:07:23PMunchIn general it's often a good idea to avoid exceptions for control flow
12:07:43PMunchThey are meant to catch exceptional states, not to control the flow of your program
12:07:57FromDiscord<voidwalker> yeah I know, I actually dislike exceptions, I was just lazy here cause I didn't feel like figuring out how to chek if a key exists : D
12:08:06FromDiscord<voidwalker> (edit) "yeah I know, I actually dislike exceptions, I was just lazy here cause I didn't feel like figuring out how to chek if a key exists : D ... " added "(using allographer syntax)"
12:08:56FromDiscord<voidwalker> the other question I had about this earlier, why can't I use ` except DbError:` - this doesn't catch, but ` except IOError` does ?
12:10:05FromDiscord<michaelb.eth> sent a long message, see http://ix.io/4xww
12:10:59FromDiscord<michaelb.eth> finally, it's not reverse polish notation (RPN) ๐Ÿ™‚
12:12:36*boxuser joined #nim
12:13:00PMunchvoidwalker, not sure really. That does look a bit suspect
12:13:30PMunchMaybe it has to be a ref object of for that to work=
12:14:21PMunchmichaelb.eth, oh sorry I just read like five lines and some of the code snippets
12:14:34PMunchThat sounds like a good resource though
12:16:11PMunchAnd yeah I guess it's prefix notation and not RPN
12:16:31PMunchNot sure why I thought RPN, that would have the operators at the end as well..
12:18:27FromDiscord<michaelb.eth> Easy thing to mix up, if you haven't used both RPN and prefix notation. I got fascinated with an HP graphing calculator back in high school and my parents finally bought it for me, which introduced me to RPN. My friends all thought I was so weird (probably was/am) since they used TI calculators that have you use algebraic/infix notation
12:20:01PMunchI grew up using RPN on my HP-41C, and I've been using RPN ever since (my phone has an RPN calculator, I wrote my own RPN calculator for my computers). I've also used Clojure a bit, so I should be familiar with both paradigms :P I think its just because it's Monday
12:20:16FromDiscord<michaelb.eth> haha, fair enough ๐Ÿ˜„
12:24:30FromDiscord<Andreas> In reply to @PMunch "You could even do": its working for a generec self-referencing-type. The last missing piece is to include a proc-definition to the concept ? Is that possible ?โ†ตhttps://play.nim-lang.org/#ix=4xwBโ†ตIt works with `proc[T]` commented, otherwise not
12:24:45FromDiscord<Andreas> (edit) "generec" => "generic"
12:31:24PMunchWhat's with this cursed spacing?
12:35:20FromDiscord<Andreas> In reply to @PMunch "What's with this cursed": well, its somewhat cursed - VS-Code likes it this way - i've given up on this :))
12:35:54PMunchIf you use an editor that wants something different to you you've already lost
12:36:00FromDiscord<Andreas> (edit) ":))" => ":))โ†ตi think `ch.addr.id() is int` does the trick.."
12:36:02PMunchThe whole point of an editor is to cater to you
12:36:47FromDiscord<Andreas> In reply to @PMunch "The whole point of": thats what wanted to believe, but - as i said - i gave up on it - ... hopefully waiting for LapCE
12:36:57FromDiscord<Andreas> (edit) "In reply to @PMunch "The whole point of": thats what ... wanted" added "i"
12:38:37PMunchI managed to make it match the concept, but that just gave me C compiler errors :P
12:39:12FromDiscord<michaelb.eth> there can be something freeing about one's editor automatically making the style uniform; back when I was working with Python, I used a PEP8 (iirc) mode in Emacs that would reformat on auto-/save, and I think go-mode automatically invokes gofmt
12:40:17FromDiscord<Andreas> In reply to @PMunch "I managed to make": on my side its done - and that is perfect for creating contracts or interfaces or whatever u call it..
12:41:22FromDiscord<Andreas> (edit) "it.." => "it..โ†ตhttps://play.nim-lang.org/#ix=4xwD"
12:42:29FromDiscord<Kai.> Uh
12:42:39FromDiscord<Kai.> Nim tutorial doc hurting my head
12:42:44FromDiscord<Kai.> So much info in just one tutorial
12:44:18FromDiscord<mratsim> In reply to @Kai. "Nim tutorial doc hurting": That's why most Nim devs grow a second head after a week
12:44:29FromDiscord<Kai.> Damn
12:44:36FromDiscord<Kai.> I wanna use it cus lower level but
12:44:57FromDiscord<Kai.> My experience consist of making discord bots in python for 6 years and websites for like 2 years and Lua for like 5 years
12:45:17FromDiscord<mratsim> I think there is a nimscord bot
12:45:42FromDiscord<mratsim> but you can use Nim like Python with types for starters and slowly descend into ~~hell~~ lower level as needed
12:49:47FromDiscord<Kai.> In reply to @mratsim "I think there is": It is but idek how to import libs
12:50:02FromDiscord<Kai.> So I looked at how to make http requests and that made me want to barth
12:50:33FromDiscord<voidwalker> I had even less experience doing actual projects, and here I am, having a semi functional torrent lib, scrapers, even a little gui program, in under a year
12:50:44PMunchKai., what's wrong with our HTTP requests?
12:51:12FromDiscord<Kai.> Like I have a program I usually make when I learn langs but that program doesn't stretch the full scope of what nim can do
12:51:13PMunchvoidwalker, "semi-functional" what does that mean?
12:51:15FromDiscord<Kai.> My problem uh
12:51:37PMunchWell if you find a program which stretches the full scope of what Nim can do please let me know
12:51:47PMunchI don't think any of us have gotten close to that yet
12:51:50FromDiscord<voidwalker> well it is not yet "correct", missing a strategy for picking up failed requests, and hardly optimal nor tidy : D
12:52:02PMunchAh, I see
12:52:13PMunchDo you have a link though? I've been looking into DHT lately
12:52:23FromDiscord<Kai.> sent a code paste, see https://play.nim-lang.org/#ix=4l2S
12:52:33FromDiscord<Kai.> Async dispatch?? Std???
12:52:36FromDiscord<voidwalker> no DHT yet, I was hoping I can steal it from status-im one day when my skills get better
12:52:40FromDiscord<Kai.> Where am I importing these from
12:52:51FromDiscord<voidwalker> from the std (standard library)
12:52:52PMunchThe standard library
12:53:01PMunchThat's what the `std` stands for
12:53:03FromDiscord<Kai.> What's the standard library exactly
12:53:16PMunchIt's all the stuff that ships with the Nim compiler
12:53:21FromDiscord<voidwalker> libraries that are bundled with nim, expected to be there
12:53:52PMunchhttps://nim-lang.org/docs/lib.html
12:54:17FromDiscord<Kai.> In reply to @voidwalker "libraries that are bundled": Mkay mkay
12:54:26FromDiscord<voidwalker> https://github.com/sgmihai/torrentim/tree/master - only works with devel cause I found out about the Paths type in devel : D
12:54:41FromDiscord<Kai.> How would get like the import for like nimscord
12:54:44FromDiscord<Kai.> I have the GitHub
12:54:54PMunchasyncdispatch is just for doing async stuff, you could use `newHttpClient` and drop the await and proc and stuff
12:55:04FromDiscord<mratsim> In reply to @Kai. "So I looked at": https://xmonader.github.io/nimdays/book_intro.html
12:55:16FromDiscord<Kai.> In reply to @PMunch "asyncdispatch is just for": Yeah but asynchronous programs best programs
12:55:21PMunch`nimble install nimscord`, and then `import nimscord` in your file I would assume
12:55:29FromDiscord<Kai.> Oh sick
12:55:32FromDiscord<Kai.> So like pip
12:55:37PMunchYup
12:55:47FromDiscord<mratsim> In reply to @voidwalker "no DHT yet, I": https://github.com/status-im/nim-eth/blob/master/eth/p2p/kademlia.nim
12:55:53FromDiscord<Kai.> What about uh
12:56:08FromDiscord<Kai.> Is there decorators in nim?
12:56:15PMunchpragmas?
12:56:20FromDiscord<voidwalker> @mratsim yeah that's where I was hoping to steal it from, although I have to figure out wtf is that ./discoveryv5/ bs that keeps popping up in all the status libs : D
12:56:21FromDiscord<Kai.> Like in python / java
12:56:27FromDiscord<Kai.> Idfk what a pragma is
12:56:38PMunchI don't know what a decorator is :P
12:56:49FromDiscord<mratsim> In reply to @voidwalker "<@570268431522201601> yeah that's where": Discovery v5 is a protocol to find Ethereum peers
12:57:09FromDiscord<mratsim> In reply to @voidwalker "<@570268431522201601> yeah that's where": spec is here: https://github.com/ethereum/devp2p
12:57:23FromDiscord<Kai.> sent a code paste, see https://play.nim-lang.org/#ix=4xwF
12:57:47PMunchAnd what exactly does that do?
12:57:48FromDiscord<that_dude> Well say it's basically the same
12:57:49FromDiscord<Kai.> sent a code paste, see https://play.nim-lang.org/#ix=4xwG
12:57:54FromDiscord<that_dude> But even stronger iirg
12:57:59FromDiscord<that_dude> (edit) "iirg" => "iirc"
12:58:01FromDiscord<mratsim> In reply to @voidwalker "<@570268431522201601> yeah that's where": but peer discovery and DHT are separate, the kademlia stuff only uses the RNG from Discv5
12:58:09FromDiscord<voidwalker> I remember it pulled way too many dependencies that I had no clue about. Also it would have to be run as a service cause no way I am going to port that for asyncdispatch
12:58:25FromDiscord<voidwalker> although running a dht node as a separate service is actually a good idea, generally speaking
12:58:25FromDiscord<Kai.> "A decorator is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate"
12:58:42FromDiscord<Kai.> If ur making an API it makes it way easier for even driven programs
12:58:50PMunchHmm, I think that's just done by wrapping stuff
12:59:00PMunchOr maybe through overloads, macros, etc.
12:59:12FromDiscord<Kai.> Idk what thoes are
12:59:27PMunchBasically I believe the stuff you would use decorators for in Python maps to different concepts in Nim
12:59:37FromDiscord<mratsim> In reply to @Kai. "If ur making an": create a pragma
12:59:59FromDiscord<Kai.> In reply to @mratsim "create a pragma": Wtf is a pragma
13:00:02FromDiscord<mratsim> example, create a pragma that warns about deprecation and points to the new name
13:00:16FromDiscord<Kai.> Bad example
13:00:21PMunchWell an overload is fairly simple, you can have `sayHello(x: int)` and `sayHello(x: float)` and depending on whether you call it with an int or a float it calls the correct thing
13:00:21FromDiscord<mratsim> In reply to @Kai. "Wtf is a pragma": (sry, busy for a hour or 2)
13:00:25FromDiscord<that_dude> This programming language is dense in things you can do. It just has really good defaults. But you will need to be able to Google/Look at the docs for these things
13:00:41FromDiscord<that_dude> Do you have experience in typed languages?
13:01:02PMunchA pragma is basically just a fancy way of calling a macro, a macro is a kind of procedure which runs during compile-time and is able to take in code and rewrite it
13:01:17FromDiscord<Kai.> In reply to @that_dude "Do you have experience": Typed languages meaning I have to explicitly define the data type?
13:01:49FromDiscord<Kai.> I have a few hours in c++ and can write a few things but ultimately the tutorial I was following was ALL over the place so I gave up
13:01:54FromDiscord<that_dude> Yeah. Because the destinations between functions and templates and type manipulation matters more
13:02:19FromDiscord<Kai.> I'm obv more used to not defining types but it's something I can do
13:03:18FromDiscord<Kai.> Idk what's a GOOD program I can make thatll help me stretch my legs
13:05:34FromDiscord<that_dude> Im not home rn so I can't link things better, but in general using the weakest tool for the job is best. You have procs which are function, then templates which copy and paste code and then macros where you can add your own code to the compilation pass and can hack ash generation in compile time. Pragmas are basically tags that you define elsewhere via iirc only macros
13:07:01FromDiscord<that_dude> I'd say a Pragma is the closest to a decorator, but you will need to use untyped data types which the compiled doesnt semantically check
13:08:22FromDiscord<Kai.> I don't need decorators it's just a cool feature of python
13:09:06PMunchThe best is probably to find something you want/need and then try to implement that
13:09:30PMunchThen you can ask us what we think and you'll probably get feedback about using feature X or Y for solving parts of it
13:09:34FromDiscord<that_dude> Im not going to say it's a super good example but https://github.com/Nmerryman/simple_inject this is a project that makes use of pragmas. It made it so you could add a "watch" Pragma to functions and you could then, in run time, inject custom functions and capture parameters. It was for logging and testing at the time
13:09:51FromDiscord<that_dude> Yeah don't worry about this stuff if you don't need to yet.
13:10:05om3gaARC/ORC, and other collectors hate me for some reason. Could anybody explain, or suggest why that happens?? https://play.nim-lang.org/#ix=4xwJ
13:10:08PMunchThis might help as well to get a brief overview: https://learnxinyminutes.com/docs/nim/
13:10:34FromDiscord<Kai.> Lol okay
13:10:57om3gaIs this such ideology to not free resources, even if it known that they will be not used anymore
13:11:19FromDiscord<that_dude> Just to finish my thought, because you can basically extend the compiler with macros, you can do practically anything that has syntax that compiles.
13:11:21FromDiscord<Kai.> sent a long message, see http://ix.io/4xwM
13:11:35FromDiscord<Kai.> Gotchu
13:11:36FromDiscord<that_dude> Can someone post the link to awesome nim?
13:11:43om3gaor I can ask for future request of proc that forces collector to destroy obj?
13:11:47*ntat quit (Quit: Leaving)
13:12:11FromDiscord<that_dude> https://github.com/ringabout/awesome-nim
13:12:28FromDiscord<that_dude> Found it. Check out this for a lot of useful packages
13:12:31FromDiscord<Kai.> What's that
13:12:33FromDiscord<Kai.> Okay
13:13:30FromDiscord<that_dude> Gotta drive so I'll let ya think and explore for a bit
13:14:44FromDiscord<Kai.> I sadly gotta sleep lol
13:20:53PMunchPfft, sleep
13:30:20FromDiscord<tsoj> Is there a way in Nim to create an object on the heap, but keep all the semantics the same as if it were on the stack? The only reason I want it on the heap is that it is too big for the stack.
13:30:50FromDiscord<tsoj> I started to use `seq` with a single entry, but that is not really ergonimic.
13:31:01FromDiscord<chmod222> Which specific semantics do you need?
13:31:10FromDiscord<chmod222> You can always make it a ref object
13:32:22FromDiscord<tsoj> The problem with refs is that they have pointer semantics, which is a bit annoying. But the thing that makes using refs impossible for me is that I can't use them for const vars.
13:33:06FromDiscord<mratsim> In reply to @tsoj "Is there a way": seq of one element?
13:33:12FromDiscord<tsoj> yes
13:34:01FromDiscord<tsoj> (edit) "yes" => "~~yes~~ I mean that was my workaround so far. But I don't like that I have to initialize it and the extra `[0]` is irritating me."
13:36:20NimEventerNew post on r/nim by PMunch: On June 12th r/Nim will be going dark for 48 hours to support the "Save 3rd Party Apps" movement, see https://reddit.com/r/nim/comments/141ests/on_june_12th_rnim_will_be_going_dark_for_48_hours/
13:37:23FromDiscord<chmod222> ^ I'd be amazed if they change their course tbh
13:37:59PMunchI'll be gone if they don't
13:38:14FromDiscord<tsoj> Yeah, they can just rely on reddit being quite addictive for most of the users base
13:38:34FromDiscord<chmod222> I certainly won't use the dogshite official app, so that's it at least on the phone for me
13:38:39PMunchBeen on Reddit for 10 years, but if they keep treating their users like crap then I don't want to support the platform any longer
13:40:21PMunchI mean there are some big communities joining in: https://www.reddit.com/r/ModCoord/comments/1401qw5/incomplete_and_growing_list_of_participating/?sort=top
13:48:10FromDiscord<Kai.> In reply to @PMunch "Pfft, sleep": Was at work
13:48:16FromDiscord<Kai.> 1:20am to 11:50 am
13:48:20FromDiscord<Kai.> But I left early
13:48:23FromDiscord<Kai.> Cus fuck that shit
13:50:51*ntat joined #nim
13:53:12om3gatsoi: declare your object element like someSeq: ref seq[type], and access the element like object.someSeq[]
13:55:07om3gatsoj: [] is the same as & operator in C which returns address of the seq
14:02:54FromDiscord<tsoj> sent a code paste, see https://play.nim-lang.org/#ix=4xx3
14:03:58FromDiscord<tsoj> (edit) "https://play.nim-lang.org/#ix=4xx3" => "https://play.nim-lang.org/#ix=4xx4"
14:07:06FromDiscord<chmod222> How big is this data?
14:07:37FromDiscord<chmod222> Would it work as a truly global variable, not bound to a stack of a function?
14:11:33FromDiscord<tsoj> Yes, I even need it to be a const global variable, but this is a parameter object for which I need to optimize the parameter, and for that I also need local instances.
14:11:46*PMunch quit (Quit: Leaving)
14:11:57FromDiscord<chmod222> Ah, I see
14:28:58FromDiscord<chmod222> sent a long message, see https://paste.rs/Wwb8Z
14:29:40FromDiscord<chmod222> Naively I would think so, but I don't know all the ins and outs of how Nim's GC works in cases like this
14:55:43FromDiscord<System64 ~ Flandre Scarlet> How can I get a ref to an object please?
14:57:29FromDiscord<chmod222> sent a code paste, see https://paste.rs/3mJTg
14:57:32FromDiscord<auxym> IIRC you can't. you can create a new ref and copy the data from an existing obj though.
14:58:13FromDiscord<System64 ~ Flandre Scarlet> Oh alright
14:59:52FromDiscord<auxym> you can copy the data using `myRef[] = myObj` as long as myRef is of type `ref myObjType`
15:03:02FromDiscord<System64 ~ Flandre Scarlet> Oh alrightโ†ตAnd does Marshall supports ref objects and inheritence?
15:12:19FromDiscord<auxym> not familiar with marshall sry
15:31:03NimEventerNew thread by ML: Collectors, heap, sharedRam, threads., see https://forum.nim-lang.org/t/10248
15:34:38*krux02 joined #nim
15:57:27*ntat quit (Quit: Leaving)
15:58:17*boxuser quit (Ping timeout: 265 seconds)
16:16:13*ntat joined #nim
16:35:53FromDiscord<Arathanis> damn araq really just responded to that thread and chose violence
16:49:57*junaid_ joined #nim
16:55:02FromDiscord<Boston> You just described Araq
16:55:43FromDiscord<Arathanis> i know but its still fun to see
16:56:03FromDiscord<Chronos [She/Her]> Until he's wrong :p
16:56:43FromDiscord<Arathanis> In reply to @Hourglass, When the Hour Strikes "Until he's wrong :p": probably still be fun tbh :P
16:56:57FromDiscord<jtv> I don't think it's particularly fun to see project leaders being condescending and rude, personally.
16:57:38FromDiscord<Arathanis> In reply to @jtv "I don't think it's": I think I can agree with this, now that I've read it. It certainly isn't as inviting.
16:57:59FromDiscord<Arathanis> with that said, I understand the exasperation someone might feel answering these kinds of questions day in and day out
16:58:08FromDiscord<System64 ~ Flandre Scarlet> @treeform Hi, does Flatty supports inheritence?
16:58:44FromDiscord<jtv> Dude asked for help. Making it clear you assume he's an idiot, and then critiquing his style for no good reason other than to insult him? That's the kind of thing that continually turns people out of the community.
17:00:33FromDiscord<Arathanis> Araq is German though, right? My understanding, and from my limited exposure, is they are pretty blunt. Not to be rude, but they don't see a reason to dress something up with flowery language. What we might see as rude and insulting might just be statements of fact. Not saying that is 100% the case, but just playing devil's advocate.
17:01:03FromDiscord<Arathanis> (edit) "to be" => "for the purposes of being"
17:01:09FromDiscord<Arathanis> (edit) "something" => "a statement"
17:01:16FromDiscord<jtv> I live in NYC. I'm blunt. It's totally possible to be blunt and not disrespect people. That's disrespecting people.
17:01:20FromDiscord<Arathanis> (edit) "fact." => "fact to them."
17:02:04FromDiscord<Boston> I agree with all statements, being more kind/inviting should be a goal but also yes I too would be an absolute dickhead if I had to answer what I viewed as simple questions every 5 seconds
17:02:18FromDiscord<jtv> He doesn't have to answer them.
17:02:23FromDiscord<Arathanis> Different kinds of bluntness perhaps. Not saying you are wrong, just that I am trying to be generous to everyone here.
17:02:26FromDiscord<jtv> He can... just ignore it and wait for someone else to help
17:02:42FromDiscord<Arathanis> I've definitely worked with German SWE that act like this and it was never them actually trying to be mean.
17:02:51FromDiscord<Arathanis> Ok maybe once.
17:02:53FromDiscord<Arathanis> lol
17:03:34FromDiscord<Arathanis> Again, not trying to justify it. you may very well be right. It is a fairly consistent kind of response.
17:03:51FromDiscord<jtv> Well, he's definitely gotten the feedback plenty of times. And my understanding is he tries not to answer newbie questions for that reason. So if he did something like that, he most likely absolutely intended to do that.
17:04:11FromDiscord<Graveflo> I think that you would have to be a bit sensitive for a comment like that to be hurtful. I understand what you mean though
17:04:24FromDiscord<Graveflo> I just think things go smoothlier when everyone is given some grace
17:04:38FromDiscord<Graveflo> even if its the leniency to speak frankly
17:05:12FromDiscord<jtv> Well, I don't care (much) if he's a good person or not by whatever standard. I care from the perspective of that kind of behavior on the forms is common (and not just with him) and drives people out of the community.
17:05:48FromDiscord<Arathanis> https://media.discordapp.net/attachments/371759389889003532/1115325607048380486/image.png
17:05:57FromDiscord<Arathanis> Can we just put ChatGPT in front of their responses?
17:06:01FromDiscord<Arathanis> ๐Ÿ˜‚
17:06:29*rockcavera joined #nim
17:07:29FromDiscord<Nerve> doubles the word count
17:08:07FromDiscord<System64 ~ Flandre Scarlet> Is there anything that lets you serialize Ref objs?
17:08:45FromDiscord<Arathanis> In reply to @Nerve "doubles the word count": Sure does, not a big deal imo
17:09:21FromDiscord<Arathanis> In reply to @System64 "Is there anything that": Serialize the deref version then when marshalling use it to init the ref?
17:09:33FromDiscord<System64 ~ Flandre Scarlet> In reply to @Arathanis "Serialize the deref version": Problem is I use inheritence
17:10:02FromDiscord<Arathanis> Is it mangling the types?
17:10:09FromDiscord<Arathanis> Got code examples?
17:10:38FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4xxL
17:10:48FromDiscord<voidwalker> omg just realized firefox can get xpath of html element, but no xpath support in nim : (
17:11:58FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4xxM
17:13:49FromDiscord<jtv> Type information isn't carried around at runtime. So you'd be best off having each class implement its own method to serialize its fields. Not sure what API you're using for serialization, but generally if you're using objects you aren't going to be able to rely on static functions for everything, unless you add a proc to the base that dispatches to a method that subtypes can overload.
17:14:52FromDiscord<System64 ~ Flandre Scarlet> In reply to @jtv "Type information isn't carried": I use flatty
17:53:23FromDiscord<ieltan> https://media.discordapp.net/attachments/371759389889003532/1115337585255002232/voice-message.ogg
17:54:35*madprops_ joined #nim
17:54:37*tinytoast joined #nim
17:54:39*tinystoat quit (Ping timeout: 256 seconds)
17:54:46*madprops quit (Ping timeout: 265 seconds)
18:09:37*via_ is now known as via
18:13:00*via is now known as via_
18:19:46FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xy4
18:20:47FromDiscord<sOkam!> i guess i can make the typedesc also a tuple, but wondering if its possible with varargs
18:20:47FromDiscord<Graveflo> `varargs[typedesc, typeof]` maybe?
18:21:28FromDiscord<sOkam!> In reply to @Graveflo "`varargs[typedesc, typeof]` maybe?": wouldn't that turn all of them into just typedesc, without the given type?
18:21:39FromDiscord<chmod222> Does that really work though? That'd be an open array of generic types
18:21:49FromDiscord<Graveflo> yea nvm mb that would be for input non-typedesc variables
18:22:05FromDiscord<sOkam!> In reply to @chmod222 "Does that really work": wdym?
18:22:35FromDiscord<chmod222> As I understand it, `typedesc` isn't a type in itself but a generic parameter much like `[T]`
18:23:45FromDiscord<sOkam!> so it might not be doable with varargs because of that? is that what you mean?
18:25:06FromDiscord<Graveflo> the compiler does let me make a `varargs` that has a unspecified generic type so maybe `typedesc` is different
18:26:01FromDiscord<sOkam!> problem is i think `typedesc` is not the same as `typedesc[int32]` if im not mistaken ๐Ÿค”
18:26:21FromDiscord<sOkam!> i figure it must be like an array or seq
18:26:28FromDiscord<sOkam!> so it must be coherent in type
18:26:35FromDiscord<sOkam!> (my best guess)
18:26:51FromDiscord<Graveflo> yea but I wonder why the compiler doesn't complain like it would if you put generic `seq` there
18:30:13FromDiscord<Elegantbeef> varargs has to be homogenous unless it's `varargs[typed]` inside a macro
18:32:23FromDiscord<treeform> In reply to @System64 "<@107140179025735680> Hi, does Flatty": I don't think so. I don't use oop, so I did not test for it.
18:39:14*madprops_ is now known as madprops
18:39:15*madprops quit (Changing host)
18:39:15*madprops joined #nim
18:39:24*junaid_ quit (Remote host closed the connection)
18:50:45*beholders_eye quit (Ping timeout: 268 seconds)
18:53:31FromDiscord<Graveflo> sent a code paste, see https://paste.rs/JfWGs
18:57:40*oprypin joined #nim
18:58:58FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xyb
18:59:45FromDiscord<Arathanis> In reply to @Graveflo "this, although ridiculous, breaks": the double destructor foot gun
19:00:43FromDiscord<Graveflo> Oh can you get a double destructor that faults from making refs? I was testing that last night before I got too tired
19:01:23FromDiscord<Arathanis> In reply to @Graveflo "Oh can you get": whats happening here, from my understanding is:โ†ตโ†ตyou make a string, which is tracked by the GCโ†ตyou get the address of that string, and cast it to a ref string (ref is just a Gc tracked pointer)
19:01:30FromDiscord<Arathanis> then when cleanup happens first one destructs
19:01:38FromDiscord<Arathanis> then the other destructs the same object which is already nil
19:01:41FromDiscord<Arathanis> kaboom
19:04:29FromDiscord<Graveflo> Ah ok. I was worried that something like that could happen. One thing about the code I posted though is that it doesn't seem to compile at all let alone run into the GC. It'll die before the compiler gets going
19:05:10FromDiscord<Graveflo> well that's not true it just wont run an echo statement at the top of the file. The compiler starts up fine
19:05:21FromDiscord<Arathanis> yeah, just remember its all GCed
19:05:24FromDiscord<Arathanis> and refs are GCed pointers
19:05:47FromDiscord<Arathanis> so if you make a ref from a non-ref GCed var you gonna get two destructors
19:05:58FromDiscord<Arathanis> or at least that is what i think is happening. beef will come tell me why im deeply wrong
19:06:18FromDiscord<Arathanis> also there might be a way using something like `wasMoved` to declare the original non-ref to have lost ownership of its memory
19:06:33FromDiscord<Arathanis> and keep this from happening
19:06:46FromDiscord<Arathanis> it would mean you shouldn't access the original var anymore
19:29:23FromDiscord<Graveflo> yea I'm still struggling to get the compiler to call a destructor off of a manually created ref but that could have something to do with the scoping being manipulated in compilation. What you are talking about "not accessing the original var" is the idea for a "move" right? I'm certainly going to avoid doing stuff like this, just curious about it
19:30:29FromDiscord<Graveflo> and I mean I'll avoid casting my own refs not nims built in move semantics
19:31:11FromDiscord<Arathanis> In reply to @Graveflo "yea I'm still struggling": what do you mean getting it to call off a manually created ref?
19:31:39FromDiscord<Arathanis> and yeah, iirc a `move` means that the owner of the var has shifted.
19:33:53FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xyd
19:36:07FromDiscord<Graveflo> and the `echo` statement isn't really a test since, from last night, beef reminded me I have to overwrite the memory. Just looking at the destructor calls. Idk why it's called twice though even when there is only one ref ever made. Maybe it's just not so sensitive about the destructor being called twice and the second call is from `Book` s destructor?
19:37:06FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xye
19:37:13FromDiscord<Arathanis> https://media.discordapp.net/attachments/371759389889003532/1115363715529842698/image.png
19:37:31FromDiscord<Graveflo> yea but if you comment out `i_duplicate_ref` there is still two prints
19:38:03FromDiscord<Arathanis> But there are two
19:38:35FromDiscord<Graveflo> oh is there the one that is created from `MyObject` s constructor hanging around?
19:38:43FromDiscord<Graveflo> oh wait
19:38:46FromDiscord<Graveflo> ok nvm xd
19:38:57FromDiscord<Arathanis> 1st one `var d = MyObject(encap: "test")`
19:39:04FromDiscord<Arathanis> 2nd one `var v = Book(encap: new(MyObject))`
19:40:01FromDiscord<Graveflo> yea i left that there by mistake. I'm dumb. So deleting `var d = MyObject(encap: "test")` and having `i_duplicate_ref` uncommented out we still have one print
19:40:28FromDiscord<Graveflo> so I imagine that either the custom refs dont trigger the gc or I am not making my call hierarchy complex enough to trigger arc
19:40:55FromDiscord<@theperfectcomputer-628303036da0> Trying to do some dsp in nim... I want to do it via multiple threads, maybe one fir filter per thread
19:41:02FromDiscord<@theperfectcomputer-628303036da0> via a fifo
19:41:21FromDiscord<@theperfectcomputer-628303036da0> does the nim produce/consumer communcation lib have a lot of overhead?
19:41:28FromDiscord<Arathanis> In reply to @Graveflo "so I imagine that": i expect its smart enough to see you just duplicated a ref, so it just ticked up the ref count on the existing ref
19:42:43FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xyf
19:46:22NimEventerNew Nimble package! guardmons - Cross-platform collection of OS Utilities, see https://github.com/treeform/guardmons
19:47:20FromDiscord<System64 ~ Flandre Scarlet> In reply to @treeform "I don't think so.": Oh alrightโ†ตHowever, I have another problemโ†ตI store a callback in my player object, but it doesn't even compile because Flatty doesn't support itโ†ตAny ways to bypass that?
19:51:16FromDiscord<Chronos [She/Her]> Tempted to try writing a Nim backend again
19:55:37*oldpcuser quit (Ping timeout: 240 seconds)
20:01:50FromDiscord<Chronos [She/Her]> Honestly split between Nimskull and Nim, Nim has a lot of useful things like async which Nimskull doesn't rn
20:02:03FromDiscord<Chronos [She/Her]> Tho Java has threads instead of async
20:09:37*deadmarshal_ quit (Ping timeout: 265 seconds)
20:25:57FromDiscord<etra> sent a code paste, see https://play.nim-lang.org/#ix=4xyj
20:26:25FromDiscord<Graveflo> that is what I was trying to prove but I failed
20:26:45FromDiscord<auxym> In reply to @Hourglass, When the Hour Strikes "Honestly split between Nimskull": async in nim FYI is implemented purely in user-code (either in the stdlib or chronos), there is nothing async specific in the compiler itself
20:27:18FromDiscord<etra> In reply to @Hourglass, When the Hour Strikes "Tempted to try writing": the minecraft backend? did you managed to get something working with the plugin system + async?
20:27:32FromDiscord<Chronos [She/Her]> In reply to @auxym "async in nim FYI": Yep but NimSkull doesn't have that
20:27:49FromDiscord<Chronos [She/Her]> In reply to @etra "the minecraft backend? did": Ah the server software I was working on? Sidelined because of lack of energy
20:28:04FromDiscord<Chronos [She/Her]> I can't focus on one project for long, that's my issue :p
20:28:11FromDiscord<etra> fair
20:28:12FromDiscord<Chronos [She/Her]> Physically can't otherwise I'll get bored
20:28:19FromDiscord<Chronos [She/Her]> And end up doing nothing
20:28:19FromDiscord<etra> yea
20:28:24FromDiscord<etra> (edit) "yea" => "yeah that can happen haha"
20:29:01FromDiscord<willyboar> In reply to @Hourglass, When the Hour Strikes "Yep but NimSkull doesn't": I think they will replace async with CPS
20:29:16FromDiscord<etra> I'm yet to finish anything in Nim, to be honest. I still fumble around between Nim and Crystal. The async story in Nim, to me, is not as satisfactory as with tokio-rs, in the sense that it doesn't scale from singlethreaded to multi-threaded, but it could be my lack of experience, too.
20:29:26FromDiscord<etra> I was writing some bindings in nim and had fun, though.
20:30:08FromDiscord<ieltan> I hear a lot about CPS
20:31:10FromDiscord<etra> (edit) "singlethreaded" => "single-threaded"
20:31:37FromDiscord<willyboar> We will be able to tell more about nimskull when they release. I don't know when that happen though.
20:32:00FromDiscord<willyboar> (edit) "We will be able to tell more about nimskull when they release. I don't know when that ... happen" added "will"
20:34:16FromDiscord<willyboar> It seems they do a lot of work.
20:38:15FromDiscord<Chronos [She/Her]> In reply to @willyboar "I think they will": How about the amount of Nim libraries we'll be missing out on
20:39:31FromDiscord<Elegantbeef> @Graveflo\: stop it, stop casting pointers to refs and expecting it not to behave oddly
20:39:32*oldpcuser joined #nim
20:40:34FromDiscord<Graveflo> ok sorry. My curiosity is satiated for now. I'll go back to pretending I'm sane
20:40:59FromDiscord<Elegantbeef> Good
20:41:18FromDiscord<Elegantbeef> @Arathanis\: Nope it doesnt tick the ref count the only way to tick the ref count is to take a reference or use `Gcref`
20:43:06FromDiscord<willyboar> In reply to @Hourglass, When the Hour Strikes "How about the amount": You mean libraries that depends on async? I don't believe they care.
20:43:22FromDiscord<Graveflo> In reply to @Elegantbeef "<@136570191038513152>\: Nope it doesnt": Does the gc not track `cast`ed refs then?
20:43:30FromDiscord<Elegantbeef> Of course not it's unsafe code
20:43:39FromDiscord<Elegantbeef> I mean it attempts to use them
20:43:42FromDiscord<Elegantbeef> But they do not behave properly
20:44:03FromDiscord<Chronos [She/Her]> In reply to @willyboar "You mean libraries that": Yeah, or newer Nim features
20:44:15FromDiscord<Elegantbeef> It 'tracks' them but it doesnt mean that they work as you intend
20:44:34FromDiscord<Chronos [She/Her]> Or macros, iirc when the code gen code has the new PR merged (or if it already does), all macros will likely need to be rewritten if they manually create nodes and such
20:45:06*ntat quit (Quit: Leaving)
20:45:52FromDiscord<willyboar> In reply to @Hourglass, When the Hour Strikes "Yeah, or newer Nim": Nimskull, from what I know, would be a totally different language incompatible with all Nim libraries. Maybe because tha syntax similarities it will be easy to port some of them.
20:46:05FromDiscord<Elegantbeef> all is a stretch
20:46:11FromDiscord<Elegantbeef> Some code will work just fine
20:47:44FromDiscord<Elegantbeef> grave looking at this code calling `iDoSomething` does not tick the ref
20:48:10FromDiscord<Elegantbeef> There is no reason to tick the ref when passing into procedure as there is no need to keep it alive longer
20:48:42FromDiscord<Graveflo> that's true. I guess I should have given the ref to an object that was created outside the proc?
20:49:00FromDiscord<willyboar> In reply to @Elegantbeef "Some code will work": Yes but libraries will probably need some changes
20:49:03FromDiscord<Elegantbeef> Probably, but this is just all inane ๐Ÿ˜›
20:49:18FromDiscord<Elegantbeef> Like playing darts using a javelin, you're missing the point
20:49:42*oldpcuser_ joined #nim
20:49:57FromDiscord<Graveflo> what's the point?
20:50:10FromDiscord<Elegantbeef> The point is stop it, get some help
20:50:30FromDiscord<Graveflo> you sounds like all those doctors that I ignored
20:51:06FromDiscord<Elegantbeef> "I drink 10 can of redbull daily, the heart noises are good noises, it means it's working"
20:51:24FromDiscord<Arathanis> In reply to @Elegantbeef "<@136570191038513152>\: Nope it doesnt": ok so this ptr cast to ref does misbehave, it was just luck we didn't segfault this time? the cast from addr -> int -> ref is not tracked and has unsafe/undefined behavior?
20:51:50FromDiscord<Elegantbeef> Right casting is inherently unsafe, Nim has only minor protections in place
20:51:50*oldpcuser quit (Killed (NickServ (GHOST command used by oldpcuser_)))
20:51:52*oldpcuser_ is now known as oldpcuser
20:51:58FromDiscord<Elegantbeef> If you think what you're doing is right it doesnt complain
20:52:18FromDiscord<Elegantbeef> As long as you're casting to a type \<= sizeof(source) it's fine
20:52:39FromDiscord<Arathanis> https://tenor.com/view/shoot-myself-in-the-head-cabin-fever-baby-girl-toy-gun-crying-gif-16610909
20:52:46FromDiscord<Arathanis> Nim just lets us all do this ^
20:52:49FromDiscord<Arathanis> we are in contrl
20:52:51FromDiscord<Arathanis> (edit) "contrl" => "control"
20:53:04FromDiscord<Elegantbeef> Well pointers are apart of Nim's unsafe subset
20:53:14FromDiscord<Elegantbeef> If you do not know what the implication of the subset is, do not use the,
20:53:25FromDiscord<Elegantbeef> It has memory safe references that can be used
20:53:25FromDiscord<Arathanis> yeah but they are there to give us that power if we need it with the trust that we Know What We Are Doing โ„ข๏ธ
20:53:33FromDiscord<Arathanis> thanks for clarifying beef, i had a feeling i wasnt exactly right
20:53:41FromDiscord<Elegantbeef> Right no different to Rust's unsafe blocks
20:54:00FromDiscord<Elegantbeef> It's just Nim doesnt feel the need to say "Code inside here is unsafe and if you use it you will be ostracised from the community"
20:54:30FromDiscord<Elegantbeef> `cast`, `addr`, `pointer`, `ptr` is the unsafe segment of Nim
20:55:05FromDiscord<Elegantbeef> Not any different to rust where you can grep for `unsafe` you can grep the same here ๐Ÿ˜„
20:55:14FromDiscord<Arathanis> fair haha.
20:55:37FromDiscord<Arathanis> i like Nim more than rust right now anyway :P
20:55:51FromDiscord<Elegantbeef> Sure but I'm just giving a comparison to another memory safe language
20:55:59FromDiscord<Arathanis> oh yeah, i totally understand
20:56:00FromDiscord<Elegantbeef> There arent many memory safe system languages
20:56:11FromDiscord<Elegantbeef> Nim, Crystal, Rust,... one of those is a toy even more so than Nim
20:56:14FromDiscord<Arathanis> I just prefer Nim cause it doesn't scream at me
20:56:19FromDiscord<Arathanis> lets me do what i want
20:56:26FromDiscord<Arathanis> it's the most libertarian language after all ๐Ÿ˜
20:56:41FromDiscord<Elegantbeef> Right it solves memory safety in a nicer way and has arguably nicer features
20:57:02FromDiscord<Elegantbeef> Mixins are much nicer than traits due to the fact it's a shape based instead of implementation based matching imo ๐Ÿ˜„
20:57:06FromDiscord<Arathanis> `ptr` always has a type associated with it yeah? and `pointer` is basically a void pointer yeah? "im a memory address to something"
20:57:16FromDiscord<Elegantbeef> Right
20:57:42FromDiscord<Elegantbeef> The benefit of the mixin's is you can just use a procedure if the type matches without any need to do `impl trait`
20:58:05FromDiscord<Elegantbeef> Want to use a serialisation library on a type you didnt declare, it just works
20:58:06FromDiscord<Arathanis> In reply to @Elegantbeef "Right it solves memory": agree
20:58:09FromDiscord<Arathanis> In reply to @Elegantbeef "Mixins are much nicer": and agree
20:58:52FromDiscord<etra> In reply to @Elegantbeef "Mixins are much nicer": what are mixins
20:58:52*deadmarshal_ joined #nim
20:59:22FromDiscord<Elegantbeef> speaking of unsafe, sadly so many people use `cast` for type conversions
20:59:23FromDiscord<Elegantbeef> Really need better documentation on that I guess
20:59:57FromDiscord<Elegantbeef> Generic procedures that provide an interface allowing you to implement procedures on a type basis
21:00:19FromDiscord<Elegantbeef> the `mixin` keyword in Nim tells the compiler to look for a symbol at the instantiation site and declaration site
21:00:28FromDiscord<etra> In reply to @Elegantbeef "speaking of unsafe, sadly": I agree, it was only through this chat, when also you were the one that said that cast is inherently unsafe that I learned to never cast to refs
21:00:43FromDiscord<Elegantbeef> Well there are some places it's safe to cast to refs ๐Ÿ˜„
21:01:10FromDiscord<Elegantbeef> If you implement type erasure with orc/arc i believe you need to use `pointer` as the base type and cast from that
21:01:30FromDiscord<Elegantbeef> `RefRoot` might work still though
21:01:32FromDiscord<chmod222> What a fortunate time for you to have this discussion, I'm trying to hunt down a segfault and I'm casting around a bit
21:01:34FromDiscord<Elegantbeef> RootRef\
21:01:39FromDiscord<chmod222> Time to look deeper into those places
21:07:22FromDiscord<Elegantbeef> Really @etra you should only cast if you know that's what you want, meaning you want to cast the bit signature
21:07:31FromDiscord<Elegantbeef> In like 99% of cases of type conversions it's just wrong
21:07:44*zgasma joined #nim
21:08:15FromDiscord<Elegantbeef> A valid usage is like `cast[uint8](myEnumSet)`
21:08:53FromDiscord<Elegantbeef> Assuming your enum has \<= 8 elements
21:09:00FromDiscord<etra> yeah I'd guess that just by the signature there's no explicit remark that says it's unsafe, when I read cast I imagine `static_cast` rather than `reinterpret_cast`, because `unsafeAddr` exists
21:09:27FromDiscord<Elegantbeef> Luckily unsafeAddr no longer exists really
21:09:43FromDiscord<Elegantbeef> It exists for legacy in devel, but `addr` works everywhere now
21:09:51FromDiscord<etra> I see
21:10:09FromDiscord<etra> now it's time to do `unsafeCast` then :axlcat:
21:10:23FromDiscord<Elegantbeef> No
21:10:26FromDiscord<Elegantbeef> cast is implicitly unsafe
21:10:35FromDiscord<Elegantbeef> The correct thing is to educate how to do type conversions
21:10:57FromDiscord<Graveflo> Yea I didn't know about them until you showed me
21:11:35FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html#basic-types-type-conversion exists but I guess lacks a cliffnote of "Note\: `cast` is an unsafe operation, do not use it for type conversions. Only use it if you know what you are doing."
21:12:19FromDiscord<Elegantbeef> Also it sorta implies it only works for numerics
21:12:29FromDiscord<Graveflo> honestly reading that wouldn't give me confidence that it will work on non-primatives
21:13:23FromDiscord<Elegantbeef> Do me a favour and PR some expanded information there ๐Ÿ˜›
21:13:29FromDiscord<Graveflo> the way I learn things it would be better to just teach the mechanics of the type system itself
21:14:33FromDiscord<Elegantbeef> Someone still should add the information we've discussed
21:14:39FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "speaking of unsafe, sadly": Needed for some things though, no? Or for optimisations ~~that will prolly be done by the compiler anyway~~
21:14:51FromDiscord<Elegantbeef> I just dont feel like doing it
21:15:17FromDiscord<Elegantbeef> Did i say never usue it chronos
21:15:29FromDiscord<Chronos [She/Her]> I've never used mixins in Nim tbh
21:15:54FromDiscord<Elegantbeef> Have you ever used jsony, jsonutils, or any other serialisation library?
21:16:00FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Did i say never": Nope but was wondering if there's some magic or smth you know of
21:16:15FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Have you ever used": I've used jason once?
21:16:28FromDiscord<Elegantbeef> There you go that's mixins
21:16:29FromDiscord<Graveflo> The differences between `ref x`, `var x`, `x : RootObj` are important for understanding when you can convert type information. I'm not even sure were / how the "type information" change happen. I assume its at compile time
21:16:39FromDiscord<etra> In reply to @Hourglass, When the Hour Strikes "I've never used mixins": I may be braindead but I understand 0 from the definition in the manual https://media.discordapp.net/attachments/371759389889003532/1115388739410202804/image.png
21:16:44FromDiscord<Elegantbeef> Nah type information is runtime
21:16:54FromDiscord<Elegantbeef> Think about `var p: Parent = Child()`
21:17:01FromDiscord<Elegantbeef> You still need type information to dispatch methods
21:17:28FromDiscord<Elegantbeef> Type information is a pointer stored before the struct on an object
21:17:30FromDiscord<Graveflo> yea but that could be an artifact of using `method` it doesn't necessitate it for other things.
21:17:52FromDiscord<Elegantbeef> You need it for `parent of Child`
21:18:36FromDiscord<Elegantbeef> Type information is needed at runtime for safe conversions from a type erased type
21:18:38FromDiscord<Graveflo> right. if the parent isnt the base class of the proc
21:18:42FromDiscord<Elegantbeef> Upcasted counts as type erased in my world
21:19:21FromDiscord<Elegantbeef> Nah etra most people do not understand mixins until they see an example or get an explanation
21:19:29FromDiscord<Elegantbeef> Even then @Ayy Lmao took 30 years to understand them
21:19:29FromDiscord<Graveflo> and also assuming that language doesn't create a generic, which I know it doesnt but thats bc you said so
21:19:51FromDiscord<Elegantbeef> > and also assuming that language doesn't create a generic,โ†ต?
21:19:56FromDiscord<Arathanis> In reply to @etra "I may be braindead": I asked this before! It means the template/generic can look up the calling/instantiating scope for the implementation so you can leave procs as an exercise to the user
21:20:32FromDiscord<Elegantbeef> Anyone want to document mixins better as well. Writing is tedious ๐Ÿ˜›
21:20:40FromDiscord<etra> In reply to @Arathanis "I asked this before!": oh, so like, requiring a type to implement a specific function?
21:20:49FromDiscord<etra> like, some sort of rust trait?
21:20:50FromDiscord<Arathanis> not necessarily required to implement
21:21:12FromDiscord<Arathanis> it means different modules can have different implementations for that mixin is my understanding
21:21:23FromDiscord<Arathanis> i think it falls back to whatever impl has the closest proximity to the call?
21:21:35FromDiscord<huantian> Having deja vu for last night beef lmao
21:22:05FromDiscord<Elegantbeef> Mixins are just generic procedures that you can define the procedures later
21:22:26FromDiscord<Elegantbeef> Well mixin symbols are symbols that can be implemented after declaration
21:22:27FromDiscord<Elegantbeef> Binded symbols have to be implemented before declaration
21:22:51FromDiscord<Elegantbeef> Yea huan for some reason some guy brings up mixins and everyone comes out the woodworks
21:23:19FromDiscord<etra> perks of discord not being the best platform for SEO :p
21:23:56FromDiscord<Elegantbeef> There we go mixin in action
21:23:58FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/wywiJ
21:24:05FromDiscord<Elegantbeef> Someone copy that to the mixin examples, thanks
21:24:43FromDiscord<etra> ooc, do you type that in mobile? your first letter is always uppercase which makes me suspicious, and that makes me even wonder... did you just typed all that code in your phone?
21:24:51FromDiscord<etra> (edit) "ooc," => "ooc (and offtopic),"
21:25:01FromDiscord<Graveflo> sent a long message, see http://ix.io/4xyz
21:25:13FromDiscord<huantian> Thatโ€™s a lot of words
21:25:15FromDiscord<Elegantbeef> No I just try to capitalise properly. It's hard
21:25:43FromDiscord<Elegantbeef> You can only use `a of B` on a type that is a subtype of `typeOf(a)`
21:26:19FromDiscord<Elegantbeef> Actually that might be wrong, but it only works on the inheritance tree of `typeof(a)` if i recall correctly.
21:26:25FromDiscord<etra> sent a code paste, see https://play.nim-lang.org/#ix=4xyB
21:26:33FromDiscord<Elegantbeef> If you want to call it that way
21:26:46FromDiscord<Elegantbeef> I prefer it "opens the symbol so declaration and instantiation scopes can be considered for overload"
21:27:52FromDiscord<Graveflo> In reply to @Graveflo "The compiler should be": dammit I meant sub classes of `A` that are sub-classes of `B` when `B` is a subclass of `A`
21:29:59FromDiscord<Elegantbeef> I have no clue what you generic remarks are about
21:30:02FromDiscord<Elegantbeef> I attempt to read your writing and it just reads as technobabble
21:30:25FromDiscord<Graveflo> it is! that's my specialty
21:30:39FromDiscord<Elegantbeef> Ah good, I'm lost reading your subclass stuff
21:31:32FromDiscord<Elegantbeef> Aw shit I was wrong the compiler does not force the right hand side to be apart of the inheritance tree for `of`
21:31:36FromDiscord<Elegantbeef> It does force object types though
21:31:42FromDiscord<Graveflo> ah well it doesn't matter. I will continue to try and learn the ins and outs. Once I feel very comfortable I'll want to think about making guides and stuff. I have a lot more to learn
21:32:02FromDiscord<Elegantbeef> Well just stick to safe Nim for now ๐Ÿ˜›
21:35:07FromDiscord<Graveflo> and tbh nim has great documentation. It's missing some spoon feeds but I think some really impactful contributions could come from improving tooling. That speeds up learning a lot for new people
21:36:08*deadmarshal_ quit (Ping timeout: 265 seconds)
21:41:44FromDiscord<chmod222> segmentation faults that disappear when I compile with --debugger\:native
21:41:47FromDiscord<chmod222> Gotta love it
21:41:49*disso-peach quit (Quit: Leaving)
21:42:26FromDiscord<Graveflo> couple more tricks like that and the bug might need chemo
21:42:57*dza quit (Quit: )
21:44:45*dza joined #nim
21:54:49FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xyF
21:55:40FromDiscord<Elegantbeef> What?
21:56:07FromDiscord<Graveflo> the generic doesn't infinitely recurse but the method does
21:56:13FromDiscord<Elegantbeef> `my_string` is a method if you want to use `procCall` use the `procCall`
21:57:16FromDiscord<Graveflo> yea from googling it I see that but it's still weird. usually there is a concept of `super` when using methods
21:57:31FromDiscord<Elegantbeef> Right I just showed you it
21:57:45FromDiscord<Elegantbeef> `procCall BaseClass(self).myString)`
22:00:50FromDiscord<Elegantbeef> Just like in C# or Java a conversion to base is not a type erasure and methods are still dispatched dynamically
22:09:15*oldpcuser_ joined #nim
22:11:55*oldpcuser quit (Ping timeout: 256 seconds)
22:11:55FromDiscord<Boston> sent a code paste, see https://play.nim-lang.org/#ix=4xyI
22:12:40FromDiscord<Boston> (edit) "https://play.nim-lang.org/#ix=4xyI" => "https://play.nim-lang.org/#ix=4xyJ"
22:15:32FromDiscord<Boston> I can successfully get data if I replace ptr cstring with pointer and pass the address of device: array[256, char] but preferably I would receive the data in string form so no processing has to be done to it
22:15:59FromDiscord<Boston> Is using the array the correct answer and I'm just picky or am I missing something
22:27:25FromDiscord<Elegantbeef> `DWord` is this 32 bits?
22:28:06FromDiscord<Elegantbeef> secondly `device` is nil by default
22:28:30FromDiscord<Elegantbeef> you likely can just do `var device = newString(256)` and then `echo SiGetProductString(0, device[0].addr, 0x01)`
22:29:10FromDiscord<Elegantbeef> `ptr cstring` is just wrong since that's pointer to pointer, unless it's allocating and mutating a cstring atleast
22:29:19FromDiscord<Elegantbeef> I assume it writes to the buffer you give it assuming it's 256 bytes wide
22:31:00FromDiscord<Elegantbeef> If you want to use a cstring the solution is `var device = cast[cstring](create(char, 256))`. Don't do that though there is no benefit
22:31:16FromDiscord<Elegantbeef> @Boston\:
22:31:48*oldpcuser_ is now known as oldpcuser
22:32:23*deadmarshal_ joined #nim
22:36:15FromDiscord<Elegantbeef> In hindsight the proc should take a cstring and you should do `SiGetProductString(0, cstring device, 0x01)`
22:38:33FromDiscord<Boston> Dword is a C unsigned long, and the compiler is unhappy about newString[256], am I missing an import?
22:39:30FromDiscord<Boston> (edit) "long, and the compiler is unhappy about newString[256], am I missing an import?" => "long"
22:39:50FromDiscord<Boston> In reply to @Elegantbeef "In hindsight the proc": This worked ๐Ÿ‘๐Ÿ‘
22:51:38FromDiscord<chmod222> Is it the "proper" way to move a `ref T` over an FFI boundary by calling `GC_ref` to keep it alive, casting it via `cast[ptr T](reffed)` and going the reverse with `cast[ret T](ptrd)` and `GC_unref`? I know it's unsafe and best to be avoided, but barring any other issues that may pop up, is that principally the way it should be done if it had to be done?
22:52:07FromDiscord<chmod222> I really can't track down this segfault, but all pointers show up valid and the reference appears to survive the transition
22:52:23FromDiscord<chmod222> Compiling with debug symbols makes the segfault go away so I'm somewhere in undefined behaviour
22:56:00FromDiscord<chmod222> When I compile with debug symbols I can also see that the destructor is called once and precisely when it should, so the logic appears to be correct
22:56:38FromDiscord<chmod222> Funnily enough, if I compile with -d\:danger it also doesn't explode
22:59:49NimEventerNew thread by lewisl: Object Variant question, see https://forum.nim-lang.org/t/10249
23:06:38FromDiscord<Elegantbeef> That sounds proper as long chmod
23:06:46FromDiscord<Elegantbeef> Whoops change of thought mid sentence
23:06:48FromDiscord<Elegantbeef> Yea that's fine
23:16:22FromDiscord<chmod222> Alright, so the issue may be somewhere else. That is a topic for tomorrow then
23:16:30FromDiscord<chmod222> Thank you
23:52:12FromDiscord<inv> Hello, question about Mastering Nim again: https://nim-lang.org/docs/destructors.html#hook-generation
23:52:36FromDiscord<inv> sent a code paste, see https://play.nim-lang.org/#ix=4xyS
23:53:31FromDiscord<inv> how is it possble to generate hook in let/var ?
23:54:06FromDiscord<Elegantbeef> The compiler can cause it's the compiler
23:54:13FromDiscord<Chronos [She/Her]> In reply to @chmod222 "Is it the "proper"": Oof good luck, that became horrid as I tried doing something similar xD
23:54:14FromDiscord<Elegantbeef> It stores them then generates them where needed
23:54:25FromDiscord<Chronos [She/Her]> Arc seems to play better tho
23:54:58FromDiscord<inv> Why it does not want to generate hooks just near type?
23:55:28FromDiscord<inv> why the "strategic places" are so special?
23:56:18FromDiscord<Elegantbeef> It's basically saying "On first usage hooks will be generated"
23:56:47FromDiscord<Elegantbeef> The mild reason for strategic is so you do not have to forward declare all your hooks
23:57:31FromDiscord<inv> But why is it ok for any other types, but not for hooks?
23:57:39FromDiscord<inv> (edit) "But why ... is" added "it" | removed "it"
23:57:45FromDiscord<Elegantbeef> What?
23:58:10FromDiscord<Elegantbeef> Hooks have to be generated on first use so the compiler knows what to do
23:58:36FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/nBs6f
23:58:43FromDiscord<Elegantbeef> How does that compile if you do not lift a destructor?
23:58:54FromDiscord<Elegantbeef> Imagine `=destroy` is inserted not written
23:58:59FromDiscord<inv> Probably I lost why it is bad to make it just before type
23:59:05FromDiscord<inv> (edit) "Probably I lost why it is bad to make it just before type ... " added "declaration"
23:59:13FromDiscord<Elegantbeef> Cause you need to be able to override them
23:59:27FromDiscord<Elegantbeef> Only one can exist, you have to be able to override them
23:59:38FromDiscord<Elegantbeef> As such the compiler implicitly generates one on first usage
23:59:43FromDiscord<inv> it explains. Thank you!
23:59:53FromDiscord<inv> ... or uses my own