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:42 | FromDiscord | <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:13 | FromDiscord | <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:29 | FromDiscord | <Arathanis> i guess is --gc:none, not --gc:off |
01:04:54 | FromDiscord | <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:04 | FromDiscord | <SkynWalker> Guys is there an isPrime proc anywhere I didnโt find one in math |
01:05:15 | FromDiscord | <auxym> (eg don't alloc/free a thousand times in a loop) |
01:06:19 | FromDiscord | <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:57 | FromDiscord | <SkynWalker> Ngl gang idk what all that means but ty |
01:07:17 | FromDiscord | <SkynWalker> Imma take a look |
01:07:45 | FromDiscord | <auxym> sieve of erasthothenes is an algorithm to check if a number is prime: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes |
01:09:56 | FromDiscord | <SkynWalker> Nice ty |
01:20:13 | FromDiscord | <auxym> In reply to @SkynWalker "Nice ty": also check out https://rosettacode.org/wiki/AKS_test_for_primes#Nim |
01:20:55 | FromDiscord | <SkynWalker> Nvm I just made my own lol |
01:20:59 | FromDiscord | <SkynWalker> Ty tho |
02:32:33 | termer | I'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:50 | termer | I'm not very familiar with linking to libraries in Nim, and definitely not in C (I was never a C developer) |
02:46:07 | FromDiscord | <Graveflo> I think you need a library file instead of the shared library. Instead of .so it should say .a |
02:47:11 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> Just use https://github.com/neroist/uing |
03:11:04 | FromDiscord | <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:16 | termer | I'll take a look, thanks |
03:24:22 | * | beholders_eye joined #nim |
03:50:17 | FromDiscord | <Arathanis> does nim have some kind of importlib where I can define imports/includes using const variables? |
03:52:26 | FromDiscord | <Elegantbeef> God that's awful |
03:52:30 | FromDiscord | <Elegantbeef> Just make a module that imports and exports them |
03:54:43 | FromDiscord | <Elegantbeef> Unless you mean like "Import the entire directory" |
03:55:26 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xv8 |
03:56:26 | FromDiscord | <Elegantbeef> Does that not work? |
03:56:39 | FromDiscord | <Elegantbeef> Ah nvm i see the issue |
03:56:39 | FromDiscord | <Arathanis> it works, I just wnat to be able to have a single place with the name |
03:56:57 | FromDiscord | <Arathanis> maybe write a macro that hands this entire construct for me |
03:57:06 | FromDiscord | <Elegantbeef> How many times do you need this? |
03:57:11 | FromDiscord | <Elegantbeef> Just make this a module and import it ๐ |
03:57:43 | FromDiscord | <Arathanis> make it a module, export the wrapped functions, and just import where i need it? |
03:57:54 | FromDiscord | <Arathanis> also: https://media.discordapp.net/attachments/371759389889003532/1115127328138334298/image.png |
03:58:06 | FromDiscord | <Arathanis> why the heck is this undefined its in the docs, was it removed and the docs not updated? |
03:58:36 | FromDiscord | <Elegantbeef> Why not, gotta be less horrendous than your suggestion |
03:59:20 | FromDiscord | <Arathanis> just wanted to clarify what you were suggesting |
04:00:32 | FromDiscord | <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:35 | FromDiscord | <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:38 | FromDiscord | <huantian> Idk if that makes sense |
04:28:18 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> You're basically talking about constrained concepts |
04:28:53 | FromDiscord | <huantian> Yes |
04:29:16 | FromDiscord | <Elegantbeef> That works for new style concepts, not so much for old style |
04:29:16 | FromDiscord | <huantian> It would be constrained concepts using current infra and opt in per proc |
04:29:24 | FromDiscord | <huantian> Yeah I donโt think itโd work for old style |
04:29:31 | FromDiscord | <huantian> Unfortunately |
04:29:39 | FromDiscord | <Elegantbeef> It's not too bad you only have to implement a type/proc per concept |
04:30:18 | FromDiscord | <huantian> Somewhat viable idea right? |
04:30:44 | FromDiscord | <Elegantbeef> Yea I do a similar thing for traitor |
04:31:12 | FromDiscord | <Elegantbeef> you just need to cache the instantiated type and it's procedures |
04:31:12 | FromDiscord | <huantian> I think it could be helpful to make concepts more ergonomic for certain usecases |
04:32:28 | FromDiscord | <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:55 | FromDiscord | <Elegantbeef> The more concerning thing is `proc doThing[T: Concept]` |
04:33:55 | FromDiscord | <Elegantbeef> In your case if it's an unconstrained generic you can just instantiated an `uint8` or sometheing |
04:34:37 | FromDiscord | <Elegantbeef> If it's constrained you can implement the first `or` branch if there is one, otherwise just do nothing |
04:34:56 | FromDiscord | <Elegantbeef> Like `X and Y` is a constraint that's hard to implement |
04:35:35 | FromDiscord | <huantian> Hmm |
04:36:54 | FromDiscord | <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:25 | FromDiscord | <huantian> Because then youโd be able to use other procs you defined for your concept in the current checked proc |
04:38:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/rYmVn |
04:38:29 | FromDiscord | <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:50 | FromDiscord | <Elegantbeef> Just cause you say fancy words doesnt make you fancy |
04:39:18 | FromDiscord | <Prestige> :( |
04:39:33 | FromDiscord | <Elegantbeef> I joke cause i have no idea |
04:39:44 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4xvd |
04:40:52 | FromDiscord | <huantian> But what if yourProc calls foo(arg) inside of itself, and previously in the scope you define foo(arg: object) |
04:41:29 | FromDiscord | <Elegantbeef> What you're constraining on a generic if an implementation doesnt allow compilation that's a bug |
04:42:07 | FromDiscord | <huantian> Then the check succeeds, because you use an object , but would fail at instantistion for a int that fits the concept |
04:42:36 | FromDiscord | <Elegantbeef> Right, the only way to know if a generic compiles is to attempt to call it for every single type |
04:43:06 | FromDiscord | <demotomohiro> In reply to @Avahe "Just checking before I": Did you check this? https://github.com/ringabout/awesome-nim |
04:46:42 | FromDiscord | <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:49 | FromDiscord | <huantian> But as soon as we add generics it falls apart |
04:47:16 | FromDiscord | <Elegantbeef> The is of course one of the issues with mixins over traits |
04:48:26 | FromDiscord | <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:56 | FromDiscord | <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:19 | FromDiscord | <huantian> Yeahhh |
04:50:33 | FromDiscord | <huantian> I wish there was a way to get the best of both worlds |
04:53:19 | FromDiscord | <Graveflo> Why would you use an overly specific trait then? |
04:55:44 | FromDiscord | <Prestige> In reply to @demotomohiro "Did you check this?": haven't found it so far on there |
04:56:21 | FromDiscord | <SkynWalker> Hey guys how do I do ^ on 4 digit numbers without running out of memeory |
04:56:24 | FromDiscord | <SkynWalker> Memory |
04:57:47 | FromDiscord | <huantian> Maybe the macro check could still be helpful if it just worked on new concepts and approximated unconstrained generics |
04:59:38 | FromDiscord | <Elegantbeef> I mean AFAIK rust traits require being implemented on type declarationโต(@Graveflo) |
05:04:02 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> They work for both really |
05:06:57 | FromDiscord | <Elegantbeef> You can use them for interfaces the same way you can use a rust trait dynamically |
05:07:15 | FromDiscord | <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:24 | FromDiscord | <Elegantbeef> I know this is true cause my traitor library exists ๐ |
05:07:25 | FromDiscord | <SkynWalker> Does anyone know how to factor large numbers without running out of memory |
05:07:33 | FromDiscord | <Elegantbeef> Get smaller numbers |
05:08:21 | FromDiscord | <Graveflo> isn't factoring large numbers one of those things that are quintessentially difficult for a computer to do |
05:08:40 | FromDiscord | <SkynWalker> ๐๐๐ |
05:09:20 | FromDiscord | <Elegantbeef> My abacus isnt much better |
05:09:41 | FromDiscord | <demotomohiro> In reply to @SkynWalker "Does anyone know how": I think this is what you want: https://github.com/nim-lang/bigints |
05:10:06 | FromDiscord | <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:48 | termer | Elegantbeef, "Just use https://github.com/neroist/uing" I just got finished catching up with messages |
05:12:51 | FromDiscord | <demotomohiro> bigints seems doesn't have factorization. |
05:12:55 | termer | I can't use this because I need to support Windows XP |
05:13:15 | termer | it's a very weird application |
05:13:38 | termer | basically it's an application targeting Linux and XP or later |
05:14:14 | FromDiscord | <Arathanis> whats the difference between std/async and std/asyncdispatch? |
05:14:59 | termer | I had no idea std/async existed |
05:15:12 | termer | it looks like it exports a bunch of things from asyncdispatch |
05:15:16 | FromDiscord | <Arathanis> me either, until just a moment ago |
05:15:25 | FromDiscord | <Arathanis> In reply to @termer "it looks like it": it seems to import std/asyncmacros and std/asyncfutures |
05:15:49 | termer | oh, it uses either asyncjs or asyncmacro and asyncfutures |
05:16:01 | termer | would be nice if someone bothered to actually document that |
05:16:04 | FromDiscord | <demotomohiro> Are there people on this planet who still use WindowsXP and developing app for it? |
05:16:15 | FromDiscord | <Graveflo> yes. not i but yes |
05:16:31 | FromDiscord | <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:33 | FromDiscord | <Graveflo> I've been there are feel your pain btw |
05:16:53 | termer | No 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:17 | termer | demotomohiro, I'm building a game launcher for a website of retro PC game enthusiasts |
05:17:32 | termer | so I have to support basically every version of Windows past the year 2003 lol |
05:17:38 | FromDiscord | <Arathanis> so what is asyncmacros for as compared to asyncdispatch O-o? |
05:17:54 | termer | asyncmacro is await |
05:18:03 | termer | and {.async.} |
05:18:17 | FromDiscord | <Arathanis> ohhh asyncdispatch literally includes asyncmacros |
05:18:19 | FromDiscord | <Arathanis> doesnt even import |
05:18:20 | termer | asyncdispatch is the event loop |
05:19:03 | FromDiscord | <Arathanis> so std/async is all the async without the stdlib implementation of the event loop |
05:19:15 | FromDiscord | <Arathanis> so you could use chronos instead for example? |
05:19:31 | termer | no, what it does is: |
05:19:37 | termer | if you're targeting JS, imports asyncjs |
05:19:47 | termer | if not, imports asyncmacro and asyncfutures |
05:19:56 | * | derpydoo quit (Ping timeout: 250 seconds) |
05:20:13 | FromDiscord | <demotomohiro> @termer supporting every version of windows sounds very hard. |
05:20:17 | FromDiscord | <Arathanis> i guess im just not understand when you would use it as opposed to asyncdispatch |
05:20:38 | termer | demotomohiro, Well, Windows has decent backwards compatibility, and I already know Nim runs on XP |
05:21:30 | termer | Arathanis, 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:02 | FromDiscord | <Arathanis> ohhh ok, i think that is a solid assumption |
05:22:09 | FromDiscord | <Arathanis> some documentation in the lib for what it is for would be nice though |
05:22:23 | termer | go ahead and submit a PR, as Araq says |
05:23:34 | FromDiscord | <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:39 | termer | over time I've realized that Nim is exceptionally good for projects with bizarre requirements, but painful for things like a typical webapp |
05:23:41 | FromDiscord | <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:53 | termer | There are very few people using it |
05:24:00 | termer | but some people do for various reasons |
05:24:24 | termer | and 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:33 | termer | GCC and MinGW actually still support XP |
05:26:06 | FromDiscord | <Graveflo> not that python is in the same vicinity as a language like C but python 2.7 runs on XP also |
05:26:36 | termer | I suppose, but I'm sure as hell not dealing with pip |
05:27:00 | FromDiscord | <Arathanis> only psychopaths deal with raw pip |
05:27:19 | FromDiscord | <Elegantbeef> You're telling me python has something more than a "requirement.txt"? |
05:27:20 | FromDiscord | <Graveflo> poor pip ๐ฆ |
05:27:31 | FromDiscord | <Arathanis> In reply to @Elegantbeef "You're telling me python": yes |
05:27:31 | termer | requirements.txt is what pip uses |
05:27:33 | termer | it's absurd |
05:27:39 | termer | it CAN use other things |
05:27:41 | FromDiscord | <Arathanis> requirements.sad |
05:27:58 | termer | it's seriously the worst dependency management system I've seen in my entire life |
05:28:14 | termer | my success rate for getting a python project with pip running is probably below 50% |
05:28:27 | termer | I don't have the deep hidden knowledge of the language and tooling to fix bizarre dependency conflicts |
05:28:32 | FromDiscord | <Graveflo> I'm curious what the hang up is |
05:28:42 | termer | conflicts with dependency versions |
05:28:47 | termer | because guess what, there's no lockfile |
05:28:53 | FromDiscord | <Arathanis> not using virtualenvs? |
05:29:03 | termer | I use venvs when I'm told how to |
05:29:05 | termer | I'm not a python developer |
05:29:09 | FromDiscord | <Arathanis> fair |
05:29:22 | FromDiscord | <Arathanis> but yeah, requirements.txt is not the way lol |
05:29:43 | termer | nimble 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:47 | termer | so it's rarely an issue |
05:29:52 | termer | I'd like to see wider use of atlas though |
05:30:20 | FromDiscord | <Arathanis> i wish `atlas` came with `choosenim devel` |
05:30:32 | FromDiscord | <Arathanis> ive only gotten it by manually building the 2.0 preview off the tagged branch |
05:30:52 | termer | that'd be nice |
05:31:00 | FromDiscord | <Elegantbeef> Maybe with nim2.0 people will use gitnim and atlas more |
05:31:13 | FromDiscord | <Arathanis> im not aware of gitnim |
05:31:22 | FromDiscord | <Elegantbeef> It's choosenim but with style |
05:31:51 | FromDiscord | <Elegantbeef> Dont even need curl to install it, you just clone a git repo and then build it |
05:32:01 | FromDiscord | <Elegantbeef> then suddenly you an do `git nim devel` |
05:32:09 | FromDiscord | <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:26 | FromDiscord | <Graveflo> I'd like to just do a deep dive and learn one of them |
05:32:30 | termer | the way it structures package directories is a nightmare |
05:32:38 | termer | it gets really bad once you're using git submodules |
05:32:46 | termer | and basically anything that depends on a path relative to the project root |
05:32:59 | termer | you'd think they could just git clone your repo and be done with it |
05:33:03 | termer | but nimble does all sorts of fuckery |
05:33:22 | FromDiscord | <Elegantbeef> I find it that nimble gets worse as time goes on |
05:33:31 | FromDiscord | <Arathanis> ill have to try gitnim |
05:33:33 | FromDiscord | <Arathanis> i found the repo |
05:33:35 | termer | the fact that it doesn't have a lockfile is already a problem |
05:33:45 | termer | I always require all my dependencies by git hash because of that |
05:33:51 | FromDiscord | <Elegantbeef> Meh I do not find that really useful ime |
05:33:52 | termer | only way to ensure I always get what I need |
05:34:00 | FromDiscord | <Elegantbeef> I properly use semver cause i'm not a silly billy |
05:34:16 | termer | I'm talking transitive dependencies too |
05:34:21 | termer | that's the real point of a lockfile |
05:34:27 | FromDiscord | <Elegantbeef> I know it gets reproducible builds, but that's not even where i run into troubles |
05:34:48 | FromDiscord | <Elegantbeef> I'm using `nimble develop --global` and there is no way to uninstall a package |
05:34:56 | FromDiscord | <Arathanis> so beef, sell me on gitnim. How is it better than choosenim? |
05:35:12 | termer | Elegantbeef, lol what |
05:35:25 | FromDiscord | <Elegantbeef> You cannot uninstall a globally linked package afaict |
05:35:31 | FromDiscord | <Elegantbeef> You have to manually delete the link file |
05:35:55 | termer | also I can't see how a new choosenim will be any improvement considering choosenim basically has two commands: "choosenim devel" "choosenim stable" |
05:36:02 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1115152024066084874/image.png |
05:36:02 | FromDiscord | <Elegantbeef> Or this travesty |
05:37:05 | termer | that's awesome |
05:37:26 | FromDiscord | <Elegantbeef> I just want to uninstall gooey, but no I'm not allowed to |
05:37:46 | termer | it's too gooey and sticky to remove |
05:37:50 | termer | you just have to live with it now |
05:38:10 | termer | ok so I've got another thing I've wanted to find out |
05:38:19 | termer | I've heard the -d:openssl ships with a hardcoded list of CAs |
05:38:20 | termer | is that true |
05:38:47 | termer | because while that would be terrible in most cases, that'd actually be awesome for my WinXP client |
05:38:57 | termer | since it probably doesn't have the necessary CAs on the system |
05:39:17 | * | derpydoo joined #nim |
05:39:51 | FromDiscord | <Elegantbeef> On linux it uses your systems no? |
05:39:52 | FromDiscord | <Elegantbeef> On windows you need to ship a file |
05:40:02 | termer | hmm |
05:40:09 | FromDiscord | <Arathanis> In reply to @Elegantbeef "I just want to": `rm -rf $(nimble path gooey)` |
05:40:18 | FromDiscord | <Arathanis> ๐ |
05:40:20 | FromDiscord | <Graveflo> wait windows XP has security features? |
05:40:22 | FromDiscord | <Elegantbeef> Ah yes a package manager |
05:40:22 | termer | it statically links against openssl also, right? |
05:40:32 | FromDiscord | <Elegantbeef> Nope |
05:40:36 | termer | well shit |
05:40:41 | FromDiscord | <Elegantbeef> You have to manually statically link openssl |
05:40:51 | termer | I need to find a way to support modern TLS |
05:40:57 | FromDiscord | <Elegantbeef> Use status' bearssl bindings |
05:41:03 | termer | I was looking into that |
05:41:07 | termer | it seemed promising |
05:43:02 | termer | Since I'm not touching any significant outside libraries, this project will probably be a good opportunity to properly give chronos a try |
05:43:10 | termer | I can actually use arc if I want given the fact that it doesn't have cycles |
05:43:39 | termer | I 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:46 | termer | if they can do it, so can we (I) |
05:44:50 | FromDiscord | <Elegantbeef> I mean cycle-less code is great, but just remember linked lists exist |
05:45:01 | FromDiscord | <Elegantbeef> Cycles are sometimes the lesser evil |
05:45:15 | FromDiscord | <Graveflo> linked lists dont have to be circularly linked |
05:46:15 | FromDiscord | <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:17 | FromDiscord | <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:18 | FromDiscord | <Elegantbeef> Nim's doubly list linked is anyway |
05:46:29 | termer | demotomohiro, I'm aware |
05:46:56 | termer | it should be fine |
05:46:57 | FromDiscord | <Elegantbeef> Some of Rust's design is encourages good code, but lack of cycles is just ugh |
05:47:06 | termer | I know at the very least that asyncdispatch works on XP |
05:47:11 | termer | chronos should also be ok |
05:47:36 | termer | Elegantbeef, Just know where you're doing your cycles and have a system for handling them |
05:47:45 | termer | doubly linked lists are not things I use very often at all |
05:47:50 | FromDiscord | <Elegantbeef> Lol |
05:47:50 | termer | in fact I can't remember the last time I used one |
05:47:58 | termer | at least in my own code |
05:48:06 | termer | can't say for 3rd party libs |
05:48:08 | FromDiscord | <Elegantbeef> I just brought them up as an example |
05:48:46 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> I of course avoid cycles for sanity reasons, but if I need them I'm not going to avoid cycles |
05:51:00 | termer | right, no reason to completely abandon them |
05:51:10 | termer | but I'd rather stick to ARC as much as possible since ORC is just horrible in its current state |
05:51:16 | termer | ORC leaks so much |
05:51:27 | FromDiscord | <Elegantbeef> I dont think it technically leaks |
05:51:31 | termer | no, it does |
05:51:38 | termer | at least when using asyncdispatch |
05:51:42 | FromDiscord | <Elegantbeef> Proper leaks or just not freeing memory |
05:51:52 | termer | explain the difference |
05:51:54 | FromDiscord | <Elegantbeef> I use orc for my game and have a steady like 40mb of memory usage |
05:52:02 | termer | memory keeps going up and is never freed |
05:52:06 | FromDiscord | <Elegantbeef> Leaking is when the memory is actually lost and not freeable |
05:52:19 | FromDiscord | <Elegantbeef> Not freeing memory means the memory is still accessible just not returned |
05:52:21 | termer | I don't think it's freeable because I don't have access to it |
05:52:35 | termer | it's not like I'm filling up and array or hashmap and forgetting to delete stuff |
05:52:35 | FromDiscord | <Elegantbeef> You do not need access to it |
05:52:48 | FromDiscord | <Elegantbeef> It's just if the memory management knows about it |
05:52:51 | FromDiscord | <Graveflo> yea if it freed the memory as soon as you couldnt access it it'd be arc |
05:53:15 | FromDiscord | <Elegantbeef> If the cycle collector knows about the memory and can free it, it's not technically a leak |
05:53:38 | FromDiscord | <Elegantbeef> I dont thread or use async so my memory under orc is fine |
05:53:41 | FromDiscord | <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:50 | termer | well, 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:04 | FromDiscord | <Graveflo> ok thats not normal I hope |
05:54:04 | FromDiscord | <Elegantbeef> It's not that hard to check grave just `-d:useMalloc` and valgrind |
05:54:17 | FromDiscord | <Elegantbeef> devel or stable? |
05:54:20 | termer | both |
05:54:35 | termer | this was something I was testing a lot last month that ultimately ended with me giving up using Nim for my project |
05:54:42 | termer | I'm not a C dev so I have a hard time understanding valgrind |
05:54:52 | termer | especially in async where things are really hard to understand already |
05:55:02 | termer | call stacks really don't mean anything at that point |
05:55:12 | FromDiscord | <Elegantbeef> It's not complicated memcheck says explcitly how many blocks of memory were returned |
05:55:18 | FromDiscord | <Elegantbeef> I'm not a C dev either ๐ |
05:55:19 | termer | The issue was definitely inherent to ORC though, since it's not an issue with refc |
05:55:47 | termer | perhaps someday I'll return to it |
05:56:00 | termer | but my resolve is now firmly to use chronos if I ever bother with async under Nim again |
05:56:21 | termer | no need to worry about ORC if you barely have any cycles to begin with |
06:34:55 | * | ntat joined #nim |
06:38:36 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xvt |
06:39:48 | FromDiscord | <mratsim> In reply to @termer "I used to think": Swift has a disclaimer about that xD |
06:40:18 | FromDiscord | <mratsim> In reply to @termer "nimble also has the": There are lockfiles since last year |
06:40:42 | FromDiscord | <mratsim> Probably not documented or advertised though |
06:40:45 | FromDiscord | <Elegantbeef> @Graveflo\: that looks like a big ol' error in the process |
06:41:23 | FromDiscord | <mratsim> https://github.com/status-im/nimbus-eth2/blob/stable/nimble.lock |
06:41:28 | FromDiscord | <Elegantbeef> What's the point of using `ref` if you're wanting `ptr T`? |
06:41:31 | termer | mratsim, "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:57 | FromDiscord | <Elegantbeef> You have a dangling pointer |
06:42:35 | FromDiscord | <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:42 | termer | mratsim, Does your eth client support proof of stake with the new network and everything |
06:42:53 | termer | I'm not an ethereum user but I'm curious |
06:42:56 | FromDiscord | <Elegantbeef> Give me a second I'll make it crash |
06:43:28 | FromDiscord | <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:32 | FromDiscord | <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:38 | termer | sweet |
06:43:59 | FromDiscord | <mratsim> Also the one that uses the less memory (2x less than Rust and 3x less than Go) |
06:43:59 | FromDiscord | <Elegantbeef> There you go it errors |
06:44:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/nwVoR |
06:44:08 | termer | I'm still amazed you're at least somewhat enthusiastic about Nim after having to roll your own async I/O lib |
06:44:13 | termer | and everything else |
06:44:16 | FromDiscord | <mratsim> Anf that sync the fastest |
06:44:26 | FromDiscord | <Elegantbeef> A generic or an object variant is the only way to do that grave |
06:44:26 | termer | no idea how status even began using Nim in the first place |
06:44:31 | FromDiscord | <Elegantbeef> Unsafe code is unsafe |
06:44:36 | FromDiscord | <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:50 | FromDiscord | <mratsim> In reply to @termer "no idea how status": CEO is a tinkerer ๐ |
06:44:54 | FromDiscord | <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:56 | termer | apparently lol |
06:45:07 | termer | sounds like the kind of ballsy tech choice I would have made a couple of years ago |
06:45:14 | FromDiscord | <Elegantbeef> You just made a dangling pointer and then never wrote to the memory |
06:45:19 | FromDiscord | <Elegantbeef> You have a stack address |
06:45:19 | termer | I'm surprised it uses less than the Rust one |
06:45:34 | FromDiscord | <Elegantbeef> Since you didnt call a proc afterwards the stack was 0'd and you got an empty string |
06:45:35 | termer | not that there's anything inherently more performant or efficient about either lang |
06:46:38 | FromDiscord | <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:49 | FromDiscord | <Elegantbeef> I'm absolutely confused why you do not just use a generic or a variant here ๐ |
06:46:55 | FromDiscord | <Elegantbeef> Or just make `MyObject` always a ref |
06:47:10 | FromDiscord | <Elegantbeef> If you say "binary size" I'm going to come over there and slap you |
06:47:11 | FromDiscord | <mratsim> sent a long message, see http://ix.io/4xvw |
06:47:49 | termer | I've seen some big things written in Clojurescript |
06:47:51 | FromDiscord | <Elegantbeef> Now only if i had marketable skills and status wasnt crypto related |
06:47:59 | termer | never understood why people would bother with it, but whatever |
06:48:00 | FromDiscord | <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:10 | FromDiscord | <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:30 | termer | Talking to some Rust people, I heard their futures are on the stack |
06:48:34 | FromDiscord | <mratsim> In reply to @Graveflo "Okay this has been": Read on monomorphization |
06:48:36 | termer | maybe I misunderstood |
06:48:46 | termer | but Nim's have always been heap objects which turned me off to it |
06:48:49 | FromDiscord | <Elegantbeef> It will bloat the executable but not nearly as much as you think |
06:49:01 | termer | I've personally always wanted Kotlin-like coroutines in Nim |
06:49:18 | FromDiscord | <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:25 | FromDiscord | <Elegantbeef> It's not going to shit endlessly on your small embedded memory |
06:49:36 | * | PMunch joined #nim |
06:49:39 | FromDiscord | <mratsim> And in the scheduler (Tokio or async std) you need them on the heap to pass to other threads |
06:49:40 | FromDiscord | <Elegantbeef> You only use a few instances of a generic anyway |
06:50:03 | termer | mratsim, 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:20 | FromDiscord | <mratsim> I like kotlin coroutines as well, god design |
06:50:24 | FromDiscord | <mratsim> Good |
06:50:31 | FromDiscord | <Elegantbeef> Why not both |
06:50:42 | termer | When I learned how Kotlin coroutines worked, I thought "why isn't every lang doing this" |
06:50:48 | termer | I used Kotlin before Nim |
06:51:01 | termer | but only learned how its coroutines worked in the past year |
06:51:19 | FromDiscord | <Elegantbeef> It's odd that kotlin can have good designed APIs given it's a bitch and a half to read bytes ๐ |
06:51:32 | termer | it's not hard to read bytes in kotlin |
06:51:35 | FromDiscord | <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:40 | termer | not sure where you're getting that from |
06:51:47 | FromDiscord | <mratsim> Might even hire @ElegantBeef to write macros |
06:52:00 | termer | mratsim, Then I sure hope it goes TO THE MOON |
06:52:17 | FromDiscord | <Elegantbeef> BE to LE and vice versa is a ballache from my recollection helping my friend |
06:52:22 | termer | I hate 90% of crypto and tolerate 5%, liking the other 5% |
06:52:30 | termer | Ethereum is one of the ones I tolerate |
06:53:07 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> Hiring me to write macros is like paying a crack addict to taste crack |
06:53:30 | termer | Makes sense |
06:53:33 | FromDiscord | <Elegantbeef> Wait you're telling me these bored toaster NFTs arent genuine?! |
06:53:42 | termer | "Hiring me to write macros is like paying a crack addict to taste crack" I laughed out loud |
06:54:13 | PMunch | Yeah I felt that |
06:54:48 | FromDiscord | <Elegantbeef> Honestly there might be less sniffling and arm scratching with the crack addict |
06:55:07 | termer | mratsim, I've always wondered with intellisense and basic IDE tooling looks like on a huge Nim codebase |
06:55:16 | termer | I've heard horror stories, like the guy working on Nim4UE |
06:55:23 | termer | saying nimsuggest basically doesn't work |
06:55:25 | FromDiscord | <Elegantbeef> Imagine writing C in 1968 |
06:55:30 | FromDiscord | <mratsim> In reply to @termer "<@570268431522201601>, I've always wondered": nim check: off, nimsuggest: off |
06:55:38 | termer | LOL |
06:55:42 | termer | that's a bitch |
06:55:43 | FromDiscord | <mratsim> I don't want to deal with jet engine |
06:56:01 | FromDiscord | <mratsim> Well nim check is better |
06:56:13 | termer | Go To Symbol almost never works for me on anything approaching a "big" codebase |
06:56:14 | FromDiscord | <Elegantbeef> Hey we're promised IC and nimbleh any year now |
06:56:21 | termer | things start chugging once I added Chronos to the mix, for example |
06:56:48 | termer | does 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:09 | termer | I have no idea how it even works if it does exist |
06:57:32 | FromDiscord | <mratsim> Nimsuggest, meh, |
06:57:38 | FromDiscord | <mratsim> To quote Linkin Park |
06:57:40 | FromDiscord | <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:51 | termer | :| |
06:57:55 | termer | you have a point |
06:58:19 | FromDiscord | <mratsim> So induction of new devs is a bitch |
06:58:26 | FromDiscord | <Elegantbeef> HCR doesnt |
06:58:35 | FromDiscord | <mratsim> Which is why there is someone on Status payroll for dev tooling |
06:58:44 | FromDiscord | <Elegantbeef> Just hire me to be the suggestion |
06:58:55 | FromDiscord | <Elegantbeef> "Yea that's an error, don't do that" |
06:58:58 | FromDiscord | <mratsim> We'll train elegantGPT |
06:59:02 | termer | yeah, who needs dev tooling when you're around to answer every question every single time I visit this channel |
06:59:20 | FromDiscord | <Elegantbeef> Maybe one day I'll get a life |
06:59:27 | termer | you oughtta be paid |
06:59:28 | termer | not by me |
06:59:32 | termer | but you oughtta be paid |
07:00:09 | FromDiscord | <Elegantbeef> The village idiot does it for the thril |
07:00:18 | FromDiscord | <Elegantbeef> thrill\ |
07:00:45 | termer | it still blows my mind |
07:00:47 | FromDiscord | <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:21 | FromDiscord | <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:31 | FromDiscord | <mratsim> But the alternative is to hide all your types under a pointer (i.e. boxing) and having cache misses for everything. |
07:01:36 | termer | accept crypto and pretend taxes don't exist |
07:01:48 | FromDiscord | <Elegantbeef> lol |
07:01:57 | FromDiscord | <Elegantbeef> Nah that goes against everything my little brain agrees with |
07:02:34 | termer | I 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:35 | FromDiscord | <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:01 | FromDiscord | <Elegantbeef> Well I disagree with the disagreement with taxation |
07:03:13 | FromDiscord | <Elegantbeef> Worst is I'm Canadian which has the same sort of tax protocol as the US ๐ |
07:03:16 | FromDiscord | <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:32 | FromDiscord | <Elegantbeef> So even these simple taxes are a pain in the arse cause fuck you use turbo tax |
07:03:37 | FromDiscord | <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:40 | termer | Unless you're targeting embedded hardware, don't worry so much about your generics |
07:04:06 | termer | like mratsim said, if you want everything to be a single implementation, box everything |
07:04:10 | termer | but you don't really want to do that |
07:04:10 | FromDiscord | <Elegantbeef> grave over here making dangling pointers to avoid generics ๐ |
07:04:17 | FromDiscord | <Elegantbeef> Or just write swift |
07:04:24 | termer | if you want to get really funny, use "auto" for all your types and write entirely with type inference |
07:04:37 | termer | write your Nim like you write JavaScript |
07:04:59 | FromDiscord | <Elegantbeef> You forgot about using dot operators that discard incorrect field access |
07:05:00 | termer | it's almost entirely possible and yields some of the most confusing semantics you can imagine |
07:05:05 | termer | ahahahaha |
07:05:11 | termer | yeah, how could I forget that |
07:05:21 | termer | dot macro that rewrites bad access |
07:05:41 | termer | what a disaster that would be |
07:05:48 | FromDiscord | <Elegantbeef> No helpful error just `"Expected expression for : a.b"` |
07:06:11 | termer | see this is why I'm always worried about working on Nim with someone else |
07:06:28 | termer | all it takes is one silly macro being introduced into the module you're working on for everything to stop making sense |
07:07:20 | FromDiscord | <Graveflo> Is this what's to show for the "expressiveness" |
07:07:30 | termer | sometimes, yes |
07:07:39 | termer | I think expressiveness is overrated, although not to the degree Go believes that |
07:07:54 | termer | I *do* however like all the different ways to call Nim procs |
07:08:06 | termer | and, heresy alert, I also like style-insensitivity |
07:08:20 | termer | it means I can work with foreign libraries without their conventions clashing with my own |
07:08:46 | termer | I believe there are genuine benefits to this, not just stylistically |
07:09:25 | FromDiscord | <Graveflo> like what? |
07:09:56 | termer | the ability to use other libraries without dealing with conforming to their style |
07:10:26 | termer | also, when dealing with serialized data that came from, say, JSON, you can access the properties without having to switch to different cases |
07:10:41 | termer | like cool_thing can be accessed as coolThing |
07:11:09 | termer | this was personally helpful when I was writing a wrapper around the ffprobe CLI |
07:11:10 | FromDiscord | <Graveflo> wouldn't those be distinct dictionary keys in JSON? |
07:11:24 | termer | yes, but once you serialize them to an object, you can access them however you want |
07:11:44 | termer | it also helps when dealing with C libraries |
07:11:49 | termer | for the same reason |
07:12:01 | FromDiscord | <Graveflo> Alright that's fair |
07:12:15 | termer | in theory it's a bad thing because of ambiguity, but in practice, it reaps far more rewards than problems |
07:12:43 | termer | People get hung up on the hypothetical problems without actually using it |
07:12:53 | termer | and chances are you've already taken advantage of it without knowing it if you've wrapped C code |
07:13:17 | FromDiscord | <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:29 | FromDiscord | <ElegantBeef> Bridge has died |
07:13:33 | FromDiscord | <ElegantBeef> "Nim has tooling" ๐ |
07:13:56 | termer | futhark is your tooling for wrapped C code lol |
07:14:01 | FromDiscord | <Graveflo> T.T sometimes if I wait for 5 secs it'll notice that I declared a variable 1 line above |
07:14:09 | termer | yeah |
07:14:16 | FromDiscord | <Graveflo> and I think thats not even nimsuggest |
07:14:29 | termer | but the problem isn't that bad compared to the fact that absolutely everything is brought into the current namespace |
07:14:32 | FromDiscord | <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:33 | termer | that's a real problem for me |
07:14:50 | termer | ElegantBeef, I considered using Futhark but decided against it |
07:14:52 | termer | too huge |
07:14:53 | FromDiscord | <ElegantBeef> That's never a problem |
07:14:54 | termer | too magical |
07:15:13 | termer | Everything being brought into the current namespace makes some things very confusing |
07:15:16 | FromDiscord | <ElegantBeef> I really like the premise, but I also like concrete definitions I know pmunch was working in that regard i think |
07:15:27 | FromDiscord | <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:38 | termer | that's probably what I'd do |
07:15:43 | FromDiscord | <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:44 | FromDiscord | <Elegantbeef> Corruption is as old as democracy! |
07:15:49 | termer | if I remember correctly, it uses a giant C parser, which was enough to scare me off |
07:16:10 | termer | Elegantbeef, https://old.reddit.com/r/Libertarian/comments/9vg9e2/best_programming_language_for_those_who_love/# |
07:16:14 | FromDiscord | <ElegantBeef> Futhark uses libclang |
07:16:17 | termer | This is one of the funniest things I ever read about Nim |
07:16:38 | FromDiscord | <ElegantBeef> Jesus christ |
07:16:42 | FromDiscord | <Arathanis> In reply to @termer "<@145405730571288577>, https://old.reddit.com/r/Lib": what is the |
07:16:44 | FromDiscord | <Arathanis> (edit) "is" => "in" |
07:16:59 | FromDiscord | <Arathanis> this is one of the most ridiculous things ive ever seen |
07:17:04 | termer | I'm pretty libertarian myself, but imagine writing this |
07:17:14 | FromDiscord | <Arathanis> > Is this the programming language for Libertarians everywhere? ๐ค |
07:17:31 | termer | I've actually sold someone on Nim with this post, and the fact that it runs on XP |
07:17:47 | termer | both of which are some of the least useful ways to value the language |
07:18:02 | FromDiscord | <ElegantBeef> I mean I'm technically the impossible left wing libertarian so uhh hah? |
07:18:07 | FromDiscord | <Arathanis> this has to be satire |
07:18:18 | FromDiscord | <Arathanis> this can't possibly be genuine |
07:18:31 | FromDiscord | <ElegantBeef> If you use the term "commie" unironically you're a tosspot |
07:18:39 | FromDiscord | <ElegantBeef> It's just satire |
07:18:45 | FromDiscord | <ElegantBeef> Or the person is deranged |
07:18:47 | FromDiscord | <Arathanis> sent a long message, see http://ix.io/4xvD |
07:19:02 | FromDiscord | <Arathanis> (edit) "http://ix.io/4xvD" => "http://ix.io/4xvE" |
07:19:08 | termer | it's not satire, almost certainly not |
07:19:14 | termer | it would be good satire if it was |
07:19:27 | FromDiscord | <Arathanis> > Nim is a language that was designed for high-IQ programmers |
07:19:30 | FromDiscord | <ElegantBeef> Well they're just deranged |
07:19:30 | FromDiscord | <Arathanis> WOW |
07:19:42 | FromDiscord | <Graveflo> That would be a comedian who is targeting such a niche audience. Theres no way |
07:19:50 | FromDiscord | <Arathanis> i didn't realize it was popular to jerk it that hard |
07:19:55 | FromDiscord | <Arathanis> (edit) "popular" => "possible" |
07:20:01 | termer | basically, the people who are politically motivated and rightwing tend to get drawn to Nim because of Araq's abrasive and opinionated personality |
07:20:05 | FromDiscord | <ElegantBeef> Sorry to termer but that's libertarians for you ๐ |
07:20:17 | termer | I am a libertarian, I know a lot about these retards |
07:20:25 | FromDiscord | <Arathanis> what the fuck is "libertarian syntax" |
07:20:44 | termer | ok I'll concede that Nim does have libertarian/liberal/non-conservative syntax |
07:20:45 | FromDiscord | <Graveflo> the syntax doesn't tell you what to do |
07:20:47 | FromDiscord | <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:50 | termer | aka you really can write whatever you want however you want |
07:21:00 | termer | ElegantBeef, Something like that |
07:21:01 | termer | also McNukes |
07:21:41 | FromDiscord | <ElegantBeef> Gotta appreciate that account has been suspended |
07:21:54 | termer | most accounts that post funny things on Reddit have been suspended |
07:21:57 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xvF |
07:22:00 | FromDiscord | <Arathanis> so much for libertarian |
07:22:02 | termer | it's almost as bad as Twitter in that regard |
07:22:24 | termer | Arathanis, See bullet point "Despite being a high-productivity language, Nim is very type-safe, for conservative programmers who care about quality." |
07:22:34 | termer | which is somewhat contradictory to previous points |
07:22:41 | FromDiscord | <Arathanis> for conservative programmers ๐ |
07:22:55 | termer | conservative, I'm assuming not politically because libertarians hate conservatives |
07:23:05 | termer | I think it means literally conservative |
07:23:48 | FromDiscord | <Graveflo> still bad word choice tbh |
07:23:55 | termer | in a political post, yes |
07:23:58 | termer | in other contexts, no |
07:24:15 | termer | The 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:50 | FromDiscord | <Graveflo> that's a good way to put it |
07:25:11 | FromDiscord | <Graveflo> it's just bizarre |
07:25:38 | termer | I also think the idea of a language having a BDFL being inherently libertarian is pretty shaky given that's effectively monarchism |
07:25:56 | FromDiscord | <ElegantBeef> It literally has dictator in it |
07:26:05 | FromDiscord | <ElegantBeef> It's literally a form of governence and must be abolished |
07:26:11 | termer | I like Araq and his language so I don't care about him being BDFL, but it's not an inherently good system |
07:26:15 | termer | basically I like this king |
07:26:19 | termer | you know, that sort of thing |
07:26:29 | FromDiscord | <ElegantBeef> No I only know it's good to be king |
07:26:40 | termer | I just can't wait to be king |
07:27:15 | termer | It's interesting seeing posts from back when Nim reached 1.0 where there was a lot of genuine hype around the lang |
07:27:16 | termer | I miss it |
07:27:17 | FromDiscord | <Arathanis> i can't believe how self-aggrandizing this is |
07:27:25 | FromDiscord | <Arathanis> even the sources are steeped in it |
07:27:39 | FromDiscord | <ElegantBeef> In reply to @Arathanis "i can't believe how": This is that end of the libertarian spectrum |
07:27:48 | termer | can't remember how in the world I even found this post |
07:27:55 | termer | I don't use Reddit |
07:27:57 | FromDiscord | <ElegantBeef> The good ol' big brain ayn rand reading libertarians |
07:28:49 | FromDiscord | <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:54 | FromDiscord | <Arathanis> (edit) "i can just see this ... writing" added "guy" |
07:28:59 | FromDiscord | <ElegantBeef> Exactly |
07:29:34 | FromDiscord | <ElegantBeef> No laughter was in the room whilst writing just the mechanical noise of their typewriter |
07:30:18 | FromDiscord | <ElegantBeef> Tip tap tip tap, "This will show the commies" thought the elusive lbmn as he puffed his cigar. ๐ |
07:30:22 | termer | https://forum.nim-lang.org/t/10234 |
07:31:34 | FromDiscord | <ElegantBeef> inb4 lbmn is araq's account |
07:31:55 | termer | ahahaha |
07:32:26 | FromDiscord | <ElegantBeef> I had to investigate further |
07:32:34 | FromDiscord | <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:50 | FromDiscord | <Arathanis> sent a long message, see http://ix.io/4xvM |
07:32:58 | FromDiscord | <Arathanis> (edit) "http://ix.io/4xvM" => "http://ix.io/4xvN" |
07:33:17 | FromDiscord | <ElegantBeef> Now now arathanis we both no the response is "Those are wifely duties and I a man will not do them" |
07:33:21 | FromDiscord | <ElegantBeef> both know |
07:33:25 | FromDiscord | <Arathanis> omg |
07:33:40 | FromDiscord | <Arathanis> lol |
07:33:48 | termer | depends on what brand of libertarian you are |
07:34:00 | termer | if you're socially conservative with libertarian policy ideas then you may say that |
07:34:14 | termer | or you're one of the no-fucks-given libertarians then that post is probably exactly what you meant |
07:34:30 | termer | I've known both, and the latter is significantly more entertaining |
07:34:45 | FromDiscord | <Arathanis> now i have to go reread the libertarian harry potter spoof |
07:35:32 | termer | A 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:10 | termer | he doesn't even believe in marriage, not sure what he believes in besides freedom and chaos to be honest |
07:36:41 | FromDiscord | <ElegantBeef> Ah an anarchist |
07:36:47 | termer | pretty much |
07:36:53 | termer | well |
07:36:56 | termer | more like minarchist |
07:36:59 | termer | so not full anarchist |
07:37:02 | FromDiscord | <ElegantBeef> holy shit the guys name is actually "libman" just noticed his url on his github |
07:37:12 | termer | "Further reading: r/NoNetNeutrality" |
07:37:21 | termer | thought this was r/NoNutNovember for a minute |
07:37:25 | FromDiscord | <ElegantBeef> His name is a moniker for libertarian man, he thinks he's a superhero |
07:37:37 | termer | ummm... that's not what lib means |
07:37:41 | termer | it means LIBTARD |
07:37:50 | FromDiscord | <ElegantBeef> Shit you got me |
07:38:37 | termer | fuck you bastards for taking away my sleep in exchange for funny conversations |
07:38:47 | termer | no sleep tonight for me |
07:38:55 | * | boxuser joined #nim |
07:39:01 | FromDiscord | <ElegantBeef> Deprivation is theft |
07:39:08 | FromDiscord | <Graveflo> you can thank libman I guess |
07:39:11 | termer | you didn't abide by the NAP |
07:39:24 | FromDiscord | <ElegantBeef> Sorry that's not a Canadian policy |
07:39:30 | FromDiscord | <ElegantBeef> We're commies dont you know |
07:39:39 | termer | Canadians are socialist and don't know what NAP is |
07:39:46 | termer | all they know is how to manufacture my maple syrup |
07:39:48 | FromDiscord | <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:58 | termer | that's true |
07:40:06 | FromDiscord | <ElegantBeef> If we're socialists where the hell is my free dental, pharma, and optometry |
07:40:07 | termer | which is why I prefer to write Nim code solo where nobody can mess up all my stuff |
07:40:19 | FromDiscord | <ElegantBeef> You can also write TRMs to detect macro calls |
07:40:22 | termer | ElegantBeef, In your case it means you have high taxes |
07:40:23 | FromDiscord | <ElegantBeef> The chad way of doing it |
07:40:31 | termer | TRM? |
07:40:31 | FromDiscord | <ElegantBeef> "high taxes" |
07:40:37 | FromDiscord | <ElegantBeef> term rewriting macro |
07:40:45 | termer | macros to find macros |
07:40:52 | termer | that's the Nim I know and love |
07:40:55 | FromDiscord | <ElegantBeef> Indeed |
07:41:00 | FromDiscord | <ElegantBeef> You can use TRMs as a whole linter |
07:41:06 | FromDiscord | <ElegantBeef> semantic linting in the language |
07:41:06 | termer | hahaha holy shit |
07:41:09 | FromDiscord | <ElegantBeef> What other language can do this?! |
07:41:12 | termer | Rust |
07:41:17 | termer | I think |
07:41:20 | FromDiscord | <ElegantBeef> FREEDOM, put some eagles behind me |
07:41:21 | termer | kind of |
07:41:25 | FromDiscord | <ElegantBeef> Nah it doesnt have anything like TRMs |
07:41:44 | FromDiscord | <ElegantBeef> TRMs pattern match on ast and you run a macro on it |
07:41:53 | FromDiscord | <ElegantBeef> That's the antithesis of rust |
07:42:02 | FromDiscord | <mratsim> I have yet to try Rust procedural macros but I'm not hopeful |
07:42:07 | FromDiscord | <mratsim> Python has an AST module |
07:42:08 | FromDiscord | <ElegantBeef> It's supposed to be a ballache to use macros so you wish that macros are good |
07:42:25 | termer | I wanna create a macro for == that has a 1/10,000 chance of being != on each invocation |
07:43:07 | FromDiscord | <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:21 | FromDiscord | <ElegantBeef> Oh noes |
07:43:28 | FromDiscord | <ElegantBeef> https://forum.nim-lang.org/t/9739#64098 but yea cursed linter here |
07:43:50 | termer | oh god |
07:44:05 | FromDiscord | <ElegantBeef> I say cursed but I'm actually quite happy with that feature |
07:44:24 | FromDiscord | <ElegantBeef> It's actually a nice way of doing semantic linting |
07:44:38 | termer | that'd be interesting but it's way over my head |
07:45:15 | FromDiscord | <ElegantBeef> Well anything you can detect and error/warn like `for x in a[b..c]` for instance |
07:45:37 | FromDiscord | <ElegantBeef> That should be a `toOpenArray` in 99% of cases ๐ |
07:45:46 | termer | Aha |
07:46:03 | FromDiscord | <ElegantBeef> Or if you have a `a & b & c` |
07:46:37 | termer | has anyone actually done performance testing on NimVM |
07:46:48 | FromDiscord | <ElegantBeef> ring has a bit |
07:46:50 | termer | having far-reaching macros that do stuff like that must have some effect on compilation speed |
07:47:03 | FromDiscord | <ElegantBeef> No one uses patterns |
07:47:06 | FromDiscord | <ElegantBeef> So not really |
07:47:50 | termer | I hope not |
07:47:58 | termer | but it always seemed like a very likely possibility to me |
07:48:26 | FromDiscord | <ElegantBeef> Meh the compiler is slow due to it's design |
07:48:37 | FromDiscord | <ElegantBeef> If we want a faster compiler move to DOD and it'll magically be faster |
07:48:49 | termer | DOD? |
07:48:50 | FromDiscord | <ElegantBeef> Good luck rewriting it to be that way though |
07:48:55 | FromDiscord | <ElegantBeef> data oriented design |
07:49:07 | termer | there are rumors that the compiler is hard to work on and reason about |
07:49:21 | FromDiscord | <ElegantBeef> Depending on where you are that's certainly true |
07:49:22 | termer | I've personally felt inadequate to touch the compiler |
07:49:35 | FromDiscord | <ElegantBeef> I contribute to it and still feel that way ๐ |
07:49:36 | FromDiscord | <mratsim> In reply to @termer "has anyone actually done": @Araq always said that the NimVM is as fast as python. |
07:49:52 | FromDiscord | <ElegantBeef> It's not anymore it's slower than python, but ringabout has been addressing some issues |
07:50:02 | FromDiscord | <mratsim> In reply to @termer "there are rumors that": don't touch the typesystem/generics/static. The rest is OK. |
07:50:05 | termer | that sounds about right given that it's an interpreted lang effectively at that point |
07:50:14 | FromDiscord | <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:33 | FromDiscord | <ElegantBeef> Once you learn how it works it's not too bad |
07:50:43 | FromDiscord | <ElegantBeef> inst modules will still be confusing though |
07:50:56 | FromDiscord | <ElegantBeef> There are some bugs there I have 0 clue how to resolve without breaking other things |
07:51:02 | termer | generics shouldn't be TOO bad if you are able to reify early and be reasoning about real types |
07:51:09 | termer | but Nim has a lot of theoretical types |
07:51:09 | FromDiscord | <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:30 | FromDiscord | <ElegantBeef> The generic logic is hard to follow in the compiler regardless what you imagien |
07:51:34 | FromDiscord | <mratsim> so that can be a nice real-world bench. |
07:51:52 | FromDiscord | <mratsim> the type system is a nest of if-then-else |
07:52:31 | FromDiscord | <mratsim> thankfully bugs only happen at compile-time with it, compared to say, closure iterators. |
07:53:12 | FromDiscord | <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:23 | FromDiscord | <ElegantBeef> No clue I never use a debugger on the compiler |
07:53:36 | FromDiscord | <ElegantBeef> `??` and `astalgo` works fine |
07:56:11 | termer | I used GDB to test GDB with Nim and it worked fine for hello world |
07:56:16 | termer | can't say anything else about it |
08:02:44 | FromDiscord | <mratsim> I used GDB and lldb to extensively debug all my libraries. |
08:03:31 | FromDiscord | <ringabout> In reply to @mratsim "<@658563905425244160> in my cryptographic": cool |
08:14:13 | FromDiscord | <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:25 | PMunch | termer, 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:48 | PMunch | And 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:21 | PMunch | And 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:32 | FromDiscord | <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:58 | PMunch | True, but as I said you can use importc in different modules |
09:04:07 | FromDiscord | <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:58 | FromDiscord | <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:05 | FromDiscord | <chmod222> Would be nice to clean that up |
09:05:23 | PMunch | Not 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:04 | PMunch | chmod222, yes and no really |
09:07:03 | PMunch | You 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:39 | FromDiscord | <chmod222> That would work for me, I don't need to change things around luckily |
09:07:59 | FromDiscord | <chmod222> Just scan them to generate boilerplate in case the user doesn't want to do it themselves |
09:08:11 | FromDiscord | <jmgomez> I think you may be interested in https://nim-lang.org/docs/macrocache.html instead of using globals |
09:09:16 | FromDiscord | <chmod222> Good to know, I'll check that out |
09:09:16 | FromDiscord | <chmod222> I have one {.compileTime.} only, but it irks me |
09:10:07 | FromDiscord | <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:55 | PMunch | jmgomez, 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:11 | NimEventer | New 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:26 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4xw9 |
10:30:32 | FromDiscord | <voidwalker> `DbError = object of IOError` - if I except IOError it works |
10:36:32 | * | ntat joined #nim |
10:36:55 | FromDiscord | <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:45 | FromDiscord | <mratsim> In reply to @chmod222 "Can Macros scan things": Yes |
10:58:32 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4xwe |
10:59:13 | FromDiscord | <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:07 | FromDiscord | <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:28 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4xwg |
11:15:53 | FromDiscord | <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:07 | PMunch | Prestige, you can't have a seq of a concept, so that code won't work |
11:21:54 | FromDiscord | <Prestige> Yeah I was wondering if there was a way to provide a concrete type that would fit the concept |
11:23:42 | PMunch | Like this? https://play.nim-lang.org/#ix=4xwk |
11:24:54 | FromDiscord | <Prestige> Yeah, looks like I needed to use `:` |
11:25:13 | FromDiscord | <Prestige> did the playground just crash? |
11:25:46 | PMunch | Not unlikely :P |
11:26:18 | PMunch | Rebooting it now |
11:26:25 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/P27Ms |
11:27:23 | FromDiscord | <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:42 | PMunch | Andreas, no it's not? |
11:28:30 | FromDiscord | <Andreas> In reply to @PMunch "<@754284517316886598>, no it's not?": my bad, it just resurfaced, BIG THX |
11:30:14 | PMunch | System64_~_Flandre_Scarlet, yes: https://play.nim-lang.org/#ix=4xwn |
11:30:25 | PMunch | Andreas, no problem |
11:31:04 | PMunch | Prestige, never thought about this, but that is a great way to restrict a sequence actually |
11:32:06 | PMunch | You could even do this if you don't need the object for anything else: https://play.nim-lang.org/#ix=4xwo |
11:33:00 | FromDiscord | <Prestige> That's pretty nice yeah, ty for the help btw |
11:33:14 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "System64_~_Flandre_Scarlet, yes: https://play.nim-l": Ah yeah, it's copied |
11:33:38 | FromDiscord | <Prestige> I'm porting https://github.com/mapbox/delaunator to Nim |
11:36:05 | PMunch | Ooh, nice |
11:37:26 | PMunch | I'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:39 | FromDiscord | <Prestige> It's pretty amazing |
11:38:44 | PMunch | Basically I just wanted to do the triangulation and the spine-finding |
11:39:26 | FromDiscord | <Prestige> I'm writing it so I can use it for some gamedev stuff, should be a lot of fun |
11:40:24 | FromDiscord | <wrld> hey so |
11:40:31 | PMunch | Then combine it with this: https://www-ui.is.s.u-tokyo.ac.jp/~takeo/research/squirrel/index.html |
11:40:32 | FromDiscord | <wrld> im quite new to programming n stuf |
11:40:44 | FromDiscord | <wrld> but whats nim |
11:40:54 | PMunch | It's a programming language |
11:41:09 | FromDiscord | <wrld> ik but what does it do |
11:41:54 | FromDiscord | <michaelb.eth> In reply to @wrld "ik but what does": in comparison with other computer programming languages, or what are you asking? |
11:42:30 | FromDiscord | <wrld> what does nim do? |
11:42:50 | PMunch | wrld, 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:42 | FromDiscord | <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:08 | FromDiscord | <michaelb.eth> The answer is the same: language for expressing instructions to the computer |
11:44:42 | PMunch | michaelb.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:54 | FromDiscord | <voidwalker> wrld I think you're looking for https://scratch.mit.edu/explore/projects/all |
11:48:39 | FromDiscord | <michaelb.eth> HtDP2e + DrRacket could also be a good starting point, depending on age of the person, etc. |
11:49:20 | FromDiscord | <michaelb.eth> https://htdp.org/2023-5-12/Book/part_prologue.html |
11:49:32 | FromDiscord | <wrld> yup, tried scratch n stufโต(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
11:54:48 | PMunch | Right, 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:07 | PMunch | Not sure Racket is the best way to start out michaelb.eth, reverse polish notation isn't very intuitive to most people :P |
11:56:40 | PMunch | Unless you grew up like me using an old HP-41C as your only calculator.. |
11:57:35 | PMunch | wrld, 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:41 | PMunch | Or 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:46 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4xwt |
12:04:11 | FromDiscord | <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:57 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4xwt" => "https://play.nim-lang.org/#ix=4xwu" |
12:05:07 | PMunch | Probably by checking if the key exists before trying to insert it? |
12:05:48 | FromDiscord | <voidwalker> so I don't rely on exceptions hmm that might be a good direction |
12:07:09 | PMunch | Yup |
12:07:23 | PMunch | In general it's often a good idea to avoid exceptions for control flow |
12:07:43 | PMunch | They are meant to catch exceptional states, not to control the flow of your program |
12:07:57 | FromDiscord | <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:06 | FromDiscord | <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:56 | FromDiscord | <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:05 | FromDiscord | <michaelb.eth> sent a long message, see http://ix.io/4xww |
12:10:59 | FromDiscord | <michaelb.eth> finally, it's not reverse polish notation (RPN) ๐ |
12:12:36 | * | boxuser joined #nim |
12:13:00 | PMunch | voidwalker, not sure really. That does look a bit suspect |
12:13:30 | PMunch | Maybe it has to be a ref object of for that to work= |
12:14:21 | PMunch | michaelb.eth, oh sorry I just read like five lines and some of the code snippets |
12:14:34 | PMunch | That sounds like a good resource though |
12:16:11 | PMunch | And yeah I guess it's prefix notation and not RPN |
12:16:31 | PMunch | Not sure why I thought RPN, that would have the operators at the end as well.. |
12:18:27 | FromDiscord | <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:01 | PMunch | I 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:16 | FromDiscord | <michaelb.eth> haha, fair enough ๐ |
12:24:30 | FromDiscord | <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:45 | FromDiscord | <Andreas> (edit) "generec" => "generic" |
12:31:24 | PMunch | What's with this cursed spacing? |
12:35:20 | FromDiscord | <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:54 | PMunch | If you use an editor that wants something different to you you've already lost |
12:36:00 | FromDiscord | <Andreas> (edit) ":))" => ":))โตi think `ch.addr.id() is int` does the trick.." |
12:36:02 | PMunch | The whole point of an editor is to cater to you |
12:36:47 | FromDiscord | <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:57 | FromDiscord | <Andreas> (edit) "In reply to @PMunch "The whole point of": thats what ... wanted" added "i" |
12:38:37 | PMunch | I managed to make it match the concept, but that just gave me C compiler errors :P |
12:39:12 | FromDiscord | <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:17 | FromDiscord | <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:22 | FromDiscord | <Andreas> (edit) "it.." => "it..โตhttps://play.nim-lang.org/#ix=4xwD" |
12:42:29 | FromDiscord | <Kai.> Uh |
12:42:39 | FromDiscord | <Kai.> Nim tutorial doc hurting my head |
12:42:44 | FromDiscord | <Kai.> So much info in just one tutorial |
12:44:18 | FromDiscord | <mratsim> In reply to @Kai. "Nim tutorial doc hurting": That's why most Nim devs grow a second head after a week |
12:44:29 | FromDiscord | <Kai.> Damn |
12:44:36 | FromDiscord | <Kai.> I wanna use it cus lower level but |
12:44:57 | FromDiscord | <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:17 | FromDiscord | <mratsim> I think there is a nimscord bot |
12:45:42 | FromDiscord | <mratsim> but you can use Nim like Python with types for starters and slowly descend into ~~hell~~ lower level as needed |
12:49:47 | FromDiscord | <Kai.> In reply to @mratsim "I think there is": It is but idek how to import libs |
12:50:02 | FromDiscord | <Kai.> So I looked at how to make http requests and that made me want to barth |
12:50:33 | FromDiscord | <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:44 | PMunch | Kai., what's wrong with our HTTP requests? |
12:51:12 | FromDiscord | <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:13 | PMunch | voidwalker, "semi-functional" what does that mean? |
12:51:15 | FromDiscord | <Kai.> My problem uh |
12:51:37 | PMunch | Well if you find a program which stretches the full scope of what Nim can do please let me know |
12:51:47 | PMunch | I don't think any of us have gotten close to that yet |
12:51:50 | FromDiscord | <voidwalker> well it is not yet "correct", missing a strategy for picking up failed requests, and hardly optimal nor tidy : D |
12:52:02 | PMunch | Ah, I see |
12:52:13 | PMunch | Do you have a link though? I've been looking into DHT lately |
12:52:23 | FromDiscord | <Kai.> sent a code paste, see https://play.nim-lang.org/#ix=4l2S |
12:52:33 | FromDiscord | <Kai.> Async dispatch?? Std??? |
12:52:36 | FromDiscord | <voidwalker> no DHT yet, I was hoping I can steal it from status-im one day when my skills get better |
12:52:40 | FromDiscord | <Kai.> Where am I importing these from |
12:52:51 | FromDiscord | <voidwalker> from the std (standard library) |
12:52:52 | PMunch | The standard library |
12:53:01 | PMunch | That's what the `std` stands for |
12:53:03 | FromDiscord | <Kai.> What's the standard library exactly |
12:53:16 | PMunch | It's all the stuff that ships with the Nim compiler |
12:53:21 | FromDiscord | <voidwalker> libraries that are bundled with nim, expected to be there |
12:53:52 | PMunch | https://nim-lang.org/docs/lib.html |
12:54:17 | FromDiscord | <Kai.> In reply to @voidwalker "libraries that are bundled": Mkay mkay |
12:54:26 | FromDiscord | <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:41 | FromDiscord | <Kai.> How would get like the import for like nimscord |
12:54:44 | FromDiscord | <Kai.> I have the GitHub |
12:54:54 | PMunch | asyncdispatch is just for doing async stuff, you could use `newHttpClient` and drop the await and proc and stuff |
12:55:04 | FromDiscord | <mratsim> In reply to @Kai. "So I looked at": https://xmonader.github.io/nimdays/book_intro.html |
12:55:16 | FromDiscord | <Kai.> In reply to @PMunch "asyncdispatch is just for": Yeah but asynchronous programs best programs |
12:55:21 | PMunch | `nimble install nimscord`, and then `import nimscord` in your file I would assume |
12:55:29 | FromDiscord | <Kai.> Oh sick |
12:55:32 | FromDiscord | <Kai.> So like pip |
12:55:37 | PMunch | Yup |
12:55:47 | FromDiscord | <mratsim> In reply to @voidwalker "no DHT yet, I": https://github.com/status-im/nim-eth/blob/master/eth/p2p/kademlia.nim |
12:55:53 | FromDiscord | <Kai.> What about uh |
12:56:08 | FromDiscord | <Kai.> Is there decorators in nim? |
12:56:15 | PMunch | pragmas? |
12:56:20 | FromDiscord | <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:21 | FromDiscord | <Kai.> Like in python / java |
12:56:27 | FromDiscord | <Kai.> Idfk what a pragma is |
12:56:38 | PMunch | I don't know what a decorator is :P |
12:56:49 | FromDiscord | <mratsim> In reply to @voidwalker "<@570268431522201601> yeah that's where": Discovery v5 is a protocol to find Ethereum peers |
12:57:09 | FromDiscord | <mratsim> In reply to @voidwalker "<@570268431522201601> yeah that's where": spec is here: https://github.com/ethereum/devp2p |
12:57:23 | FromDiscord | <Kai.> sent a code paste, see https://play.nim-lang.org/#ix=4xwF |
12:57:47 | PMunch | And what exactly does that do? |
12:57:48 | FromDiscord | <that_dude> Well say it's basically the same |
12:57:49 | FromDiscord | <Kai.> sent a code paste, see https://play.nim-lang.org/#ix=4xwG |
12:57:54 | FromDiscord | <that_dude> But even stronger iirg |
12:57:59 | FromDiscord | <that_dude> (edit) "iirg" => "iirc" |
12:58:01 | FromDiscord | <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:09 | FromDiscord | <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:25 | FromDiscord | <voidwalker> although running a dht node as a separate service is actually a good idea, generally speaking |
12:58:25 | FromDiscord | <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:42 | FromDiscord | <Kai.> If ur making an API it makes it way easier for even driven programs |
12:58:50 | PMunch | Hmm, I think that's just done by wrapping stuff |
12:59:00 | PMunch | Or maybe through overloads, macros, etc. |
12:59:12 | FromDiscord | <Kai.> Idk what thoes are |
12:59:27 | PMunch | Basically I believe the stuff you would use decorators for in Python maps to different concepts in Nim |
12:59:37 | FromDiscord | <mratsim> In reply to @Kai. "If ur making an": create a pragma |
12:59:59 | FromDiscord | <Kai.> In reply to @mratsim "create a pragma": Wtf is a pragma |
13:00:02 | FromDiscord | <mratsim> example, create a pragma that warns about deprecation and points to the new name |
13:00:16 | FromDiscord | <Kai.> Bad example |
13:00:21 | PMunch | Well 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:21 | FromDiscord | <mratsim> In reply to @Kai. "Wtf is a pragma": (sry, busy for a hour or 2) |
13:00:25 | FromDiscord | <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:41 | FromDiscord | <that_dude> Do you have experience in typed languages? |
13:01:02 | PMunch | A 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:17 | FromDiscord | <Kai.> In reply to @that_dude "Do you have experience": Typed languages meaning I have to explicitly define the data type? |
13:01:49 | FromDiscord | <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:54 | FromDiscord | <that_dude> Yeah. Because the destinations between functions and templates and type manipulation matters more |
13:02:19 | FromDiscord | <Kai.> I'm obv more used to not defining types but it's something I can do |
13:03:18 | FromDiscord | <Kai.> Idk what's a GOOD program I can make thatll help me stretch my legs |
13:05:34 | FromDiscord | <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:01 | FromDiscord | <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:22 | FromDiscord | <Kai.> I don't need decorators it's just a cool feature of python |
13:09:06 | PMunch | The best is probably to find something you want/need and then try to implement that |
13:09:30 | PMunch | Then 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:34 | FromDiscord | <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:51 | FromDiscord | <that_dude> Yeah don't worry about this stuff if you don't need to yet. |
13:10:05 | om3ga | ARC/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:08 | PMunch | This might help as well to get a brief overview: https://learnxinyminutes.com/docs/nim/ |
13:10:34 | FromDiscord | <Kai.> Lol okay |
13:10:57 | om3ga | Is this such ideology to not free resources, even if it known that they will be not used anymore |
13:11:19 | FromDiscord | <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:21 | FromDiscord | <Kai.> sent a long message, see http://ix.io/4xwM |
13:11:35 | FromDiscord | <Kai.> Gotchu |
13:11:36 | FromDiscord | <that_dude> Can someone post the link to awesome nim? |
13:11:43 | om3ga | or I can ask for future request of proc that forces collector to destroy obj? |
13:11:47 | * | ntat quit (Quit: Leaving) |
13:12:11 | FromDiscord | <that_dude> https://github.com/ringabout/awesome-nim |
13:12:28 | FromDiscord | <that_dude> Found it. Check out this for a lot of useful packages |
13:12:31 | FromDiscord | <Kai.> What's that |
13:12:33 | FromDiscord | <Kai.> Okay |
13:13:30 | FromDiscord | <that_dude> Gotta drive so I'll let ya think and explore for a bit |
13:14:44 | FromDiscord | <Kai.> I sadly gotta sleep lol |
13:20:53 | PMunch | Pfft, sleep |
13:30:20 | FromDiscord | <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:50 | FromDiscord | <tsoj> I started to use `seq` with a single entry, but that is not really ergonimic. |
13:31:01 | FromDiscord | <chmod222> Which specific semantics do you need? |
13:31:10 | FromDiscord | <chmod222> You can always make it a ref object |
13:32:22 | FromDiscord | <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:06 | FromDiscord | <mratsim> In reply to @tsoj "Is there a way": seq of one element? |
13:33:12 | FromDiscord | <tsoj> yes |
13:34:01 | FromDiscord | <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:20 | NimEventer | New 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:23 | FromDiscord | <chmod222> ^ I'd be amazed if they change their course tbh |
13:37:59 | PMunch | I'll be gone if they don't |
13:38:14 | FromDiscord | <tsoj> Yeah, they can just rely on reddit being quite addictive for most of the users base |
13:38:34 | FromDiscord | <chmod222> I certainly won't use the dogshite official app, so that's it at least on the phone for me |
13:38:39 | PMunch | Been 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:21 | PMunch | I 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:10 | FromDiscord | <Kai.> In reply to @PMunch "Pfft, sleep": Was at work |
13:48:16 | FromDiscord | <Kai.> 1:20am to 11:50 am |
13:48:20 | FromDiscord | <Kai.> But I left early |
13:48:23 | FromDiscord | <Kai.> Cus fuck that shit |
13:50:51 | * | ntat joined #nim |
13:53:12 | om3ga | tsoi: declare your object element like someSeq: ref seq[type], and access the element like object.someSeq[] |
13:55:07 | om3ga | tsoj: [] is the same as & operator in C which returns address of the seq |
14:02:54 | FromDiscord | <tsoj> sent a code paste, see https://play.nim-lang.org/#ix=4xx3 |
14:03:58 | FromDiscord | <tsoj> (edit) "https://play.nim-lang.org/#ix=4xx3" => "https://play.nim-lang.org/#ix=4xx4" |
14:07:06 | FromDiscord | <chmod222> How big is this data? |
14:07:37 | FromDiscord | <chmod222> Would it work as a truly global variable, not bound to a stack of a function? |
14:11:33 | FromDiscord | <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:57 | FromDiscord | <chmod222> Ah, I see |
14:28:58 | FromDiscord | <chmod222> sent a long message, see https://paste.rs/Wwb8Z |
14:29:40 | FromDiscord | <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:43 | FromDiscord | <System64 ~ Flandre Scarlet> How can I get a ref to an object please? |
14:57:29 | FromDiscord | <chmod222> sent a code paste, see https://paste.rs/3mJTg |
14:57:32 | FromDiscord | <auxym> IIRC you can't. you can create a new ref and copy the data from an existing obj though. |
14:58:13 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
14:59:52 | FromDiscord | <auxym> you can copy the data using `myRef[] = myObj` as long as myRef is of type `ref myObjType` |
15:03:02 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alrightโตAnd does Marshall supports ref objects and inheritence? |
15:12:19 | FromDiscord | <auxym> not familiar with marshall sry |
15:31:03 | NimEventer | New 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:53 | FromDiscord | <Arathanis> damn araq really just responded to that thread and chose violence |
16:49:57 | * | junaid_ joined #nim |
16:55:02 | FromDiscord | <Boston> You just described Araq |
16:55:43 | FromDiscord | <Arathanis> i know but its still fun to see |
16:56:03 | FromDiscord | <Chronos [She/Her]> Until he's wrong :p |
16:56:43 | FromDiscord | <Arathanis> In reply to @Hourglass, When the Hour Strikes "Until he's wrong :p": probably still be fun tbh :P |
16:56:57 | FromDiscord | <jtv> I don't think it's particularly fun to see project leaders being condescending and rude, personally. |
16:57:38 | FromDiscord | <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:59 | FromDiscord | <Arathanis> with that said, I understand the exasperation someone might feel answering these kinds of questions day in and day out |
16:58:08 | FromDiscord | <System64 ~ Flandre Scarlet> @treeform Hi, does Flatty supports inheritence? |
16:58:44 | FromDiscord | <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:33 | FromDiscord | <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:03 | FromDiscord | <Arathanis> (edit) "to be" => "for the purposes of being" |
17:01:09 | FromDiscord | <Arathanis> (edit) "something" => "a statement" |
17:01:16 | FromDiscord | <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:20 | FromDiscord | <Arathanis> (edit) "fact." => "fact to them." |
17:02:04 | FromDiscord | <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:18 | FromDiscord | <jtv> He doesn't have to answer them. |
17:02:23 | FromDiscord | <Arathanis> Different kinds of bluntness perhaps. Not saying you are wrong, just that I am trying to be generous to everyone here. |
17:02:26 | FromDiscord | <jtv> He can... just ignore it and wait for someone else to help |
17:02:42 | FromDiscord | <Arathanis> I've definitely worked with German SWE that act like this and it was never them actually trying to be mean. |
17:02:51 | FromDiscord | <Arathanis> Ok maybe once. |
17:02:53 | FromDiscord | <Arathanis> lol |
17:03:34 | FromDiscord | <Arathanis> Again, not trying to justify it. you may very well be right. It is a fairly consistent kind of response. |
17:03:51 | FromDiscord | <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:11 | FromDiscord | <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:24 | FromDiscord | <Graveflo> I just think things go smoothlier when everyone is given some grace |
17:04:38 | FromDiscord | <Graveflo> even if its the leniency to speak frankly |
17:05:12 | FromDiscord | <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:48 | FromDiscord | <Arathanis> https://media.discordapp.net/attachments/371759389889003532/1115325607048380486/image.png |
17:05:57 | FromDiscord | <Arathanis> Can we just put ChatGPT in front of their responses? |
17:06:01 | FromDiscord | <Arathanis> ๐ |
17:06:29 | * | rockcavera joined #nim |
17:07:29 | FromDiscord | <Nerve> doubles the word count |
17:08:07 | FromDiscord | <System64 ~ Flandre Scarlet> Is there anything that lets you serialize Ref objs? |
17:08:45 | FromDiscord | <Arathanis> In reply to @Nerve "doubles the word count": Sure does, not a big deal imo |
17:09:21 | FromDiscord | <Arathanis> In reply to @System64 "Is there anything that": Serialize the deref version then when marshalling use it to init the ref? |
17:09:33 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Arathanis "Serialize the deref version": Problem is I use inheritence |
17:10:02 | FromDiscord | <Arathanis> Is it mangling the types? |
17:10:09 | FromDiscord | <Arathanis> Got code examples? |
17:10:38 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4xxL |
17:10:48 | FromDiscord | <voidwalker> omg just realized firefox can get xpath of html element, but no xpath support in nim : ( |
17:11:58 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4xxM |
17:13:49 | FromDiscord | <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:52 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @jtv "Type information isn't carried": I use flatty |
17:53:23 | FromDiscord | <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:46 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xy4 |
18:20:47 | FromDiscord | <sOkam!> i guess i can make the typedesc also a tuple, but wondering if its possible with varargs |
18:20:47 | FromDiscord | <Graveflo> `varargs[typedesc, typeof]` maybe? |
18:21:28 | FromDiscord | <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:39 | FromDiscord | <chmod222> Does that really work though? That'd be an open array of generic types |
18:21:49 | FromDiscord | <Graveflo> yea nvm mb that would be for input non-typedesc variables |
18:22:05 | FromDiscord | <sOkam!> In reply to @chmod222 "Does that really work": wdym? |
18:22:35 | FromDiscord | <chmod222> As I understand it, `typedesc` isn't a type in itself but a generic parameter much like `[T]` |
18:23:45 | FromDiscord | <sOkam!> so it might not be doable with varargs because of that? is that what you mean? |
18:25:06 | FromDiscord | <Graveflo> the compiler does let me make a `varargs` that has a unspecified generic type so maybe `typedesc` is different |
18:26:01 | FromDiscord | <sOkam!> problem is i think `typedesc` is not the same as `typedesc[int32]` if im not mistaken ๐ค |
18:26:21 | FromDiscord | <sOkam!> i figure it must be like an array or seq |
18:26:28 | FromDiscord | <sOkam!> so it must be coherent in type |
18:26:35 | FromDiscord | <sOkam!> (my best guess) |
18:26:51 | FromDiscord | <Graveflo> yea but I wonder why the compiler doesn't complain like it would if you put generic `seq` there |
18:30:13 | FromDiscord | <Elegantbeef> varargs has to be homogenous unless it's `varargs[typed]` inside a macro |
18:32:23 | FromDiscord | <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:31 | FromDiscord | <Graveflo> sent a code paste, see https://paste.rs/JfWGs |
18:57:40 | * | oprypin joined #nim |
18:58:58 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xyb |
18:59:45 | FromDiscord | <Arathanis> In reply to @Graveflo "this, although ridiculous, breaks": the double destructor foot gun |
19:00:43 | FromDiscord | <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:23 | FromDiscord | <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:30 | FromDiscord | <Arathanis> then when cleanup happens first one destructs |
19:01:38 | FromDiscord | <Arathanis> then the other destructs the same object which is already nil |
19:01:41 | FromDiscord | <Arathanis> kaboom |
19:04:29 | FromDiscord | <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:10 | FromDiscord | <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:21 | FromDiscord | <Arathanis> yeah, just remember its all GCed |
19:05:24 | FromDiscord | <Arathanis> and refs are GCed pointers |
19:05:47 | FromDiscord | <Arathanis> so if you make a ref from a non-ref GCed var you gonna get two destructors |
19:05:58 | FromDiscord | <Arathanis> or at least that is what i think is happening. beef will come tell me why im deeply wrong |
19:06:18 | FromDiscord | <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:33 | FromDiscord | <Arathanis> and keep this from happening |
19:06:46 | FromDiscord | <Arathanis> it would mean you shouldn't access the original var anymore |
19:29:23 | FromDiscord | <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:29 | FromDiscord | <Graveflo> and I mean I'll avoid casting my own refs not nims built in move semantics |
19:31:11 | FromDiscord | <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:39 | FromDiscord | <Arathanis> and yeah, iirc a `move` means that the owner of the var has shifted. |
19:33:53 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xyd |
19:36:07 | FromDiscord | <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:06 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xye |
19:37:13 | FromDiscord | <Arathanis> https://media.discordapp.net/attachments/371759389889003532/1115363715529842698/image.png |
19:37:31 | FromDiscord | <Graveflo> yea but if you comment out `i_duplicate_ref` there is still two prints |
19:38:03 | FromDiscord | <Arathanis> But there are two |
19:38:35 | FromDiscord | <Graveflo> oh is there the one that is created from `MyObject` s constructor hanging around? |
19:38:43 | FromDiscord | <Graveflo> oh wait |
19:38:46 | FromDiscord | <Graveflo> ok nvm xd |
19:38:57 | FromDiscord | <Arathanis> 1st one `var d = MyObject(encap: "test")` |
19:39:04 | FromDiscord | <Arathanis> 2nd one `var v = Book(encap: new(MyObject))` |
19:40:01 | FromDiscord | <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:28 | FromDiscord | <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:55 | FromDiscord | <@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:02 | FromDiscord | <@theperfectcomputer-628303036da0> via a fifo |
19:41:21 | FromDiscord | <@theperfectcomputer-628303036da0> does the nim produce/consumer communcation lib have a lot of overhead? |
19:41:28 | FromDiscord | <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:43 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xyf |
19:46:22 | NimEventer | New Nimble package! guardmons - Cross-platform collection of OS Utilities, see https://github.com/treeform/guardmons |
19:47:20 | FromDiscord | <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:16 | FromDiscord | <Chronos [She/Her]> Tempted to try writing a Nim backend again |
19:55:37 | * | oldpcuser quit (Ping timeout: 240 seconds) |
20:01:50 | FromDiscord | <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:03 | FromDiscord | <Chronos [She/Her]> Tho Java has threads instead of async |
20:09:37 | * | deadmarshal_ quit (Ping timeout: 265 seconds) |
20:25:57 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4xyj |
20:26:25 | FromDiscord | <Graveflo> that is what I was trying to prove but I failed |
20:26:45 | FromDiscord | <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:18 | FromDiscord | <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:32 | FromDiscord | <Chronos [She/Her]> In reply to @auxym "async in nim FYI": Yep but NimSkull doesn't have that |
20:27:49 | FromDiscord | <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:04 | FromDiscord | <Chronos [She/Her]> I can't focus on one project for long, that's my issue :p |
20:28:11 | FromDiscord | <etra> fair |
20:28:12 | FromDiscord | <Chronos [She/Her]> Physically can't otherwise I'll get bored |
20:28:19 | FromDiscord | <Chronos [She/Her]> And end up doing nothing |
20:28:19 | FromDiscord | <etra> yea |
20:28:24 | FromDiscord | <etra> (edit) "yea" => "yeah that can happen haha" |
20:29:01 | FromDiscord | <willyboar> In reply to @Hourglass, When the Hour Strikes "Yep but NimSkull doesn't": I think they will replace async with CPS |
20:29:16 | FromDiscord | <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:26 | FromDiscord | <etra> I was writing some bindings in nim and had fun, though. |
20:30:08 | FromDiscord | <ieltan> I hear a lot about CPS |
20:31:10 | FromDiscord | <etra> (edit) "singlethreaded" => "single-threaded" |
20:31:37 | FromDiscord | <willyboar> We will be able to tell more about nimskull when they release. I don't know when that happen though. |
20:32:00 | FromDiscord | <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:16 | FromDiscord | <willyboar> It seems they do a lot of work. |
20:38:15 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> @Graveflo\: stop it, stop casting pointers to refs and expecting it not to behave oddly |
20:39:32 | * | oldpcuser joined #nim |
20:40:34 | FromDiscord | <Graveflo> ok sorry. My curiosity is satiated for now. I'll go back to pretending I'm sane |
20:40:59 | FromDiscord | <Elegantbeef> Good |
20:41:18 | FromDiscord | <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:06 | FromDiscord | <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:22 | FromDiscord | <Graveflo> In reply to @Elegantbeef "<@136570191038513152>\: Nope it doesnt": Does the gc not track `cast`ed refs then? |
20:43:30 | FromDiscord | <Elegantbeef> Of course not it's unsafe code |
20:43:39 | FromDiscord | <Elegantbeef> I mean it attempts to use them |
20:43:42 | FromDiscord | <Elegantbeef> But they do not behave properly |
20:44:03 | FromDiscord | <Chronos [She/Her]> In reply to @willyboar "You mean libraries that": Yeah, or newer Nim features |
20:44:15 | FromDiscord | <Elegantbeef> It 'tracks' them but it doesnt mean that they work as you intend |
20:44:34 | FromDiscord | <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:52 | FromDiscord | <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:05 | FromDiscord | <Elegantbeef> all is a stretch |
20:46:11 | FromDiscord | <Elegantbeef> Some code will work just fine |
20:47:44 | FromDiscord | <Elegantbeef> grave looking at this code calling `iDoSomething` does not tick the ref |
20:48:10 | FromDiscord | <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:42 | FromDiscord | <Graveflo> that's true. I guess I should have given the ref to an object that was created outside the proc? |
20:49:00 | FromDiscord | <willyboar> In reply to @Elegantbeef "Some code will work": Yes but libraries will probably need some changes |
20:49:03 | FromDiscord | <Elegantbeef> Probably, but this is just all inane ๐ |
20:49:18 | FromDiscord | <Elegantbeef> Like playing darts using a javelin, you're missing the point |
20:49:42 | * | oldpcuser_ joined #nim |
20:49:57 | FromDiscord | <Graveflo> what's the point? |
20:50:10 | FromDiscord | <Elegantbeef> The point is stop it, get some help |
20:50:30 | FromDiscord | <Graveflo> you sounds like all those doctors that I ignored |
20:51:06 | FromDiscord | <Elegantbeef> "I drink 10 can of redbull daily, the heart noises are good noises, it means it's working" |
20:51:24 | FromDiscord | <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:50 | FromDiscord | <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:58 | FromDiscord | <Elegantbeef> If you think what you're doing is right it doesnt complain |
20:52:18 | FromDiscord | <Elegantbeef> As long as you're casting to a type \<= sizeof(source) it's fine |
20:52:39 | FromDiscord | <Arathanis> https://tenor.com/view/shoot-myself-in-the-head-cabin-fever-baby-girl-toy-gun-crying-gif-16610909 |
20:52:46 | FromDiscord | <Arathanis> Nim just lets us all do this ^ |
20:52:49 | FromDiscord | <Arathanis> we are in contrl |
20:52:51 | FromDiscord | <Arathanis> (edit) "contrl" => "control" |
20:53:04 | FromDiscord | <Elegantbeef> Well pointers are apart of Nim's unsafe subset |
20:53:14 | FromDiscord | <Elegantbeef> If you do not know what the implication of the subset is, do not use the, |
20:53:25 | FromDiscord | <Elegantbeef> It has memory safe references that can be used |
20:53:25 | FromDiscord | <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:33 | FromDiscord | <Arathanis> thanks for clarifying beef, i had a feeling i wasnt exactly right |
20:53:41 | FromDiscord | <Elegantbeef> Right no different to Rust's unsafe blocks |
20:54:00 | FromDiscord | <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:30 | FromDiscord | <Elegantbeef> `cast`, `addr`, `pointer`, `ptr` is the unsafe segment of Nim |
20:55:05 | FromDiscord | <Elegantbeef> Not any different to rust where you can grep for `unsafe` you can grep the same here ๐ |
20:55:14 | FromDiscord | <Arathanis> fair haha. |
20:55:37 | FromDiscord | <Arathanis> i like Nim more than rust right now anyway :P |
20:55:51 | FromDiscord | <Elegantbeef> Sure but I'm just giving a comparison to another memory safe language |
20:55:59 | FromDiscord | <Arathanis> oh yeah, i totally understand |
20:56:00 | FromDiscord | <Elegantbeef> There arent many memory safe system languages |
20:56:11 | FromDiscord | <Elegantbeef> Nim, Crystal, Rust,... one of those is a toy even more so than Nim |
20:56:14 | FromDiscord | <Arathanis> I just prefer Nim cause it doesn't scream at me |
20:56:19 | FromDiscord | <Arathanis> lets me do what i want |
20:56:26 | FromDiscord | <Arathanis> it's the most libertarian language after all ๐ |
20:56:41 | FromDiscord | <Elegantbeef> Right it solves memory safety in a nicer way and has arguably nicer features |
20:57:02 | FromDiscord | <Elegantbeef> Mixins are much nicer than traits due to the fact it's a shape based instead of implementation based matching imo ๐ |
20:57:06 | FromDiscord | <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:16 | FromDiscord | <Elegantbeef> Right |
20:57:42 | FromDiscord | <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:05 | FromDiscord | <Elegantbeef> Want to use a serialisation library on a type you didnt declare, it just works |
20:58:06 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Right it solves memory": agree |
20:58:09 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Mixins are much nicer": and agree |
20:58:52 | FromDiscord | <etra> In reply to @Elegantbeef "Mixins are much nicer": what are mixins |
20:58:52 | * | deadmarshal_ joined #nim |
20:59:22 | FromDiscord | <Elegantbeef> speaking of unsafe, sadly so many people use `cast` for type conversions |
20:59:23 | FromDiscord | <Elegantbeef> Really need better documentation on that I guess |
20:59:57 | FromDiscord | <Elegantbeef> Generic procedures that provide an interface allowing you to implement procedures on a type basis |
21:00:19 | FromDiscord | <Elegantbeef> the `mixin` keyword in Nim tells the compiler to look for a symbol at the instantiation site and declaration site |
21:00:28 | FromDiscord | <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:43 | FromDiscord | <Elegantbeef> Well there are some places it's safe to cast to refs ๐ |
21:01:10 | FromDiscord | <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:30 | FromDiscord | <Elegantbeef> `RefRoot` might work still though |
21:01:32 | FromDiscord | <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:34 | FromDiscord | <Elegantbeef> RootRef\ |
21:01:39 | FromDiscord | <chmod222> Time to look deeper into those places |
21:07:22 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> In like 99% of cases of type conversions it's just wrong |
21:07:44 | * | zgasma joined #nim |
21:08:15 | FromDiscord | <Elegantbeef> A valid usage is like `cast[uint8](myEnumSet)` |
21:08:53 | FromDiscord | <Elegantbeef> Assuming your enum has \<= 8 elements |
21:09:00 | FromDiscord | <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:27 | FromDiscord | <Elegantbeef> Luckily unsafeAddr no longer exists really |
21:09:43 | FromDiscord | <Elegantbeef> It exists for legacy in devel, but `addr` works everywhere now |
21:09:51 | FromDiscord | <etra> I see |
21:10:09 | FromDiscord | <etra> now it's time to do `unsafeCast` then :axlcat: |
21:10:23 | FromDiscord | <Elegantbeef> No |
21:10:26 | FromDiscord | <Elegantbeef> cast is implicitly unsafe |
21:10:35 | FromDiscord | <Elegantbeef> The correct thing is to educate how to do type conversions |
21:10:57 | FromDiscord | <Graveflo> Yea I didn't know about them until you showed me |
21:11:35 | FromDiscord | <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:19 | FromDiscord | <Elegantbeef> Also it sorta implies it only works for numerics |
21:12:29 | FromDiscord | <Graveflo> honestly reading that wouldn't give me confidence that it will work on non-primatives |
21:13:23 | FromDiscord | <Elegantbeef> Do me a favour and PR some expanded information there ๐ |
21:13:29 | FromDiscord | <Graveflo> the way I learn things it would be better to just teach the mechanics of the type system itself |
21:14:33 | FromDiscord | <Elegantbeef> Someone still should add the information we've discussed |
21:14:39 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> I just dont feel like doing it |
21:15:17 | FromDiscord | <Elegantbeef> Did i say never usue it chronos |
21:15:29 | FromDiscord | <Chronos [She/Her]> I've never used mixins in Nim tbh |
21:15:54 | FromDiscord | <Elegantbeef> Have you ever used jsony, jsonutils, or any other serialisation library? |
21:16:00 | FromDiscord | <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:15 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Have you ever used": I've used jason once? |
21:16:28 | FromDiscord | <Elegantbeef> There you go that's mixins |
21:16:29 | FromDiscord | <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:39 | FromDiscord | <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:44 | FromDiscord | <Elegantbeef> Nah type information is runtime |
21:16:54 | FromDiscord | <Elegantbeef> Think about `var p: Parent = Child()` |
21:17:01 | FromDiscord | <Elegantbeef> You still need type information to dispatch methods |
21:17:28 | FromDiscord | <Elegantbeef> Type information is a pointer stored before the struct on an object |
21:17:30 | FromDiscord | <Graveflo> yea but that could be an artifact of using `method` it doesn't necessitate it for other things. |
21:17:52 | FromDiscord | <Elegantbeef> You need it for `parent of Child` |
21:18:36 | FromDiscord | <Elegantbeef> Type information is needed at runtime for safe conversions from a type erased type |
21:18:38 | FromDiscord | <Graveflo> right. if the parent isnt the base class of the proc |
21:18:42 | FromDiscord | <Elegantbeef> Upcasted counts as type erased in my world |
21:19:21 | FromDiscord | <Elegantbeef> Nah etra most people do not understand mixins until they see an example or get an explanation |
21:19:29 | FromDiscord | <Elegantbeef> Even then @Ayy Lmao took 30 years to understand them |
21:19:29 | FromDiscord | <Graveflo> and also assuming that language doesn't create a generic, which I know it doesnt but thats bc you said so |
21:19:51 | FromDiscord | <Elegantbeef> > and also assuming that language doesn't create a generic,โต? |
21:19:56 | FromDiscord | <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:32 | FromDiscord | <Elegantbeef> Anyone want to document mixins better as well. Writing is tedious ๐ |
21:20:40 | FromDiscord | <etra> In reply to @Arathanis "I asked this before!": oh, so like, requiring a type to implement a specific function? |
21:20:49 | FromDiscord | <etra> like, some sort of rust trait? |
21:20:50 | FromDiscord | <Arathanis> not necessarily required to implement |
21:21:12 | FromDiscord | <Arathanis> it means different modules can have different implementations for that mixin is my understanding |
21:21:23 | FromDiscord | <Arathanis> i think it falls back to whatever impl has the closest proximity to the call? |
21:21:35 | FromDiscord | <huantian> Having deja vu for last night beef lmao |
21:22:05 | FromDiscord | <Elegantbeef> Mixins are just generic procedures that you can define the procedures later |
21:22:26 | FromDiscord | <Elegantbeef> Well mixin symbols are symbols that can be implemented after declaration |
21:22:27 | FromDiscord | <Elegantbeef> Binded symbols have to be implemented before declaration |
21:22:51 | FromDiscord | <Elegantbeef> Yea huan for some reason some guy brings up mixins and everyone comes out the woodworks |
21:23:19 | FromDiscord | <etra> perks of discord not being the best platform for SEO :p |
21:23:56 | FromDiscord | <Elegantbeef> There we go mixin in action |
21:23:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/wywiJ |
21:24:05 | FromDiscord | <Elegantbeef> Someone copy that to the mixin examples, thanks |
21:24:43 | FromDiscord | <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:51 | FromDiscord | <etra> (edit) "ooc," => "ooc (and offtopic)," |
21:25:01 | FromDiscord | <Graveflo> sent a long message, see http://ix.io/4xyz |
21:25:13 | FromDiscord | <huantian> Thatโs a lot of words |
21:25:15 | FromDiscord | <Elegantbeef> No I just try to capitalise properly. It's hard |
21:25:43 | FromDiscord | <Elegantbeef> You can only use `a of B` on a type that is a subtype of `typeOf(a)` |
21:26:19 | FromDiscord | <Elegantbeef> Actually that might be wrong, but it only works on the inheritance tree of `typeof(a)` if i recall correctly. |
21:26:25 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4xyB |
21:26:33 | FromDiscord | <Elegantbeef> If you want to call it that way |
21:26:46 | FromDiscord | <Elegantbeef> I prefer it "opens the symbol so declaration and instantiation scopes can be considered for overload" |
21:27:52 | FromDiscord | <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:59 | FromDiscord | <Elegantbeef> I have no clue what you generic remarks are about |
21:30:02 | FromDiscord | <Elegantbeef> I attempt to read your writing and it just reads as technobabble |
21:30:25 | FromDiscord | <Graveflo> it is! that's my specialty |
21:30:39 | FromDiscord | <Elegantbeef> Ah good, I'm lost reading your subclass stuff |
21:31:32 | FromDiscord | <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:36 | FromDiscord | <Elegantbeef> It does force object types though |
21:31:42 | FromDiscord | <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:02 | FromDiscord | <Elegantbeef> Well just stick to safe Nim for now ๐ |
21:35:07 | FromDiscord | <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:44 | FromDiscord | <chmod222> segmentation faults that disappear when I compile with --debugger\:native |
21:41:47 | FromDiscord | <chmod222> Gotta love it |
21:41:49 | * | disso-peach quit (Quit: Leaving) |
21:42:26 | FromDiscord | <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:49 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xyF |
21:55:40 | FromDiscord | <Elegantbeef> What? |
21:56:07 | FromDiscord | <Graveflo> the generic doesn't infinitely recurse but the method does |
21:56:13 | FromDiscord | <Elegantbeef> `my_string` is a method if you want to use `procCall` use the `procCall` |
21:57:16 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> Right I just showed you it |
21:57:45 | FromDiscord | <Elegantbeef> `procCall BaseClass(self).myString)` |
22:00:50 | FromDiscord | <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:55 | FromDiscord | <Boston> sent a code paste, see https://play.nim-lang.org/#ix=4xyI |
22:12:40 | FromDiscord | <Boston> (edit) "https://play.nim-lang.org/#ix=4xyI" => "https://play.nim-lang.org/#ix=4xyJ" |
22:15:32 | FromDiscord | <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:59 | FromDiscord | <Boston> Is using the array the correct answer and I'm just picky or am I missing something |
22:27:25 | FromDiscord | <Elegantbeef> `DWord` is this 32 bits? |
22:28:06 | FromDiscord | <Elegantbeef> secondly `device` is nil by default |
22:28:30 | FromDiscord | <Elegantbeef> you likely can just do `var device = newString(256)` and then `echo SiGetProductString(0, device[0].addr, 0x01)` |
22:29:10 | FromDiscord | <Elegantbeef> `ptr cstring` is just wrong since that's pointer to pointer, unless it's allocating and mutating a cstring atleast |
22:29:19 | FromDiscord | <Elegantbeef> I assume it writes to the buffer you give it assuming it's 256 bytes wide |
22:31:00 | FromDiscord | <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:16 | FromDiscord | <Elegantbeef> @Boston\: |
22:31:48 | * | oldpcuser_ is now known as oldpcuser |
22:32:23 | * | deadmarshal_ joined #nim |
22:36:15 | FromDiscord | <Elegantbeef> In hindsight the proc should take a cstring and you should do `SiGetProductString(0, cstring device, 0x01)` |
22:38:33 | FromDiscord | <Boston> Dword is a C unsigned long, and the compiler is unhappy about newString[256], am I missing an import? |
22:39:30 | FromDiscord | <Boston> (edit) "long, and the compiler is unhappy about newString[256], am I missing an import?" => "long" |
22:39:50 | FromDiscord | <Boston> In reply to @Elegantbeef "In hindsight the proc": This worked ๐๐ |
22:51:38 | FromDiscord | <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:07 | FromDiscord | <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:23 | FromDiscord | <chmod222> Compiling with debug symbols makes the segfault go away so I'm somewhere in undefined behaviour |
22:56:00 | FromDiscord | <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:38 | FromDiscord | <chmod222> Funnily enough, if I compile with -d\:danger it also doesn't explode |
22:59:49 | NimEventer | New thread by lewisl: Object Variant question, see https://forum.nim-lang.org/t/10249 |
23:06:38 | FromDiscord | <Elegantbeef> That sounds proper as long chmod |
23:06:46 | FromDiscord | <Elegantbeef> Whoops change of thought mid sentence |
23:06:48 | FromDiscord | <Elegantbeef> Yea that's fine |
23:16:22 | FromDiscord | <chmod222> Alright, so the issue may be somewhere else. That is a topic for tomorrow then |
23:16:30 | FromDiscord | <chmod222> Thank you |
23:52:12 | FromDiscord | <inv> Hello, question about Mastering Nim again: https://nim-lang.org/docs/destructors.html#hook-generation |
23:52:36 | FromDiscord | <inv> sent a code paste, see https://play.nim-lang.org/#ix=4xyS |
23:53:31 | FromDiscord | <inv> how is it possble to generate hook in let/var ? |
23:54:06 | FromDiscord | <Elegantbeef> The compiler can cause it's the compiler |
23:54:13 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> It stores them then generates them where needed |
23:54:25 | FromDiscord | <Chronos [She/Her]> Arc seems to play better tho |
23:54:58 | FromDiscord | <inv> Why it does not want to generate hooks just near type? |
23:55:28 | FromDiscord | <inv> why the "strategic places" are so special? |
23:56:18 | FromDiscord | <Elegantbeef> It's basically saying "On first usage hooks will be generated" |
23:56:47 | FromDiscord | <Elegantbeef> The mild reason for strategic is so you do not have to forward declare all your hooks |
23:57:31 | FromDiscord | <inv> But why is it ok for any other types, but not for hooks? |
23:57:39 | FromDiscord | <inv> (edit) "But why ... is" added "it" | removed "it" |
23:57:45 | FromDiscord | <Elegantbeef> What? |
23:58:10 | FromDiscord | <Elegantbeef> Hooks have to be generated on first use so the compiler knows what to do |
23:58:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/nBs6f |
23:58:43 | FromDiscord | <Elegantbeef> How does that compile if you do not lift a destructor? |
23:58:54 | FromDiscord | <Elegantbeef> Imagine `=destroy` is inserted not written |
23:58:59 | FromDiscord | <inv> Probably I lost why it is bad to make it just before type |
23:59:05 | FromDiscord | <inv> (edit) "Probably I lost why it is bad to make it just before type ... " added "declaration" |
23:59:13 | FromDiscord | <Elegantbeef> Cause you need to be able to override them |
23:59:27 | FromDiscord | <Elegantbeef> Only one can exist, you have to be able to override them |
23:59:38 | FromDiscord | <Elegantbeef> As such the compiler implicitly generates one on first usage |
23:59:43 | FromDiscord | <inv> it explains. Thank you! |
23:59:53 | FromDiscord | <inv> ... or uses my own |