00:09:59 | FromDiscord | <huantian> Hey beef you should add a trm to slicerator that detects toSeq/map/filter usage that could be written with your iterator stuffs |
00:10:38 | FromDiscord | <Elegantbeef> What does that solve? |
00:10:49 | FromDiscord | <Elegantbeef> If you import my module you get the performance benefit |
00:11:27 | FromDiscord | <Elegantbeef> Atleast with itermacros |
00:13:53 | FromDiscord | <Elegantbeef> Assuming i get all the sequtils templates inside `itermacros` you can just replace all `sequtils` usage with my macros |
00:15:23 | FromDiscord | <huantian> Huh yeah ig |
00:23:06 | FromDiscord | <Elegantbeef> The real nice part is `var a = theVal.items.enumerate.filterIt(it[0] > 30).collect` just works |
00:25:08 | FromDiscord | <Elegantbeef> That slight hack really gives us so much more flexibility in iterators |
01:13:52 | * | nanxiao joined #nim |
01:17:01 | FromDiscord | <etra> In reply to @jmgomez "are you building a": maybe unrelated but, I've heard the term DSL multiple times and I know what the letters means, but do you know of any examples? either in Nim or well, I've mostly heard it from Ruby people |
01:21:19 | FromDiscord | <Elegantbeef> https://github.com/zevv/npeg↵https://nim-lang.org/docs/strscans.html↵https://github.com/can-lehmann/owlkettle |
01:29:14 | * | derpydoo joined #nim |
01:33:06 | FromDiscord | <ranok (Jacob Torrey)> Any tips for handling async JS calls in Nim? I pass a cb proc, but now how do I await it |
01:57:07 | FromDiscord | <sOkam!> In reply to @etra "maybe unrelated but, I've": owlkettle is probably a great nim example on what dsl is |
01:57:32 | FromDiscord | <sOkam!> essentially, you create a mini language to describe the funtionality that you want |
01:57:47 | FromDiscord | <sOkam!> nim metaprogramming is perfect for it, which is what owlkettle does |
01:58:42 | FromDiscord | <JJ> In reply to @etra "maybe unrelated but, I've": racket is well-known for ridiculous examples |
02:04:14 | FromDiscord | <JJ> sent a long message, see http://ix.io/4vVd |
02:04:32 | FromDiscord | <JJ> actually, i'm unsure if scribble is a dsl, i haven't used it |
02:28:13 | * | azimut_ joined #nim |
02:30:08 | * | azimut quit (Ping timeout: 240 seconds) |
03:03:27 | * | nanxiao quit (Quit: Client closed) |
03:14:22 | * | nanxiao joined #nim |
03:24:51 | FromDiscord | <etra> thanks for all the examples, now it's pretty clear to me what a DSL is 🙂 |
03:33:52 | FromDiscord | <michaelb.eth> In reply to @apropos "actually, i'm unsure if": scribble is a DSL that's a bit like markdown on super-steriods |
03:33:56 | FromDiscord | <michaelb.eth> (edit) "super-steriods" => "super-steroids" |
03:34:25 | FromDiscord | <michaelb.eth> https://docs.racket-lang.org/scribble/getting-started.html |
03:36:10 | FromDiscord | <michaelb.eth> It's been years since I played with it, but I was disappointed at the time to find that the implementation was very closely tied to the main use case, which is generating docs for Racket itself and Racket libraries. I had hoped it would be more extensible, as I wanted to use it for something else. It may have evolved since then, though. |
03:57:32 | FromDiscord | <voidwalker> any idea why compiler wouldn't pick up on an overloaded function variant ? |
03:57:43 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vVN |
03:59:30 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vVO |
04:03:11 | FromDiscord | <that_dude> The error should show each func. Is there something that could cause the second one to be missing? |
04:03:12 | FromDiscord | <Elegantbeef> Are you importing this module directly? |
04:03:22 | FromDiscord | <voidwalker> `import ./piece` |
04:03:51 | FromDiscord | <Elegantbeef> And it's definedi n `piece`? |
04:04:14 | FromDiscord | <voidwalker> indeed |
04:04:19 | FromDiscord | <that_dude> Kinda obvious question, but the file has been saved before compilation right? |
04:04:41 | FromDiscord | <voidwalker> yes, restart vscode a few times.. wanted to try nim stable but I already changed my code to use std/paths which is not in stable :\ |
04:05:30 | FromDiscord | <Elegantbeef> Well i'm internally saying you're lying to me |
04:08:47 | FromDiscord | <Elegantbeef> I'll say throw it on a branch if you want another set of eyes |
04:10:39 | FromDiscord | <voidwalker> https://media.discordapp.net/attachments/371759389889003532/1107882784153944104/simplescreenrecorder-2023-05-16_07.09.04.mkv |
04:11:50 | FromDiscord | <Elegantbeef> Is that async proc a generic? |
04:13:09 | FromDiscord | <voidwalker> just an async proc |
04:13:33 | FromDiscord | <Elegantbeef> Well I cannot say much without being able to reproduce so if it's not generic i'm lost |
04:17:07 | FromDiscord | <voidwalker> shall I update it on github ? |
04:17:20 | FromDiscord | <voidwalker> will you look at it I mean |
04:17:21 | FromDiscord | <Elegantbeef> If you want another set of eyes |
04:19:52 | FromDiscord | <Rika> takes your eyeballs |
04:20:50 | FromDiscord | <voidwalker> https://github.com/sgmihai/torrentim/tree/master |
04:22:55 | FromDiscord | <voidwalker> welp, try again, forgot to de-ignore test torrents folder, although this is compile time error so it shouldn't matter |
04:24:10 | FromDiscord | <Elegantbeef> Really need to setup an nimble file |
04:24:38 | FromDiscord | <voidwalker> I did |
04:24:48 | FromDiscord | <voidwalker> https://github.com/sgmihai/torrentim/blob/master/torrentim.nimble |
04:25:10 | FromDiscord | <voidwalker> Not sure how proper it is, I need to update it with nim version requirement |
04:26:17 | FromDiscord | <Elegantbeef> You have main and master branches 😄 |
04:26:32 | FromDiscord | <voidwalker> `requires "nim >= 1.9.3"` |
04:26:59 | FromDiscord | <voidwalker> Yeah idk anything about those and how it works, I am confused by git things ;\ |
04:27:00 | FromDiscord | <Elegantbeef> Uh huh |
04:27:12 | FromDiscord | <Elegantbeef> `types.nim(27, 33) Error: undeclared identifier: 'BencodeObj'` |
04:27:29 | FromDiscord | <voidwalker> requires "https://github.com/z-------------/nim-bencode#head" |
04:27:47 | FromDiscord | <Elegantbeef> I did `nimble install -d` |
04:27:52 | FromDiscord | <Elegantbeef> So i have bencode |
04:27:55 | FromDiscord | <Elegantbeef> But i now see the issue |
04:27:56 | FromDiscord | <Elegantbeef> It's on me |
04:29:27 | FromDiscord | <Elegantbeef> You modified a library and didnt use a fork to depend on 😄 |
04:29:41 | FromDiscord | <Elegantbeef> `privateAccess` from `importutils` probably is what you want |
04:29:46 | FromDiscord | <Elegantbeef> or `{.all.}` |
04:30:49 | FromDiscord | <voidwalker> oh shit I think I did.. bitVector |
04:31:08 | FromDiscord | <Elegantbeef> Or just PR into bitvector a `dataAddr` proc 😄 |
04:31:08 | FromDiscord | <voidwalker> #hack - BitVector.Base is not exported, I modified the file manually to export it. See if there is any workaround to this. |
04:31:09 | FromDiscord | <voidwalker> lmao |
04:31:50 | FromDiscord | <Elegantbeef> Ok now we're on the same page |
04:32:23 | FromDiscord | <voidwalker> I should put that lib in the project's folder I guess then ? Or make my fork on github and depend on that |
04:32:37 | FromDiscord | <Elegantbeef> `files2PiecesMap` vs. `files2PieceMap` |
04:32:39 | FromDiscord | <Elegantbeef> We're both blind |
04:33:24 | FromDiscord | <voidwalker> omfg |
04:33:34 | FromDiscord | <voidwalker> how does that compile though |
04:33:42 | FromDiscord | <Vincent Kadar> !!! Enjoy the most profitable financial market (crypto market ) as you get 100% profit...and you can also make up to $100k or more in 3days send me a private message and ask me HOW on TGhttps://t.me/VincentKadar |
04:34:04 | FromDiscord | <Elegantbeef> `BitVector` is a generic |
04:34:09 | FromDiscord | <Elegantbeef> You didnt give it a generic argument |
04:34:14 | FromDiscord | <that_dude> <@&371760044473319454> Clasic |
04:35:03 | FromDiscord | <voidwalker> so that makes it compile ? |
04:35:17 | FromDiscord | <voidwalker> even though there is no " files2PiecesMap(t.files, t.filesWanted, t.pieceSize, t.numPieces)" proc definition anywhere |
04:35:25 | FromDiscord | <Elegantbeef> You used the proc internally |
04:36:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4vVX |
04:36:24 | FromDiscord | <Elegantbeef> This does not error cause `MyType` is not concrete |
04:36:32 | FromDiscord | <Elegantbeef> Though it's not usable |
04:36:37 | FromDiscord | <Elegantbeef> So this is a compiler bug |
04:36:46 | * | nanxiao quit (Quit: Client closed) |
04:37:11 | FromDiscord | <voidwalker> I guess it's debateable if a bug or design |
04:37:20 | FromDiscord | <Elegantbeef> Well it's design but accidental bug |
04:39:02 | FromDiscord | <Elegantbeef> It's the mixin logic kicking in properly but for an unusable proc |
04:42:50 | FromDiscord | <Elegantbeef> Man docker really makes me feel like an idiot, I just want to copy a file after I build it to my host machine |
04:52:06 | FromDiscord | <wick3dr0se> Well if you ever need scripting help, I'm here |
05:08:19 | NimEventer | New thread by JohnAD: Macro compile-time comparison with define-pragmas, see https://forum.nim-lang.org/t/10199 |
05:17:03 | * | rockcavera quit (Remote host closed the connection) |
05:32:26 | FromDiscord | <michaelb.eth> In reply to @voidwalker "Yeah idk anything about": free online book, it's quite good and pretty easy to work through: https://git-scm.com/book/en/v2 |
05:33:46 | FromDiscord | <voidwalker> 500 page book.. yeah, very encouraging |
05:39:09 | FromDiscord | <michaelb.eth> Git Basics and Git Branching chapters would get you a pretty long way |
05:40:15 | FromDiscord | <michaelb.eth> (edit) "chapters" => "sections" |
05:48:02 | FromDiscord | <Arathanis> why is `M..<N` unusable in so many places where `M..N` is usable? |
05:49:27 | FromDiscord | <Elegantbeef> Cause `..<` is a template for a slice |
05:49:46 | FromDiscord | <Arathanis> No way around it? |
05:50:12 | FromDiscord | <Elegantbeef> `..<` is in userspace |
05:50:34 | FromDiscord | <Elegantbeef> `..` is both a type language syntax and user space slice |
05:51:39 | FromDiscord | <Arathanis> so `..` is part of a type definition, and `..<` is a template? |
05:52:28 | FromDiscord | <Elegantbeef> Right `..` is the only thing that exists in the type language |
05:53:08 | FromDiscord | <Arathanis> got it, so when instantiating a set for example, you have to have an Ordinal type in the square brackets and `..<` is not a type. |
05:53:40 | FromDiscord | <Arathanis> I suppose I assumed a template would rewrite to the appropriate type but I am guessing the square brackets on a set are not evaluated at that stage, they are evaluated earlier' |
05:53:41 | FromDiscord | <Elegantbeef> Yea |
05:53:42 | FromDiscord | <Arathanis> which is why this fails |
05:55:17 | FromDiscord | <Elegantbeef> Well `..` in type language is hard coded and defined as a range |
06:09:20 | * | azimut_ quit (Ping timeout: 240 seconds) |
06:21:52 | * | PMunch joined #nim |
06:44:54 | * | nanxiao joined #nim |
06:57:19 | * | Notxor joined #nim |
08:12:43 | FromDiscord | <voidwalker> not possible to provide a default type for a generic type parameter? |
08:14:57 | PMunch | https://play.nim-lang.org/#ix=4vWt |
08:15:08 | PMunch | Seems to work fine voidwalker |
08:15:49 | FromDiscord | <voidwalker> hm I guess I was not very clear |
08:16:26 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vWu |
08:16:32 | FromDiscord | <voidwalker> and to my surprise this compiles, so maybe the answer is yes |
08:16:51 | FromDiscord | <Rika> Why does there need to be a default type? |
08:17:02 | FromDiscord | <Rika> What does it bring in terms of functionality |
08:17:33 | FromDiscord | <voidwalker> well I am trying to write a bit array library by stealing from all the existing ones |
08:18:20 | FromDiscord | <voidwalker> And it would be nice not to need to specify integer unit base type, since it will be uint most of the times |
08:18:34 | FromDiscord | <voidwalker> while also allowing specifying other types, for whatever reason I can't think of now |
08:19:22 | PMunch | Often you'd have a deeper implementation type, and then just have your BitArray type be a specialized version of that using uint |
08:19:56 | FromDiscord | <Rika> I was thinking that’s not exactly an issue of generics |
08:21:31 | FromDiscord | <voidwalker> Not exactly sure I get what you mean PMunch.. example ? 🙂 |
08:24:02 | PMunch | Something like this: https://play.nim-lang.org/#ix=4vWv |
08:25:34 | FromDiscord | <voidwalker> BitVecSImpl[S: static int, B: SomeUnsignedInt = uint] = object # whatever your definition is here↵ BitVecS[S: static int] = BitVecSImpl[S] # This is now a specialized alias |
08:26:04 | PMunch | Did you just paste back my sample to me? |
08:26:20 | FromDiscord | <voidwalker> no, I put the default type parameter in there |
08:26:33 | PMunch | But you just said that that didn't work? |
08:26:36 | PMunch | I'm confused |
08:26:49 | FromDiscord | <voidwalker> It does work, at least it compiles |
08:27:08 | FromDiscord | <voidwalker> I read a stackoverflow answer that it doesn't, from 2021, maybe it got implemented in 1.9 |
08:27:57 | FromDiscord | <voidwalker> works in 1.6 as well |
08:29:49 | * | nanxiao quit (Ping timeout: 245 seconds) |
08:30:40 | FromDiscord | <N00nehere> how can i use nim with aws lambda? |
08:37:49 | PMunch | Same way you'd use AWS Lambda in any language I assume |
08:37:55 | PMunch | Or you could try a package: https://github.com/lambci/awslambda.nim |
09:08:17 | FromDiscord | <voidwalker> sent a code paste, see https://paste.rs/rXm |
09:08:36 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4vWE" => "https://play.nim-lang.org/#ix=4vWD" |
09:08:54 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4vWD" => "https://play.nim-lang.org/#ix=4vWF" |
09:09:12 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4vWF" => "https://play.nim-lang.org/#ix=4vWG" |
09:09:51 | FromDiscord | <voidwalker> I am wondering why the author chose to do that here: https://github.com/JorySchossau/bitset/blob/main/src/bitset.nim#LL9C16-L9C51 |
09:09:59 | * | nanxiao joined #nim |
09:13:47 | FromDiscord | <Elegantbeef> https://godbolt.org/z/T6Yfhnd4x |
09:16:20 | FromDiscord | <voidwalker> nice |
09:21:41 | FromDiscord | <voidwalker> @ElegantBeef https://play.nim-lang.org/#ix=4vWJ does this look right ? |
09:23:17 | FromDiscord | <Elegantbeef> Nope |
09:23:27 | FromDiscord | <Elegantbeef> Generics cannot have default types |
09:23:55 | FromDiscord | <voidwalker> says who ? |
09:24:07 | FromDiscord | <Elegantbeef> The compiler |
09:24:07 | FromDiscord | <voidwalker> the code appears to work correctly |
09:24:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4vWL |
09:25:33 | * | nanxiao quit (Quit: Client closed) |
09:26:45 | FromDiscord | <voidwalker> then how come this works ? https://play.nim-lang.org/#ix=4vWO |
09:28:17 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vWQ |
09:29:45 | FromDiscord | <Elegantbeef> Compiler bug that works in your favour |
09:29:55 | FromDiscord | <voidwalker> I'd say that's a feature |
09:31:58 | FromDiscord | <Elegantbeef> It's not intended so it's a bug |
09:32:09 | FromDiscord | <voidwalker> Well if it works correctly then it's a feature : D |
09:32:17 | FromDiscord | <voidwalker> an accidental feature ? |
09:35:28 | FromDiscord | <voidwalker> Is it because of using SomeUnsignedInt type class ? |
09:36:56 | FromDiscord | <voidwalker> well, anyways, it works so I don't complain. besides that, are there any improvements that could be done ? |
09:49:11 | FromDiscord | <Rika> In reply to @voidwalker "well, anyways, it works": Are you sure it will work for every case or are you just assuming |
09:49:42 | FromDiscord | <Rika> You will, will, will encounter weird behaviour in accepting something like that as “okay it works that’s the end of it” |
09:52:28 | FromDiscord | <voidwalker> Obviously I am assuming, and there's just 4 cases here, all uints, for which I tested and it works (apparently) |
09:53:15 | FromDiscord | <demotomohiro> sent a code paste, see https://paste.rs/IZI |
09:53:39 | FromDiscord | <voidwalker> well, it's supposed to be the size of an array, what does a -9 size array mean hmm |
09:55:03 | FromDiscord | <voidwalker> I was pondering if it's worth to write each uint size in bit operations instead of div/mod, but in this case the size of the array is compile time known and computed, so it makes no difference for the speed of the program |
09:55:13 | FromDiscord | <voidwalker> (edit) "I was pondering if it's worth to write ... each" added "for" |
10:00:31 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4vWW |
10:14:15 | Amun-Ra | is there a way for this to work: https://play.nim-lang.org/#ix=4vX0 |
10:24:25 | FromDiscord | <voidwalker> use let or var instead of const |
10:35:04 | FromDiscord | <chmod222> I think I already know the answer ("no"), but is it possible to modify the value of a global `const` or does Nim reserve the right to copy-paste `const`s like C #defines? |
10:35:52 | FromDiscord | <chmod222> Reason I'm asking is, my API definition contains a bunch of consts that are obviously const in a semantic sense, but I do have to query the actual const values from the API first, which can only be done on module load time |
10:35:55 | PMunch | chmod222§, the answer is no. If you want a compile-time variable you can edit you can use `var myThing: string {.compileTime.}` |
10:36:23 | FromDiscord | <chmod222> Not compile time as well sadly, if I knew the value at compile time I could just write them through the macro that's generating the code |
10:36:44 | PMunch | So you just need a runtime variable? |
10:37:05 | FromDiscord | <chmod222> It's a proper constant for the application loading my library as a shared library, but my shared library can only ask the host application for that consts value once loaded at runtime |
10:37:46 | FromDiscord | <chmod222> Semantically it's a const but for technical reasons it has to be a "set once and never modified ever again in this runtime" thing |
10:37:56 | PMunch | So a `let`? |
10:38:12 | FromDiscord | <chmod222> That'd be my next best option |
10:38:17 | Amun-Ra | voidwalker: hmm, yes, it works with let; I would have to check how that looks like in C code |
10:38:34 | PMunch | chmod222, that'd be your only option :P |
10:38:41 | FromDiscord | <chmod222> I assume `addr` of a let is a necessary evil |
10:39:00 | FromDiscord | <chmod222> I really don't want to expose my const as a var |
10:39:00 | PMunch | `addr` of let is still invalid isn't it? |
10:39:10 | PMunch | It at least used to be called `unsafeAddr` |
10:39:14 | FromDiscord | <chmod222> Well it's about to be made valid in nim 2 |
10:39:20 | PMunch | Right |
10:39:22 | FromDiscord | <chmod222> for now it's `unsafeAddr` |
10:39:27 | FromDiscord | <sOkam!> it will be available on devel afaik. in stable you can use unsafe |
10:39:36 | FromDiscord | <chmod222> But I live on the bleeding edge |
10:39:40 | PMunch | Well using `addr` should never be considered safe |
10:39:40 | FromDiscord | <chmod222> I care not for stable |
10:40:09 | FromDiscord | <chmod222> True |
10:40:18 | FromDiscord | <chmod222> But I'm already dealing with FFI so properly safe is out the window |
10:41:02 | * | derpydoo quit (Quit: derpydoo) |
10:41:16 | PMunch | Fair enough |
10:41:26 | PMunch | I use a bunch of `addr` for my Gtk stuff :P |
10:41:31 | FromDiscord | <chmod222> The annoying thing is that the API json I'm expanding into code already contains the const values, but they are in C++ notation and I'd have to parse it, which is even more painful |
10:42:02 | * | jmdaemon quit (Ping timeout: 246 seconds) |
10:42:20 | PMunch | C++ notation? |
10:42:30 | FromDiscord | <chmod222> sent a code paste, see https://play.nim-lang.org/#ix=4vX4 |
10:42:40 | PMunch | A simple const might be possible to feed through c2nim |
10:44:01 | FromDiscord | <chmod222> True, but then I'd have to actually replicate the type as C++ so the generated constructor binding works, which is another can of worms |
10:44:20 | FromDiscord | <chmod222> I'd rather generate the types as proper nim types since the boundary only deals in pointers anyways |
10:45:23 | FromDiscord | <chmod222> It's fine, I can deal with `let` consts |
10:47:04 | FromDiscord | <voidwalker> Can someone explain why this doesn't work: https://play.nim-lang.org/#ix=4vX5 - while the commented line variant works fine ? |
10:51:18 | FromDiscord | <Rika> Because you forgot to bind the generic parameters on the any types? |
10:54:17 | FromDiscord | <Piko> when the compiler throws an error in some module I haven't imported, how can I know what module is importing it? or what macro is generating that code or something |
10:57:56 | FromDiscord | <voidwalker> ohhh ok, thanks Rika. First time working with type aliases, only did generics once |
10:58:32 | FromDiscord | <voidwalker> (edit) "aliases," => "classes," |
11:00:50 | FromDiscord | <Piko> specifically, I'm getting↵`[...]/nim-1.6.12/lib/pure/nativesockets.nim(365, 22) Error: undeclared identifier: 'cstringArrayToSeq'`↵when using the js backend, and I have no idea why, no traceback, etc... |
11:01:39 | FromDiscord | <Piko> (exactly the same problem with nim devel) |
11:03:13 | FromDiscord | <demotomohiro> Is `nativesockets` module supports js backend? |
11:05:13 | FromDiscord | <Piko> I don't think so, but I'm not using it!! that's why I'm stumped |
11:05:58 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4vXc |
11:07:27 | FromDiscord | <chmod222> Well, `Vector2i` gets generated to ` Vector2i = object x: int32 y: int32` and I'd have to create a function called `proc Vector2i(...)` to replicate the constructor and that's much more annoying than swapping `const` for `let` |
11:08:12 | FromDiscord | <chmod222> All these objects have multiple constructors with various overloads but they can only be called at runtime because it goes through the godot API FFI interface |
11:08:21 | FromDiscord | <chmod222> So it cannot be a const even then |
11:08:37 | FromDiscord | <chmod222> I'd have to "guess" which parameter of the constant belongs to which field |
11:08:59 | FromDiscord | <demotomohiro> In reply to @Piko "I don't think so,": `--verbosity:2` compiler option might provide more info. |
11:10:05 | FromDiscord | <Piko> In reply to @demotomohiro "`--verbosity:2` compiler option might": it only adds:↵`/home/runner/work/nightlies/nightlies/nim-1.9.3/compiler/lookups.nim(558, 13) compiler msg initiated here [MsgOrigin]` |
11:10:32 | FromDiscord | <Piko> oh wait it added more things, hold on |
11:10:58 | FromDiscord | <Piko> no, just "added path ..." |
11:11:03 | FromDiscord | <demotomohiro> `--verbosity:3` provides more info and more noise. |
11:11:19 | FromDiscord | <jmgomez> chmod, hmm I thought you were at compile time, arent you? You want to generate Nim code that has the shape of the bindings, right? You can create a macro that gives you your const from that json |
11:11:36 | FromDiscord | <jmgomez> No need for for FFI if you already know the value |
11:11:50 | FromDiscord | <chmod222> Yes but the value is in a mostly unusable format |
11:12:18 | FromDiscord | <jmgomez> why is that? The sample you proposed is quite usable |
11:12:36 | FromDiscord | <chmod222> I don't have access to the "actual" constructor that is called in the string because it's C++ and I'm not binding to C++ where the constructor itself would be available |
11:13:04 | FromDiscord | <jmgomez> You dont need access to it, you just need to match the final result in memory |
11:13:24 | FromDiscord | <chmod222> The constructor I need to call at runtime is "globalGdInterfacePtr.variant\_get\_ptr\_constructor(5)(&args)" |
11:14:38 | FromDiscord | <chmod222> That's what I'm doing by reifying the API into the object, but how do I go from the String "Vector2i(0, 1)" to create an "Vector2i = object x\: int, y\: int" |
11:14:51 | FromDiscord | <jmgomez> I dont know, sounds too convoluted. If it helps, in NimForUE I have two kind of types, the actual real cpp type for what's in the PCH and a mirror type that is only compatible at the memory level |
11:14:51 | FromDiscord | <Piko> so I disabled all code, separated imports into their own lines and enabled one by one... I get the error with chronos (but also with asyncdispatch) ... how can I use JS async/await with nim? |
11:15:16 | FromDiscord | <chmod222> The constructors are overloaded so I cannot simply map parameter 0 to field 0 |
11:15:40 | FromDiscord | <jmgomez> What Im trying to say is are you sure you need to use the constructor? |
11:15:41 | FromDiscord | <Rika> In reply to @Piko "so I disabled all": Use https://nim-lang.org/docs/asyncjs.html |
11:16:07 | FromDiscord | <chmod222> I don't need the constructor for the simplest cases, no |
11:16:07 | FromDiscord | <Piko> In reply to @Rika "Use https://nim-lang.org/docs/asyncjs.html": ah thanks |
11:16:19 | FromDiscord | <chmod222> If you only want to set the fields, you can do that because I replicate the memory layout |
11:16:28 | FromDiscord | <chmod222> But there are multiple ctors |
11:16:47 | FromDiscord | <chmod222> sent a code paste, see https://play.nim-lang.org/#ix=4vXd |
11:17:18 | FromDiscord | <chmod222> And the constants in the json can use any format |
11:19:05 | FromDiscord | <chmod222> And yes, you can absolutely set x and y yourself (if the fields are exported in the API, that is, not all types do), but it wouldn't be a good autogenerated API if I don't auto generate all APIs |
11:21:38 | FromDiscord | <jmgomez> Not sure how "all APIs" look in Godot but you can just have `makeVector2i` in regular nim with all overloads and someone that uses Nim and Godot will see the equivalence |
11:22:28 | FromDiscord | <chmod222> That's pretty much what this above is, except `Vector2i.init` rather than `makeVector2i`, the overloads work in either case |
11:22:58 | FromDiscord | <chmod222> But to make the `"Vector2i(0, -1)"` exported constant work, I'd have to generate `proc Vector2i` which doesn't fit into the Nim style |
11:23:16 | FromDiscord | <chmod222> Or I'd generate both styles and have duplication |
11:23:29 | FromDiscord | <chmod222> Or muddle with the string... |
11:23:32 | FromDiscord | <chmod222> well |
11:23:39 | FromDiscord | <chmod222> Now that I think of it |
11:23:46 | FromDiscord | <jmgomez> You just need to parse it in macro time and assign the value |
11:24:12 | FromDiscord | <chmod222> Maybe I can just `konst.replace(selfType, selfType & ".init")` |
11:26:16 | FromDiscord | <voidwalker> How expensive is it to call `T.sizeof` in a generic proc ? vs using a literal |
11:27:03 | FromDiscord | <Rika> It is compile time calculated though |
11:27:17 | FromDiscord | <voidwalker> `proc sizeof[T](x: T): int {.magic: "SizeOf", noSideEffect.}` |
11:27:39 | FromDiscord | <voidwalker> so it's as good as a numeric literal ? |
11:27:53 | FromDiscord | <Rika> Pretty much |
11:29:48 | * | Guest28 joined #nim |
11:31:44 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4vXh |
11:34:12 | FromDiscord | <voidwalker> @System64 ~ Flandre Scarlet seems to work in nim-devel, but not in nim-stable |
11:34:20 | * | Guest28 quit (Client Quit) |
11:34:26 | FromDiscord | <voidwalker> (edit) "@System64 ~ Flandre Scarlet seems to work ... in" added "(compiles)" |
11:36:12 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright |
11:42:06 | FromDiscord | <Chronos [She/Her]> WASM library system might be interesting to implement... But a PAIN to actually use lmao, would need a ton of stubs |
11:42:19 | FromDiscord | <Chronos [She/Her]> Also no real use for it ig? |
11:42:28 | FromDiscord | <voidwalker> whaaat is the deaaal with waaasm |
11:43:01 | FromDiscord | <Chronos [She/Her]> Sandboxed environment that allows freedom of languages you can use, I'm gonna be using it in my MC server impl for the plugin system |
11:43:33 | FromDiscord | <Chronos [She/Her]> This way I can minimize the risks of someone blindly installing a malicious plugin |
11:43:45 | FromDiscord | <voidwalker> Minecraft? |
11:43:56 | FromDiscord | <Chronos [She/Her]> Yeah aha |
11:44:04 | FromDiscord | <voidwalker> whaaat is the deaaal with minecraft ? |
11:44:23 | FromDiscord | <Chronos [She/Her]> My favourite game xD |
11:44:28 | FromDiscord | <voidwalker> sanboxed environment in a sandbox game.. nice |
11:44:38 | FromDiscord | <voidwalker> where you can sanbox a nes emulator |
11:44:57 | FromDiscord | <Chronos [She/Her]> If the NES emulator is small enough probably could work xD |
12:10:17 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vXw |
12:10:24 | FromDiscord | <voidwalker> any idea why I have to write return before the last expression for it to work ? |
12:10:44 | FromDiscord | <voidwalker> oh nvm, it's not the (potentially) last line in the proc |
12:11:00 | FromDiscord | <voidwalker> even though logically it is : ) |
12:15:15 | FromDiscord | <Chronos [She/Her]> Is `runForever` blocking? |
12:16:02 | FromDiscord | <Chronos [She/Her]> Also if the `while true` block is already in the function, why is runForever needed? |
12:16:08 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4vXz |
12:28:31 | FromDiscord | <voidwalker> well if you know your async proc should never stop, you can also use waitFor |
12:28:43 | FromDiscord | <voidwalker> and yes, of course it is blocking |
12:29:26 | FromDiscord | <voidwalker> https://github.com/nim-lang/Nim/blob/f222625b17f90238cf7a31fec2d1b31447b6cd22/lib/pure/asyncdispatch.nim#L1953 |
12:32:53 | FromDiscord | <Duskhorn The Eclipsed> In reply to @Elegantbeef "<@786958459878637589> just remember I": Yes! It was me misunderstanding how to use generics in concepts |
13:26:10 | om3ga | double free or corruption (!prev) |
13:27:03 | om3ga | looks like using `=destroy`(.. ) was not the best idea |
13:30:29 | * | progranner joined #nim |
13:34:24 | FromDiscord | <voidwalker> can someone explain to me what's going on here ? https://godbolt.org/z/xnvrz8bb8 |
13:34:38 | FromDiscord | <voidwalker> (edit) "can someone explain to me what's going on here ? ... https://godbolt.org/z/xnvrz8bb8" added "test1 vs test2 procs" |
13:35:27 | FromDiscord | <voidwalker> Obviously the compiler does some optimisation, but one proc has one less shl, and a data16, whatever that is. Which is better ? |
13:35:40 | FromDiscord | <voidwalker> (edit) "a" => "an extra" |
13:35:44 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
13:37:11 | * | progranner joined #nim |
13:52:36 | FromDiscord | <demotomohiro> In reply to @voidwalker "can someone explain to": Measure speed correctly.↵Less instruction does not always mean faster code.↵Modern CPU do out of order execution, instruction level parallelism, register renaming etc. |
13:52:59 | FromDiscord | <voidwalker> Ok, I will do a 1 gazillion element benchmark when I finish |
13:54:17 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
13:55:33 | FromDiscord | <demotomohiro> On modern PC, memory access or IO is slower than speed of CPU.↵Such optimization might not make difference if your program is IO bound or memory bound. |
13:58:20 | FromDiscord | <voidwalker> When writing a general purpose public library, it is best to try your best to optimise |
13:59:16 | * | progranner joined #nim |
14:09:36 | NimEventer | New thread by alexeypetrushin: Get type of code block in template?, see https://forum.nim-lang.org/t/10200 |
14:12:21 | FromDiscord | <System64 ~ Flandre Scarlet> Is it possible to init a value type as reference type? |
14:12:52 | * | PMunch quit (Quit: Leaving) |
14:13:34 | FromDiscord | <voidwalker> what do you mean ? |
14:14:26 | FromDiscord | <System64 ~ Flandre Scarlet> instanciate on the heap |
14:15:25 | FromDiscord | <demotomohiro> Just add `ref` to type name like `ref array[2, int]`. |
14:16:16 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4vXZ |
14:16:38 | FromDiscord | <demotomohiro> yes |
14:17:12 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/1108035425383239730/image.png |
14:18:33 | NimEventer | New Nimble package! sha256_64B - sha256 hash of batches of 64B blocks in parallel via pure asm lib hashtree, see https://github.com/status-im/sha256_64B |
14:19:06 | * | azimut joined #nim |
14:19:30 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4vY2 |
14:19:39 | FromDiscord | <Rika> but also that new Type thing you do is already making refs no? |
14:22:10 | FromDiscord | <System64 ~ Flandre Scarlet> not sure↵But why between parenthesis? Is that a cast? |
14:24:11 | * | Notxor quit (Quit: Leaving) |
14:37:43 | FromDiscord | <Rika> no, i dont exactly know why the parentheses are needed but it might be related to parsing |
14:50:19 | FromDiscord | <JeanCareau> sent a long message, see http://ix.io/4vY9 |
14:52:53 | FromDiscord | <Chronos [She/Her]> I need to set up a simple environment now for my plugin system, that's a pain lol |
14:55:08 | * | lucasta joined #nim |
15:12:08 | FromDiscord | <Chronos [She/Her]> And a decent event handler system f |
15:12:14 | FromDiscord | <Chronos [She/Her]> Generics time |
15:18:09 | FromDiscord | <michaelb.eth> In reply to @JeanCareau "I get some fields": What OS are you using? |
15:22:21 | * | krux02 joined #nim |
15:27:39 | FromDiscord | <JeanCareau> @michaelb.eth Win11 |
15:30:45 | FromDiscord | <michaelb.eth> In reply to @JeanCareau "<@383034029135364096> Win11": one thing you can try is enabling UTF-8 support system wide, just a sec will get the instructions |
15:31:23 | FromDiscord | <JeanCareau> @michaelb.eth I think I already did |
15:31:56 | FromDiscord | <JeanCareau> Language settings -> Administrative language settings -> Change system locale -> Beta: Use Unicode UTF-8 for worldwide language support |
15:32:01 | FromDiscord | <JeanCareau> This one? |
15:32:04 | FromDiscord | <michaelb.eth> yes |
15:32:13 | FromDiscord | <michaelb.eth> and you restarted afterward, right? |
15:32:17 | FromDiscord | <JeanCareau> Yes |
15:32:27 | FromDiscord | <JeanCareau> I did change it a few weeks ago |
15:32:56 | FromDiscord | <michaelb.eth> I see, and are you running your nim program in Windows Terminal? |
15:33:14 | FromDiscord | <JeanCareau> Powershell. |
15:33:41 | FromDiscord | <michaelb.eth> that's the shell, the question is which terminal, though I realize that can be confusing |
15:33:56 | FromDiscord | <michaelb.eth> e.g. Windows Terminal can launch cmd.exe shell, PowerShell, bash, etc. |
15:36:03 | FromDiscord | <JeanCareau> Oh. I do not know. I start Windows PowerShell and then compile the nim files. Then I start the exe |
15:36:20 | FromDiscord | <michaelb.eth> that's okay, I was trying to think what else might be happening |
15:37:04 | FromDiscord | <JeanCareau> title_short = title[0..maxLen-1] |
15:37:10 | FromDiscord | <JeanCareau> Could it be this one? |
15:37:25 | FromDiscord | <JeanCareau> That the bytes get not connected correctly? |
15:37:33 | FromDiscord | <JeanCareau> When slicing? |
15:37:46 | FromDiscord | <michaelb.eth> looking at your code, it's not clear if maybe some of the procs you're using could possibly be treating the strings as ascii text (i.e. one byte, one character) but shouldn't be making that assumption |
15:38:02 | FromDiscord | <michaelb.eth> In reply to @JeanCareau "That the bytes get": yeah, that's what I'm wondering |
15:38:49 | FromDiscord | <michaelb.eth> you're probably already aware, but with utf-8 a codepoint can be 1, 2, 3, or 4 bytes |
15:39:15 | FromDiscord | <JeanCareau> sent a long message, see http://ix.io/4vYx |
15:39:39 | FromDiscord | <JeanCareau> sent a long message, see http://ix.io/4vYy |
15:39:42 | FromDiscord | <JeanCareau> These are my procs |
15:39:58 | FromDiscord | <JeanCareau> I have not much knowledge about encoding, UTF8 etc... |
15:43:54 | FromDiscord | <michaelb.eth> can you disable some of the text processing your doing (with the procs you pasted above), try saving the unprocessed data into a file, and see if you have the same problem when trying to read the file with python? |
15:44:37 | FromDiscord | <michaelb.eth> I suspect that one or more places where you're working with `char` isn't working out correctly for the utf-8 data |
15:44:51 | FromDiscord | <michaelb.eth> one `char` is basically one byte |
15:45:24 | FromDiscord | <wick3dr0se> How can I import a module I made? It's just a simple file with a few procs named test.nim. Shouldn't I be able to import it with absolute path or with just `import test` since it's in the same directory? |
15:45:41 | FromDiscord | <michaelb.eth> In reply to @wick3dr0se "How can I import": `import ./test` |
15:45:45 | FromDiscord | <wick3dr0se> I tried that too |
15:47:24 | FromDiscord | <enthus1ast> And it could also be that the connection itself is not set to utf-8 iirc for postgres this was an issue |
15:47:28 | FromDiscord | <wick3dr0se> It seems like it's importing fine. I think the issue is the procs. Maybe I need to export them or something |
15:48:17 | FromDiscord | <enthus1ast> @wick3dr0se\: yes, you must export your procs with "\" of course |
15:48:42 | FromDiscord | <enthus1ast> foo\() |
15:49:10 | FromDiscord | <wick3dr0se> In reply to @enthus1ast "<@772217344680001556>\: yes, you must": ..Thank you! |
15:50:56 | FromDiscord | <michaelb.eth> In reply to @enthus1ast "And it could also": good point |
15:51:07 | FromDiscord | <enthus1ast> @Chronos [She/Her]\: runForever internally calls poll() which drives the async "engine" |
15:52:35 | FromDiscord | <enthus1ast> Your async function have a different "color" they yield back control to the dispatcher on certain things (I think only on await) |
15:52:50 | FromDiscord | <wick3dr0se> The AI is so far behind on NIm.. |
15:52:58 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4vYB |
15:53:15 | FromDiscord | <michaelb.eth> wow, that's wildly wrong |
15:53:25 | FromDiscord | <wick3dr0se> It spews the most random bullshit |
15:53:33 | FromDiscord | <JeanCareau> I now tested it without the procs. Then python can read it without any warnings |
15:53:37 | FromDiscord | <michaelb.eth> otoh, per Araq's post last night, ChatGPT showed amazing understanding of his rather sophisticated Nim code |
15:53:42 | FromDiscord | <JeanCareau> The DB connection should be set up right |
15:53:51 | FromDiscord | <JeanCareau> The DB is innoDB utf8 |
15:53:56 | FromDiscord | <michaelb.eth> In reply to @JeanCareau "I now tested it": okay, so now try adding back the processing steps a bit at a time |
15:54:01 | FromDiscord | <JeanCareau> So the problem seems to be the procs |
15:54:06 | FromDiscord | <JeanCareau> Yes |
15:54:15 | FromDiscord | <enthus1ast> This ai thing will never be popular same as this strange internet |
15:54:23 | FromDiscord | <wick3dr0se> It's helped me write a lot don't get me wrong but it also causes way too much confusion. It takes it hours to write something on it's own that actually compiles and works |
15:54:59 | FromDiscord | <wick3dr0se> Idk I use AI a lot in bash and it can do half decent. It uses really outdated and non-performant methods but it definitely helps |
15:55:55 | FromDiscord | <enthus1ast> ChatGpt wrote lexing code for once that was twice as fast than my hand "tuned" stuff .... |
15:56:24 | FromDiscord | <JeanCareau> In reply to @michaelb.eth "okay, so now try": Yes, I will do so. Tomorrow. Here it is already quite late. I will come back here. |
15:56:26 | FromDiscord | <JeanCareau> Thanks |
16:03:13 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
16:05:18 | * | progranner joined #nim |
16:09:08 | FromDiscord | <michaelb.eth> a resource that may be helpful/interesting re: Unicode (and UTF-8 encoding, etc.) is https://codepoints.net/U+1F63C |
16:09:12 | FromDiscord | <michaelb.eth> (edit) "https://codepoints.net/U+1F63C" => "https://codepoints.net/" |
16:09:21 | FromDiscord | <michaelb.eth> e.g. https://codepoints.net/U+1F63C |
16:09:41 | FromDiscord | <michaelb.eth> if you scroll down on that page a bit, look at the section Representations |
16:09:52 | * | cm_ joined #nim |
16:10:15 | FromDiscord | <michaelb.eth> for any valid codepoint it shows the decimal number of the point, the UTF-8 bytes, etc. |
16:10:20 | * | cm quit (Ping timeout: 246 seconds) |
16:10:20 | * | cm_ is now known as cm |
16:11:03 | FromDiscord | <michaelb.eth> (edit) "for any valid codepoint it shows the decimal number of the point, the UTF-8 bytes, etc. ... " added "(click show more to see a bunch of representations)" |
16:57:40 | FromDiscord | <Arathanis> what module/library has synchronization primitives in it? locks, semaphores, conditions, etc. |
16:57:44 | FromDiscord | <Arathanis> is there a builtin? |
16:58:33 | FromDiscord | <demotomohiro> In reply to @Arathanis "what module/library has synchronization": https://nim-lang.org/docs/locks.html |
16:58:49 | FromDiscord | <Arathanis> 🤦 im dumb |
16:58:54 | FromDiscord | <Arathanis> In reply to @demotomohiro "https://nim-lang.org/docs/locks.html": thank you |
16:59:03 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/rlocks.html |
16:59:31 | FromDiscord | <wick3dr0se> How can I make a proc able to return two different types? Pretty sure the implementation is fine but the compiler seems to make auto always expect string if I return char and string |
17:00:34 | FromDiscord | <Arathanis> In reply to @demotomohiro "https://nim-lang.org/docs/rlocks.html": ohhh rlocks too, appreciate it |
17:01:24 | FromDiscord | <demotomohiro> In reply to @wick3dr0se "How can I make": A proc can return a tuple or object type if you want to return two different types at sametime. |
17:02:23 | FromDiscord | <Arathanis> auto is evil! |
17:02:55 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4vYY |
17:03:10 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vYZ |
17:03:24 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vZ0 |
17:04:06 | FromDiscord | <demotomohiro> In reply to @wick3dr0se "I want to return": Proc with auto return type is a generic proc. Return type must be determined at compile time. |
17:04:35 | FromDiscord | <voidwalker> I am trying to have a common implementation for the BitVecS (static) and BitVec (dynamic) bit arrays, I made the typeclasses as you can see above. Problem is, when I try to make a dynamic one, I get "Error: cannot instantiate: 'S'". The dynamic one does not use the S generic parameter (size of array for static). |
17:05:13 | * | jmdaemon joined #nim |
17:05:25 | FromDiscord | <voidwalker> Should/could this work ? |
17:05:25 | FromDiscord | <wick3dr0se> In reply to @demotomohiro "Proc with auto return": So it's impossible? |
17:06:08 | FromDiscord | <Arathanis> In reply to @wick3dr0se "So it's impossible?": auto infers the return type, but it still has to have a single unchanging return typew |
17:06:09 | FromDiscord | <Arathanis> (edit) "typew" => "type" |
17:06:25 | FromDiscord | <Arathanis> auto is not the ability to have multiple return types, it just means "you figure it out" |
17:06:40 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vZ2 |
17:06:43 | FromDiscord | <Arathanis> auto will infer "int" as the return type |
17:06:58 | FromDiscord | <voidwalker> What is the use case of auto then ? |
17:07:09 | FromDiscord | <wick3dr0se> Ok that makes sense. But how could I go about returning two different types then? |
17:07:28 | FromDiscord | <voidwalker> object variant, tuple |
17:07:33 | FromDiscord | <Arathanis> In reply to @voidwalker "What is the use": my opinion? not much you should be explicit with the return types |
17:07:46 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4vZ3 |
17:07:49 | FromDiscord | <Arathanis> maybe in something small where its extremely obvious what you are returning you can use it |
17:08:04 | FromDiscord | <Arathanis> but i specifically dont use auto |
17:08:21 | FromDiscord | <Arathanis> cause it just tells the user "go read the proc if you want to know what the return type is 😎 " |
17:08:29 | FromDiscord | <voidwalker> @demotomohiro can you look a bit at my code above and maybe try to see what's wrong ? |
17:08:37 | FromDiscord | <demotomohiro> In reply to @wick3dr0se "Ok that makes sense.": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#procedures-how-to-vary-a-return-type-of-procedure-at-runtimeqmark |
17:09:02 | FromDiscord | <Arathanis> but in nim you can just |
17:09:03 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vZ4 |
17:09:16 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vZ5 |
17:09:21 | FromDiscord | <Arathanis> and the auto is implied. |
17:09:57 | FromDiscord | <Arathanis> these are all my opinions, maybe someone else likes auto and can explain a good use case. I think it just makes our code harder to read. |
17:10:01 | FromDiscord | <⚶ Zeno> Sup people, my friend asked one funny question that i haven't wondered:↵"Are nim programmers nimmers or nimists ?"↵↵What do you people think ? :D |
17:10:05 | FromDiscord | <Arathanis> (edit) "our" => "your" |
17:10:14 | FromDiscord | <Arathanis> In reply to @⚶ Zeno "Sup people, my friend": nimrods |
17:10:44 | FromDiscord | <⚶ Zeno> In reply to @Arathanis "nimrods": hmmmm |
17:10:45 | FromDiscord | <wick3dr0se> In reply to @demotomohiro "https://internet-of-tomohiro.netlify.app/nim/faq.en": Thanks a lot.. Looks like I need to learn some more lol |
17:11:00 | FromDiscord | <Rika> nimions was used as well |
17:11:11 | * | rockcavera joined #nim |
17:11:17 | FromDiscord | <ieltan> Does `jsony` have a `to` equivalent? |
17:11:28 | FromDiscord | <voidwalker> Hey Rika can you please see if you have any idea about this : https://discord.com/channels/371759389889003530/371759389889003532/1108077235874836590 |
17:12:05 | FromDiscord | <⚶ Zeno> In reply to @Rika "nimions was used as": thats interesting name |
17:12:18 | FromDiscord | <Rika> In reply to @ieltan "Does `jsony` have a": "fromJson"? |
17:13:13 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4vZ6 |
17:13:16 | FromDiscord | <Rika> In reply to @voidwalker "Hey Rika can you": i dont think you can, you must split them it seems |
17:13:18 | FromDiscord | <ieltan> In reply to @Rika ""fromJson"?": I tried calling `fromJson` but I am dealing with `JsonNode` already and it seems like it doesn't work with 'em |
17:13:32 | FromDiscord | <Rika> In reply to @ieltan "I tried calling `fromJson`": jsony is not meant to work with jsonnode in any sense |
17:13:56 | FromDiscord | <ieltan> yeah, figured.... Thanks |
17:13:58 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vZ7 |
17:15:17 | FromDiscord | <voidwalker> @demotomohiro thanks but I'd rather not import a module for 1 line of code : D |
17:16:52 | FromDiscord | <Arathanis> In reply to @voidwalker "<@288750616510201856> thanks but I'd": any reason you cant use the built in bit vectors? |
17:17:05 | FromDiscord | <voidwalker> what built in bit vectors ? |
17:17:19 | FromDiscord | <Arathanis> `set` is implemented as a high performance bit vector |
17:17:20 | FromDiscord | <voidwalker> I know there are some bit sets, not bit vectors |
17:17:32 | FromDiscord | <Arathanis> or, you could treat it as a bit vector |
17:18:13 | FromDiscord | <voidwalker> https://nim-lang.org/docs/sets.html this ? |
17:19:11 | FromDiscord | <Arathanis> nah, there is a builtin called "set", this is hashsets |
17:19:18 | FromDiscord | <Arathanis> the module name is bad... |
17:19:30 | FromDiscord | <voidwalker> link ? I can't find : D |
17:19:31 | FromDiscord | <demotomohiro> In reply to @Arathanis "any reason you cant": I guess @voidwalker wants bit vector that supports variable length or larger than 2^16 bits. |
17:19:47 | FromDiscord | <voidwalker> ah yes, for sure : ) |
17:19:57 | FromDiscord | <Arathanis> In reply to @demotomohiro "I guess <@323176231098908672> wants": ive done this by making a custom object that composes sequences of "set" :P |
17:20:00 | FromDiscord | <voidwalker> I am tryint to make it both for static (array) and dynamic length (seq). |
17:20:14 | FromDiscord | <voidwalker> I also want to make it super efficient |
17:20:18 | FromDiscord | <Arathanis> you could also do an array of set |
17:20:25 | FromDiscord | <voidwalker> with SIMD and all possible optimisations |
17:20:59 | FromDiscord | <Arathanis> but by all means, roll your own! |
17:21:14 | FromDiscord | <Arathanis> i like leveraging what exists if i can |
17:21:21 | FromDiscord | <demotomohiro> Nims built in bit vector is limited to 2^16bits:↵https://nim-lang.org/docs/manual.html#types-set-type |
17:21:51 | FromDiscord | <voidwalker> yes, I've been thinking about it for a while now, I am using bit vectors in my wannabe in the works torrent library. And while BitVector one is okay, I found today that I can't assign slices bigger than 64 elements/bits |
17:22:06 | FromDiscord | <voidwalker> Others allow you to do this but lack other functions and so on |
17:22:29 | FromDiscord | <voidwalker> there's like 8 bit array libs in nimble, each one has something nice. I wanna combine them into the ultimate lib : ) |
17:24:04 | FromDiscord | <voidwalker> I should have waited for Beef to wake up before asking heh |
17:24:48 | FromDiscord | <voidwalker> It's a pity to copy paste code two times just because one type has an extra generic param, that is not even used in the implementation |
17:27:54 | FromDiscord | <voidwalker> maybe concepts ? |
17:47:01 | * | junaid_ joined #nim |
17:47:35 | * | junaid__ joined #nim |
17:51:52 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:53:42 | * | progranner joined #nim |
18:26:04 | FromDiscord | <wick3dr0se> Is there a simple way to trap SIGINT? |
18:26:17 | FromDiscord | <wick3dr0se> Or signals in general |
18:38:58 | * | Notxor joined #nim |
18:40:45 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vZt |
18:41:41 | FromDiscord | <wick3dr0se> My mann |
18:44:14 | FromDiscord | <voidwalker> https://play.nim-lang.org/#ix=4vZu |
18:45:04 | FromDiscord | <chmod222> Source filters are a quite unusual but fun thing to play with, it turns out |
18:45:06 | FromDiscord | <voidwalker> I managed to make the code compile by adding a useless/meaningless generic param to the type that was missing it and the other one had, in the type class union |
18:45:50 | FromDiscord | <voidwalker> but now I have to use it when calling the proc, which is not nice, cause it can be any random number with no consequence |
18:46:00 | FromDiscord | <Arathanis> whew, why did you alias `static int`? |
18:46:12 | FromDiscord | <voidwalker> so it's shorter : ) |
18:46:20 | FromDiscord | <Arathanis> way harder to read |
18:46:31 | FromDiscord | <Arathanis> this has been comment #1 of the code review 😉 |
18:46:43 | FromDiscord | <voidwalker> I aliased SomeUnsignedInt as well |
18:46:46 | FromDiscord | <Arathanis> my eyes just slide off "IntS" |
18:46:56 | FromDiscord | <voidwalker> what should I alias it to then ? |
18:47:03 | FromDiscord | <voidwalker> IntStatic would defeat the purpose |
18:47:04 | FromDiscord | <Arathanis> just leave it as `static int` |
18:47:46 | FromDiscord | <Arathanis> that is, don't alias it |
18:48:09 | FromDiscord | <Arathanis> probably for `SomeUnsignedInt` too. |
18:48:32 | FromDiscord | <voidwalker> ok, I removed the alias, but there's no way I am writing SomeUnsignedInt more than once in my code |
18:49:30 | FromDiscord | <voidwalker> some personal context is allowed in libraries |
18:49:58 | FromDiscord | <Arathanis> you gotta balance it with readability |
18:50:07 | FromDiscord | <Arathanis> and why wouldnt you want to type SomeUnsignedInt more than once? |
18:50:40 | FromDiscord | <voidwalker> anyway, not time for code review now, I am not finished with it, I just want to know how I can use two generic types that take 1 and 2 generic params, into one type class |
18:51:36 | FromDiscord | <Arathanis> sure |
18:51:41 | FromDiscord | <voidwalker> cause it's way too long, and a better name is Units, for my use case |
18:51:54 | FromDiscord | <voidwalker> units of storage that is |
18:52:14 | FromDiscord | <voidwalker> I have to write it at every generic proc definition, it will not be pretty |
18:52:21 | FromDiscord | <Arathanis> it does obfuscate it though |
18:52:38 | FromDiscord | <Arathanis> gonna make users dive through the source to figure out what it means :/ |
18:52:49 | FromDiscord | <voidwalker> it's literally the first line |
18:52:57 | FromDiscord | <voidwalker> and that's what you first read to make sense of the code, the types |
18:53:19 | FromDiscord | <Arathanis> more likely someone imports it, types out a procedure and sees "Units" and says "what is that?" |
18:53:58 | FromDiscord | <voidwalker> https://github.com/MarcAzar/BitVector/blob/cd8af9d00e05f0a261fb84419a06630143d25559/src/bitvector.nim#L45 |
18:54:07 | FromDiscord | <voidwalker> borrowed it from here, and I think it's good |
18:54:34 | FromDiscord | <Rika> They would see the sign and see that yes units is some unsigned integer |
18:54:38 | FromDiscord | <Rika> But then ask |
18:54:43 | FromDiscord | <Rika> Why the fuck is it called units?? |
18:54:44 | FromDiscord | <Arathanis> its your code man, im just giving you my thoughts, i wont be offended if you ignore it |
18:55:04 | FromDiscord | <voidwalker> how would you call it ? |
18:55:05 | FromDiscord | <Arathanis> In reply to @Rika "Why the fuck is": pmuch |
18:55:12 | FromDiscord | <Arathanis> i just wouldn't alias it |
18:55:48 | FromDiscord | <Rika> In reply to @voidwalker "how would you call": If I had to shorten it, SomeUInt |
18:55:49 | FromDiscord | <voidwalker> that is just out of the question, completely unreasonable : P |
18:55:57 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vZx |
18:56:04 | FromDiscord | <Rika> If i wanted to use units as a name, comment the reason |
18:56:59 | FromDiscord | <voidwalker> lol I just realised that generic type redefinition is not needed when specifying procs |
18:57:07 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix= |
18:57:24 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vZy |
18:57:36 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4vZy" => "https://play.nim-lang.org/#ix=4vZz" |
18:58:09 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vZA |
18:58:14 | FromDiscord | <Arathanis> obvious at a glance what everything is |
18:58:44 | FromDiscord | <Elegantbeef> Jeez what's with full captial generic parameters |
18:58:45 | FromDiscord | <Elegantbeef> Who hurt you |
18:58:47 | FromDiscord | <voidwalker> 😄 |
18:59:05 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Who hurt you": i just to justify the existence of the capslock key |
18:59:16 | FromDiscord | <Arathanis> (edit) "just" => "like" |
18:59:20 | FromDiscord | <Rika> You don’t have it rebound to either control or escape? |
18:59:24 | FromDiscord | <voidwalker> Beef I was staying awake in hopes that you would wake up soon |
18:59:26 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4vZC |
18:59:40 | FromDiscord | <Elegantbeef> My capslock is just a macro that writes "Jesus christ, why do you need this key" |
18:59:47 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4vZD |
18:59:59 | FromDiscord | <Elegantbeef> I don't even know what i'm supposed to do/say |
19:00:03 | FromDiscord | <Arathanis> beefified? |
19:00:05 | FromDiscord | <Elegantbeef> Use a concept if you want to typeclass over 2 types |
19:00:22 | FromDiscord | <voidwalker> omfg that's what I thought, thanks |
19:00:30 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Use a concept if": wdym? |
19:00:43 | FromDiscord | <Rika> I was thinking if that would work with differing generic parameter counts |
19:00:51 | FromDiscord | <Chronos [She/Her]> Also is there any type for callables? Any proc, no matter the parameters (if any) or return type |
19:00:51 | FromDiscord | <Rika> I don’t think it’s an issue but I don’t know why I did |
19:00:53 | FromDiscord | <Elegantbeef> It does |
19:01:13 | FromDiscord | <Elegantbeef> Concepts are a typeclass that does not care about instantiation only about functionality |
19:01:14 | FromDiscord | <Rika> In reply to @Hourglass, When the Hour Strikes "Also is there any": No? How would you use it |
19:01:55 | FromDiscord | <voidwalker> https://play.nim-lang.org/#ix=4vZH this is how I made it work, but I had to cram one redundant int param to be able to call it, so it matches the other type params |
19:02:01 | FromDiscord | <Elegantbeef> The best way to do that is a `proc(p: pointer)` and unpack parameters |
19:02:21 | FromDiscord | <Chronos [She/Her]> In reply to @Rika "No? How would you": For a generic type that accepts a proc and can be called with parameters |
19:02:59 | FromDiscord | <demotomohiro> In reply to @Hourglass, When the Hour Strikes "Also is there any": https://nim-lang.org/docs/manual.html#generics-type-classes↵Do you want `proc` type class? |
19:03:28 | FromDiscord | <Chronos [She/Her]> Oh yeah, I didn't even realise it worked like that |
19:03:31 | FromDiscord | <Chronos [She/Her]> Thanks aha |
19:03:46 | FromDiscord | <Chronos [She/Her]> In reply to @Hourglass, When the Hour Strikes "This is my code,": But this is confusing me lol |
19:06:53 | FromDiscord | <voidwalker> @ElegantBeef pls give us some clues here, concepts are not intuitive at the moment |
19:06:59 | FromDiscord | <voidwalker> what does this even mean |
19:07:00 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vZJ |
19:07:35 | FromDiscord | <Elegantbeef> https://www.jasonbeetham.com/codereuse.html |
19:07:41 | FromDiscord | <Elegantbeef> Goto the concepts segment |
19:08:21 | FromDiscord | <Elegantbeef> You're 100% wrong with the concept |
19:08:51 | FromDiscord | <Rika> sent a long message, see http://ix.io/4vZK |
19:09:04 | FromDiscord | <Elegantbeef> Something like this is proper |
19:09:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4vZL |
19:09:13 | FromDiscord | <Rika> (edit) "http://ix.io/4vZK" => "https://paste.rs/1bk" |
19:09:13 | FromDiscord | <Elegantbeef> Why the hell are fields capitalise 😄 |
19:09:21 | FromDiscord | <voidwalker> okay. And are you sure there's no way to hack two very similar types, with 1 and 2 generic params, of which the first is not actually used in the implementations they share ? |
19:09:26 | FromDiscord | <voidwalker> without using concepts |
19:09:40 | FromDiscord | <voidwalker> the second param is the same for both |
19:09:47 | FromDiscord | <voidwalker> (edit) "the second param is the same ... for" added "type" |
19:10:04 | FromDiscord | <Elegantbeef> `AnyBitVec[T] = BitVec[T] or BitVecS[auto, T]` perhaps? |
19:10:16 | FromDiscord | <Elegantbeef> I do not know i just use concepts here cause they're more sensible |
19:10:29 | FromDiscord | <Rika> In reply to @Elegantbeef "`AnyBitVec[T] = BitVec[T] or": Wow that sounds cursed |
19:10:36 | FromDiscord | <voidwalker> well if it's all compile time and no overhead.. |
19:10:52 | FromDiscord | <voidwalker> I believe it's abit overkill for this particular use case |
19:10:58 | FromDiscord | <Rika> In reply to @voidwalker "well if it's all": Overhead is in compile time now, concepts can potentially add a lot of time |
19:11:34 | FromDiscord | <Rika> By the way beef do you think old concepts are gonna get removed any time soon because I don’t want them gone 🥺 |
19:11:56 | FromDiscord | <Chronos [She/Her]> In reply to @Rika "<@909883978717204561> `proc": Oh that actually worked thanks! |
19:12:09 | FromDiscord | <Chronos [She/Her]> Well, not my entire issue but should be able to fix that part myself |
19:13:06 | FromDiscord | <ElegantBeef> Jesus christ you people need to use matrix! 😛 |
19:13:14 | FromDiscord | <ElegantBeef> I do not see them being removed rika |
19:13:32 | FromDiscord | <ElegantBeef> There are things you can do with present concepts you cannot ever express with new style |
19:13:56 | FromDiscord | <ElegantBeef> I foresee the old style being the lowlevel control based concepts and new style the high level even a monkey can use them style |
19:14:30 | FromDiscord | <Rika> Don’t the old ones have some performance issues |
19:14:32 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/ubh |
19:14:42 | FromDiscord | <ElegantBeef> I mean you have to evaluate the code at compile time |
19:14:49 | FromDiscord | <ElegantBeef> So sure if that's a performance issue |
19:15:04 | FromDiscord | <ElegantBeef> They are a hell of a lot more capable |
19:15:49 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4vZN |
19:15:58 | FromDiscord | <ElegantBeef> This type of introspection you just cannot get with newstyle |
19:16:18 | FromDiscord | <Rika> I’ve usually been wary when using concepts because I’ve hit some nasty shit before |
19:16:58 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4vZO |
19:16:58 | FromDiscord | <Chronos [She/Her]> Okay I lied, `/home/horizon/Projects/Nim/Nimberite/EventSystem/src/events.nim(36, 24) Error: type mismatch: got <>` is the issue and this is even more confusing lol |
19:17:29 | FromDiscord | <voidwalker> ah wait, I forgot to remove the extra S param |
19:17:48 | FromDiscord | <voidwalker> still doesn't work |
19:18:47 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4vZO" => "https://play.nim-lang.org/#ix=4vZP" |
19:19:27 | FromDiscord | <@theperfectcomputer-628303036da0> I remember some time ago, I was able to run nim repl on some sort of nim vm |
19:19:29 | FromDiscord | <@theperfectcomputer-628303036da0> This was two years ago |
19:19:36 | FromDiscord | <@theperfectcomputer-628303036da0> But I can't quite remember how I did this |
19:19:50 | FromDiscord | <demotomohiro> Do you mean `nim secret`? |
19:19:58 | FromDiscord | <@theperfectcomputer-628303036da0> ye |
19:23:29 | * | junaid_ quit (Remote host closed the connection) |
19:23:29 | * | junaid__ quit (Remote host closed the connection) |
19:23:42 | FromDiscord | <Chronos [She/Her]> In reply to @Hourglass, When the Hour Strikes "Okay I lied, `/home/horizon/Projects/Nim/Nimberite/": Yep I am dead this is horrid |
19:27:38 | FromDiscord | <@theperfectcomputer-628303036da0> how do I exit nim secret? I can't seem to be able to figure out how |
19:27:57 | FromDiscord | <demotomohiro> `quit()` |
19:29:13 | FromDiscord | <@theperfectcomputer-628303036da0> oh yeah - parens |
19:29:13 | FromDiscord | <demotomohiro> It is a proc in system module. |
19:29:19 | FromDiscord | <@theperfectcomputer-628303036da0> That's what I was missing |
19:32:25 | FromDiscord | <Chronos [She/Her]> Yeah anyone able to help? `/home/horizon/Projects/Nim/Nimberite/EventSystem/src/events.nim(36, 24) Error: type mismatch: got <>` code https://play.nim-lang.org/#ix=4vZS |
19:38:34 | FromDiscord | <demotomohiro> In reply to @Hourglass, When the Hour Strikes "Yeah anyone able to": I think `es.listenerAddCond()` should be `es.listenerAddCond(es)`. |
19:38:53 | FromDiscord | <wick3dr0se> Weird there isn't procs in std/terminal for the alternative and main buffer switching, just takes a simple ANSI sequence like echo("\e[?1049h"). It's odd that eraseScreen(), which is just echo("\e[2J\e[H"), is included but not buffers |
19:41:15 | FromDiscord | <Chronos [She/Her]> In reply to @demotomohiro "I think `es.listenerAddCond()` should": What why? |
19:41:31 | FromDiscord | <Chronos [She/Her]> In reply to @demotomohiro "I think `es.listenerAddCond()` should": That makes no sense to me? |
19:42:09 | FromDiscord | <Chronos [She/Her]> Since it's two parameters when the proc only accepts one |
19:43:11 | FromDiscord | <demotomohiro> `listenerAddCond` is a procedual type `proc(es: EventSystem[T]): bool`. |
19:43:33 | FromDiscord | <Elegantbeef> Field access does not pass the left hand in |
19:44:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4vZU |
19:45:43 | * | lucasta quit (Quit: Leaving) |
19:55:02 | FromDiscord | <Chronos [She/Her]> Oh, weird but works, thanks! |
19:55:37 | FromDiscord | <Chronos [She/Her]> Makes sense too but a bit of a pain lol |
19:56:04 | FromDiscord | <Chronos [She/Her]> How do streams work then? Is that why there's the `setPosition` procs and then the `impl` field for it exists? |
19:58:26 | FromDiscord | <Chronos [She/Her]> Now I'm not too sure on how to get the `fire` proc to work... `/home/horizon/Projects/Nim/Nimberite/EventSystem/src/events.nim(42, 19) Error: type mismatch: got <varargs[untyped]>` makes sense to me, maybe a macro would make it better? |
19:59:53 | FromDiscord | <Chronos [She/Her]> Yeah okay a simple macro should help |
20:07:58 | FromDiscord | <Chronos [She/Her]> I am so confused on how to make this work damn it |
20:08:20 | FromDiscord | <Chronos [She/Her]> Aha, template instead of proc! |
20:08:53 | FromDiscord | <Chronos [She/Her]> Now works as intended! And is almost guaranteed to be horrific when actually used :) |
20:09:13 | * | xet7 joined #nim |
20:17:39 | FromDiscord | <Elegantbeef> I still say you just pass data using `pointer` and unpack it inside |
20:21:43 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "I still say you": For packet data? I am gonna do that |
20:22:18 | FromDiscord | <Chronos [She/Her]> But I'm making the event system so I can actually call the proc in the WASM runtimr |
20:22:20 | FromDiscord | <Chronos [She/Her]> Runtime |
20:45:08 | * | jkl quit (Quit: Gone.) |
20:45:13 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
20:45:44 | * | progranner joined #nim |
20:47:43 | * | jkl joined #nim |
20:50:42 | FromDiscord | <Ayy Lmao> Would any Nim gods be willing to look at this and tell me what I might be doing wrong? I'm getting these very hard to deal with segfaults. https://github.com/Alkamist/clap/blob/main/demo.nim |
20:53:08 | FromDiscord | <Elegantbeef> Firstly that emit code is odd |
20:53:46 | FromDiscord | <Ayy Lmao> How do I get around doing that? |
20:53:59 | FromDiscord | <Ayy Lmao> Nim just ignores when you try to export a variable |
20:54:34 | FromDiscord | <Ayy Lmao> The emit code works though. The plugin registers in my DAW and I can open it |
20:54:58 | FromDiscord | <Elegantbeef> Secondly I have no idea how to run the code |
20:56:22 | FromDiscord | <Ayy Lmao> Running unfortunately is a little complicated as it requires opening the plugin in a DAW. I'm also on Windows, but I think it should work on Linux. |
20:57:05 | FromDiscord | <Elegantbeef> You can do `{.exportc, dynlib.}` I think to get what you want |
20:57:35 | FromDiscord | <Elegantbeef> nm -D reports `0000000000009400 R myVal`↵for `let myVal {.exportc, dynlib.}= MyType(a: 10, b: 20)` |
20:57:58 | FromDiscord | <Ayy Lmao> I will try it. I don't think I tried adding dynlib to it yet. |
20:58:09 | FromDiscord | <Elegantbeef> Ok so where dos `foo` get allocated? |
20:58:50 | FromDiscord | <Elegantbeef> There's the create shared I guess, and you pass this as user data |
20:59:23 | FromDiscord | <Ayy Lmao> I have also tried AudioPlugin being a ref object instead and doing GcRef and GcUnref to clean it up |
20:59:32 | FromDiscord | <Elegantbeef> That's all the same |
20:59:43 | FromDiscord | <Elegantbeef> Do you get the line it segfaults at? |
21:00:24 | FromDiscord | <Ayy Lmao> Yeah let me get it again. It points me to some place inside alloc.nim if I remember correctly |
21:01:49 | FromDiscord | <Ayy Lmao> If I have threads:on, `let eventCount = process.in_events.size(process.in_events)` segfaults and says `Exception 0xc0000005 encountered at address 0x7ffd09a2974f: Access violation reading location 0x00000040` |
21:01:55 | FromDiscord | <Ayy Lmao> I'll get the error for when threads is off |
21:03:19 | FromDiscord | <Elegantbeef> You should call the `NimMain` fro minsidie `mainInit` |
21:03:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4w0e |
21:03:54 | FromDiscord | <Ayy Lmao> In reply to @Elegantbeef "You should call the": I have done that before, I still get the same segfaults |
21:04:13 | FromDiscord | <Ayy Lmao> If I have threads off, I get a segfault in `alloc.nim` in the function `proc rawAlloc(a: var MemRegion, requestedSize: int): pointer =` |
21:04:33 | FromDiscord | <Ayy Lmao> line 735 `c.freeList = c.freeList.next` |
21:04:38 | FromDiscord | <Elegantbeef> Even though it doesnt help you still should call `NimMain` that's what inits your `clapDescriptor` |
21:05:12 | FromDiscord | <Ayy Lmao> I will call it there if that is the proper way. I think it's actually getting called anyway somehow because the clapDescriptor is definitely initialized since it's showing up in my DAW |
21:05:38 | FromDiscord | <Elegantbeef> If you do not call NimMain it should be an empty object |
21:06:17 | FromDiscord | <Ayy Lmao> For whatever reason it's not. Maybe a windows specific thing? |
21:07:55 | FromDiscord | <Elegantbeef> Ah seems top level code uses C init |
21:08:08 | FromDiscord | <Elegantbeef> `N_LIB_EXPORT_VAR NIM_CONST tyObject_MyTypeGKf3qs3DosB7llBKfn52xQ myVal = {((NI)10), ((NI)20)}` |
21:08:22 | FromDiscord | <Elegantbeef> If you do not call a procedure I guess it can use the {} init |
21:08:39 | * | lucasta joined #nim |
21:10:55 | FromDiscord | <Ayy Lmao> `{.exportc, dynlib.}` seems to export the variable properly which is nice |
21:11:13 | FromDiscord | <Ayy Lmao> I can get rid of that nasty emit code |
21:11:23 | FromDiscord | <Elegantbeef> I'm still looking at the code, trying to see bugs |
21:11:31 | FromDiscord | <Ayy Lmao> Still the same segfaults though, even with calling NimMain |
21:12:09 | FromDiscord | <Elegantbeef> You're certain the bindings are correct? |
21:12:12 | FromDiscord | <Ayy Lmao> I think there is some sort of oddity with the way Nim's allocation is or something. I'm not sure. I have done this exact kind of logic in Odin and it doesn't segfault. |
21:12:33 | FromDiscord | <Ayy Lmao> I can double check them I guess but I'm pretty sure. |
21:12:55 | FromDiscord | <Elegantbeef> Do you have a link to the original header? |
21:13:50 | FromDiscord | <Ayy Lmao> It's spread over like a million files but this is it https://github.com/free-audio/clap/tree/main/include/clap |
21:14:31 | FromDiscord | <Elegantbeef> Does `pluginProcess` segfault if you just do `plugin.foo.add(1)`? |
21:15:19 | FromDiscord | <Ayy Lmao> It seems to kind of unpredictably segfault. Anything that allocates on the audio thread can segfault it seems. The program can run for a while and then randomly like `plugin.foo.add(3)` will segfault. |
21:15:49 | FromDiscord | <Ayy Lmao> I can try only doing that though |
21:15:50 | FromDiscord | <Elegantbeef> Ok so this sounds a lot like something being subtly incorrect and writing to invalid memory |
21:16:06 | FromDiscord | <Ayy Lmao> Incorrect in the binding? |
21:16:19 | FromDiscord | <Elegantbeef> Either in the binding or in your usage |
21:16:31 | FromDiscord | <Elegantbeef> This sounds a lot like invalid memory write |
21:16:47 | FromDiscord | <Elegantbeef> It seems to work and runs fine but your accidentally corrupting the heap hence the random segfault |
21:17:39 | FromDiscord | <Ayy Lmao> If you want an example of what I was following https://raw.githubusercontent.com/nakst/cdn/main/clap-tutorial-part-1-plugin.cpp |
21:18:03 | FromDiscord | <Elegantbeef> sorry that `.cpp` extensio nmeans i do not dare read |
21:18:25 | FromDiscord | <Ayy Lmao> This is probably better actually https://github.com/free-audio/clap/blob/main/src/plugin-template.c |
21:19:16 | FromDiscord | <Ayy Lmao> I'll keep looking through my binding to make sure it's correct |
21:19:24 | FromDiscord | <Elegantbeef> It doesnt really matter, it's simple code to follow to me |
21:20:19 | FromDiscord | <Elegantbeef> I'd suggest use memory analysers and friends but no clue what tool to use on windows |
21:24:54 | FromDiscord | <Ayy Lmao> I've just been using lldb to see where in the source code it goes wrong. I have no idea what to try to do from there. |
21:25:00 | FromDiscord | <Ayy Lmao> I'm not very experienced in debugging. |
21:25:15 | FromDiscord | <Elegantbeef> You dont need lldb |
21:25:17 | FromDiscord | <Elegantbeef> You need like valgrind |
21:25:25 | FromDiscord | <Ayy Lmao> I don't think that works for windows. |
21:25:43 | FromDiscord | <Ayy Lmao> I have this thing called remedybg |
21:25:47 | FromDiscord | <Elegantbeef> There are alternatives |
21:26:18 | FromDiscord | <Elegantbeef> No clue about the efficacy though |
21:26:36 | FromDiscord | <Dudugz> Should I use thread for non-blocking database operations? I mean, the code must not stop at any time to wait for the database to perform the operation so as not to cause a delay. |
21:28:58 | FromDiscord | <Elegantbeef> Arent DBs IO bound? |
21:34:25 | FromDiscord | <Ayy Lmao> So a weird quirk about these segfaults is that they only happen when there are two or more instances of my plugin. |
21:34:39 | FromDiscord | <Ayy Lmao> I don't know if that is useful info at all. |
21:35:27 | FromDiscord | <jmgomez> In reply to @Dudugz "Should I use thread": why cant you just use a `Future`? |
21:35:49 | FromDiscord | <jmgomez> In reply to @Ayy Lmao "So a weird quirk": what gc are you using? |
21:35:58 | FromDiscord | <Ayy Lmao> In reply to @jmgomez "what gc are you": I'm using arc |
21:36:35 | FromDiscord | <Dudugz> In reply to @Elegantbeef "Arent DBs IO bound?": They still block the statements below because the operation is waiting for the database to process the request. |
21:36:36 | FromDiscord | <jmgomez> Are you using a dll? |
21:36:56 | FromDiscord | <Dudugz> In reply to @jmgomez "why cant you just": Because it wouldn't solve my problem lol |
21:37:12 | FromDiscord | <Ayy Lmao> In reply to @jmgomez "Are you using a": I am exporting a dll. I am not using any dlls from my program. |
21:37:17 | FromDiscord | <jmgomez> In reply to @Dudugz "Because it wouldn't solve": what is your problem? |
21:38:03 | FromDiscord | <Dudugz> "database operation blocking code " |
21:38:03 | FromDiscord | <jmgomez> In reply to @Ayy Lmao "I am exporting a": So you have hooked two instances of the dlls? That should be fine on ARC. I do have a similar approach in NUE |
21:38:37 | FromDiscord | <Ayy Lmao> In reply to @jmgomez "So you have hooked": It's one .dll but the host spawns instances of an object that is contained inside the dll. |
21:38:50 | FromDiscord | <Ayy Lmao> The dll itself is loaded once I believe |
21:39:11 | FromDiscord | <jmgomez> In reply to @Dudugz ""database operation blocking code": doenst the driver have a pool or what? |
21:39:36 | FromDiscord | <Dudugz> The driver is sync, at least the std |
21:40:26 | FromDiscord | <Dudugz> (edit) "The driver is sync, at least the std ... " added "one" |
21:40:28 | FromDiscord | <jmgomez> So that's your problem, you dont need a "thread" |
21:40:54 | FromDiscord | <jmgomez> see if there is any callback it should have something |
21:41:18 | FromDiscord | <jmgomez> never used the std bindings, if not, you may want to extend it. Shouldnt be too hard |
21:42:18 | FromDiscord | <jmgomez> In reply to @Ayy Lmao "It's one .dll but": so with instances of your plugin you mean instance of an object inside your plugin? |
21:43:04 | FromDiscord | <Ayy Lmao> In reply to @jmgomez "so with instances of": Yeah, the host tells me when to allocate and free them. |
21:43:27 | FromDiscord | <Ayy Lmao> And they can be passed into callbacks that are running on different threads. |
21:44:23 | FromDiscord | <jmgomez> different threads? are they refs? |
21:45:01 | FromDiscord | <Ayy Lmao> Threads managed by the host. There is a realtime audio thread and a non realtime main thread. It doesn't matter if they are refs or pointers, I still get segfaults. |
21:45:22 | FromDiscord | <jmgomez> @Dudugz you may want to look into this https://github.com/cheatfate/asyncpg |
21:47:58 | FromDiscord | <jmgomez> In reply to @Ayy Lmao "Threads managed by the": you get segfaults without using strings/seqs or refs then? |
21:48:19 | * | xet7 quit (Ping timeout: 265 seconds) |
21:49:16 | FromDiscord | <Ayy Lmao> In reply to @jmgomez "you get segfaults without": I get segfaults specficially when doing anything involving allocation. So in my case, appending to a sequence or sorting it. |
21:50:01 | FromDiscord | <Ayy Lmao> I also get a segfault if I turn `threads:on` just for interacting with a pointer that the host gives me. |
21:50:10 | FromDiscord | <Ayy Lmao> With `threads:off` it's fine. |
21:50:25 | FromDiscord | <Ayy Lmao> (edit) "it's fine." => "I can interact with that pointer." |
21:50:56 | FromDiscord | <Ayy Lmao> (edit) "specficially" => "specifically" |
21:51:00 | * | Notxor quit (Remote host closed the connection) |
21:53:08 | FromDiscord | <jmgomez> In reply to @Ayy Lmao "I get segfaults specifically": seq and strings are refs. Try to dont use refs at all to see if that's the issue |
21:54:38 | FromDiscord | <Ayy Lmao> Well I still get the `threads:on` segfault since that doesn't involve refs at all. And not using seqs would be quite difficult. |
21:55:08 | FromDiscord | <Elegantbeef> On orc/arc seqs/strings arent technicall refs 😄 |
21:56:20 | FromDiscord | <jmgomez> why is that? Because they are always copied over? |
21:56:53 | FromDiscord | <jmgomez> I see them crashing NUE when passing it into another thread create by UE |
21:57:21 | FromDiscord | <jmgomez> I do mostly use `FStrint` and `TArray` though so not really a super big issue in NUE's case |
21:57:40 | FromDiscord | <jmgomez> (edit) "`FStrint`" => "`FString`" |
22:02:11 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
22:06:49 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4w0m |
22:07:35 | FromDiscord | <Dudugz> In reply to @jmgomez "<@265937132886032407> you may want": I'll take a look, internet is bad |
22:15:38 | FromDiscord | <jmgomez> That's why I asked about the callback. You may also want to check this one out https://github.com/itsumura-h/nim-allographer |
22:17:11 | FromDiscord | <jmgomez> Here is the Postgres binding: https://github.com/itsumura-h/nim-allographer/blob/main/src/allographer/async/database/impls/postgres.nim |
22:19:56 | FromDiscord | <jmgomez> Nim async is an event loop which I personally think it's a good approach to concurrency |
22:21:09 | FromDiscord | <Dudugz> In reply to @jmgomez "That's why I asked": This looks good, I'll test it when I get home, thx. |
22:23:50 | FromDiscord | <Dudugz> In reply to @jmgomez "Nim async is an": I don't. JS's async it is better. There is no such thing as an asynchronous function blocking the operation of another asynchronous function, they must run in parallel. |
22:24:10 | FromDiscord | <Dudugz> (edit) removed "it" |
22:26:38 | FromDiscord | <Dudugz> Asynchronous functions serve precisely to parallelize tasks, if it were to block code execution then it would be easier to make everything synchronous. |
22:31:07 | FromDiscord | <jmgomez> Actually they both use exactly the same approach. The "problem" is the "API". If you call a blocking function in javascript it will block as it does in Nim. Parallelism and concurrency are two different things |
22:34:17 | FromDiscord | <Prestige> Looking at karax, how can I focus a VNode? Been looking through the docs trying to figure out a way |
22:38:28 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4w0o |
22:42:06 | FromDiscord | <hotdog> In reply to @Avahe "Looking at karax, how": `vnode.dom.focus()` probably |
22:42:10 | FromDiscord | <hotdog> https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus |
22:42:15 | FromDiscord | <Dudugz> https://media.discordapp.net/attachments/371759389889003532/1108162524672700506/Screenshots_2023-05-16-18-42-01.png |
22:42:39 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4w0p |
22:42:44 | FromDiscord | <Dudugz> It would block if I had used await |
22:43:16 | FromDiscord | <Prestige> In reply to @hotdog "`vnode.dom.focus()` probably": unfortunately that dom property is nil |
22:43:36 | FromDiscord | <Arathanis> JS also uses an event loop |
22:43:38 | FromDiscord | <Dudugz> In reply to @jmgomez "": 🤔 Well this is strange so because for me it never blocked, it could be because you are using devtools. |
22:43:49 | FromDiscord | <hotdog> In reply to @Avahe "unfortunately that dom property": Needs to be done after the render to the page |
22:43:55 | FromDiscord | <jmgomez> In reply to @Arathanis "JS also uses an": that's what Im trying to say for a bit now.. |
22:44:06 | FromDiscord | <hotdog> How are you calling it? |
22:44:12 | FromDiscord | <Prestige> Also it says that's not a function for dom |
22:45:15 | FromDiscord | <jmgomez> In reply to @Dudugz "🤔 Well this is": doesnt matter the "tricks" the interpreter uses. If the loop hangs it wont be able to continue |
22:45:18 | FromDiscord | <Prestige> `Error: attempting to call undeclared routine: 'focus'` https://play.nim-lang.org/#ix=4w0q |
22:45:21 | FromDiscord | <hotdog> In reply to @Avahe "Also it says that's": https://nim-lang.org/docs/dom.html#focus%2CElement |
22:45:37 | FromDiscord | <Arathanis> In reply to @jmgomez "that's what Im trying": you are absolutely correct. JS does a lot of things implicitly in its async which I kind of hate. It hides what is actually going on. |
22:46:24 | FromDiscord | <hotdog> In reply to @Avahe "`Error: attempting to call": Try ev.target.focus and import std/dom |
22:46:46 | FromDiscord | <Arathanis> it works fine, but its causes some serious whiplash when someone who knows JS encounters async in just about any other language. |
22:47:00 | FromDiscord | <Dudugz> In reply to @Arathanis "you are absolutely correct.": Well i love, if that allows me to run two long tasks in parallel without blocking the rest of the page. |
22:47:13 | FromDiscord | <Arathanis> In reply to @Dudugz "Well i love, if": nothing is stopping you from doing this in Nim |
22:47:35 | FromDiscord | <Arathanis> the point we are trying to make is that the implicitness of JS's async has given you incorrect preconceptions about async in other languages |
22:47:48 | FromDiscord | <Dudugz> 🤔 I was once told that any synchronous task in an async proc would block the poll |
22:47:53 | FromDiscord | <Prestige> interesting, just importing std/dom kind of fixed it. But if I click another element, I get an error than `n.dom` is nil |
22:48:41 | FromDiscord | <hotdog> In reply to @Avahe "interesting, just importing std/dom": Try the ev.target.focus instead. There is an issue in the current release of Karax that causes dom to be nil sometimes |
22:49:17 | FromDiscord | <Arathanis> In reply to @Dudugz "🤔 I was once": this is true in JS as well it just implicitly yeilds to the event loop all the time |
22:49:30 | FromDiscord | <Arathanis> in Nim and most other languages the yields are explicit |
22:49:33 | FromDiscord | <Dudugz> Hm |
22:49:46 | FromDiscord | <Prestige> cool, looks to be working pretty much how I want it. Thanks hotdog |
22:50:09 | FromDiscord | <Dudugz> So how would you do it in Nim to run your tasks at the same time without one interfering with the other causing delay? |
22:50:24 | FromDiscord | <BoomBang> >-> i'll speak in this thread |
22:50:45 | FromDiscord | <Arathanis> callSoon queues a task without blocking |
22:50:47 | FromDiscord | <Elegantbeef> @Dudugz you're describing threads |
22:50:55 | FromDiscord | <BoomBang> nvm |
22:50:56 | FromDiscord | <Arathanis> anywhere there is an `await` yields to the event loop |
22:51:05 | FromDiscord | <Elegantbeef> "same time" means threads |
22:51:07 | FromDiscord | <Arathanis> so in your while loop throw in an `await sleepAsync(0)` |
22:51:11 | FromDiscord | <Elegantbeef> thems the rules |
22:51:41 | FromDiscord | <Arathanis> and what beef is saying is correct, nothing is actually concurrent in async event loop, Js or otherwise. It is just a bunch of synchrnous code occasionally letting others do worj |
22:51:44 | FromDiscord | <Arathanis> (edit) "worj" => "work" |
22:51:56 | FromDiscord | <jmgomez> What @Dudugz wants for this particular case is a db library that does the pooling in the driver |
22:51:58 | FromDiscord | <Dudugz> In reply to @Elegantbeef ""same time" means threads": I don't say in the literal sense, I mean I have two asynchronous procs executing a code, these procs must not block the code. |
22:52:16 | FromDiscord | <Elegantbeef> So then give up the cpu whenever you can |
22:53:27 | FromDiscord | <jmgomez> In reply to @Arathanis "and what beef is": hence the difference between concurrency vs parallelism |
22:53:27 | FromDiscord | <Dudugz> Sure, so should I spruce up all procs that do longss tasks with await sleepAsync(0)? I wonder why this needs to be explicit. |
22:53:53 | FromDiscord | <Arathanis> In reply to @jmgomez "hence the difference between": ok sure, you got me on semantics llol |
22:53:54 | FromDiscord | <Arathanis> (edit) "llol" => "lol" |
22:53:59 | FromDiscord | <Arathanis> i concede |
22:54:23 | FromDiscord | <Elegantbeef> Why would you randomly add sleeps↵(@Dudugz) |
22:54:29 | FromDiscord | <Arathanis> In reply to @Dudugz "Sure, so should I": they dont wait at all, it basically says "hey event loop ill continue right this second, but also if someone else needs a chance to run thats ok too, you decide" |
22:55:02 | FromDiscord | <Elegantbeef> All async procedure calls using `await` ill give up the cpu |
22:55:04 | FromDiscord | <Dudugz> In reply to @Elegantbeef "Why would you randomly": "give up cpu whenever you can" so that the poll is released I think. |
22:55:05 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Why would you randomly": Probably to yield after long synchronous code? |
22:55:31 | * | jmdaemon quit (Ping timeout: 240 seconds) |
22:55:58 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4w0r |
22:56:58 | FromDiscord | <Dudugz> But the solution jmgomez gave is good, I'll have a look at the library he referenced. Worse is when a server blocks all data processing because it needs to find a specific information in the database. |
22:57:45 | FromDiscord | <Elegantbeef> I do not use async much but if you're using async stop using sync code 😛 |
22:57:56 | FromDiscord | <Arathanis> the way ive heard it described is that async is "cooperative multitasking" or "cooperative concurrency" |
22:58:18 | FromDiscord | <Arathanis> everyone just runs synchronously except for "checkpoints" where they yield to the event loop which can then choose to give the cpu to a different task |
22:58:31 | FromDiscord | <Arathanis> in Nim, anywhere you see "await" yields to the event loop |
22:58:36 | FromDiscord | <Dudugz> In reply to @Elegantbeef "I do not use": Well yes, I'm using it since making a server without async is the same as shooting yourself in the foot. Imagine processing 10k requests one at a time. |
22:59:01 | FromDiscord | <Elegantbeef> You say that but async can be broken down to `select` on your sockets↵(@Dudugz) |
22:59:23 | FromDiscord | <jmgomez> In reply to @Elegantbeef "I do not use": dont you? In your game engine you just put everything that you want to check in a tick function? |
22:59:25 | FromDiscord | <Dudugz> Hm |
22:59:37 | FromDiscord | <Elegantbeef> Yes↵(@jmgomez) |
22:59:55 | FromDiscord | <Dudugz> In reply to @Elegantbeef "Yes (<@726017160115126333>)": Is the game small? |
23:00:01 | FromDiscord | <Elegantbeef> Yes |
23:00:19 | FromDiscord | <Elegantbeef> I do not have a very robust designed API |
23:00:21 | FromDiscord | <Dudugz> So it makes sense, in that case you don't need to process multiple things at the same time. |
23:00:22 | FromDiscord | <jmgomez> In reply to @Elegantbeef "Yes (<@726017160115126333>)": Interesting, I was in a kinda oposite direction where I connected the UE engine loop to epol so I can use async everywhere 😛 |
23:00:25 | FromDiscord | <Elegantbeef> Cause I do not need one |
23:00:48 | FromDiscord | <Arathanis> my understanding is you wont see much async in video game programming |
23:00:56 | FromDiscord | <Arathanis> the event loop causes overhead and degrades performance. |
23:00:57 | FromDiscord | <Elegantbeef> You generally do not see much async |
23:00:58 | FromDiscord | <Elegantbeef> simplescreenrecorder-2023-05-15\_00.31.16.mp4 [simplescreenrecorder-2023-05-15_00.31.16.mp4](https://t2bot.io/_matrix/media/r0/download/matrix.org/pqymPIoFAVjjeojWqzcqudXP) |
23:01:00 | FromDiscord | <Elegantbeef> This is my present game |
23:01:03 | FromDiscord | <Arathanis> you just have a tick function that updates the state |
23:01:05 | FromDiscord | <Elegantbeef> Why do i need async |
23:01:24 | FromDiscord | <jmgomez> In reply to @Arathanis "my understanding is you": it's handy for some tricks. You dont see it often because cpp sucks at it |
23:01:37 | FromDiscord | <Arathanis> In reply to @jmgomez "it's handy for some": yeah cpp is good at that |
23:02:01 | FromDiscord | <Dudugz> In reply to @Arathanis "you just have a": Well yes, but then there are algorithms to determine priorities of what should be updated. Because updating various information one by one causes delay in the game. |
23:02:27 | FromDiscord | <Elegantbeef> Speaking of it's time for a GUI api redesign |
23:02:28 | FromDiscord | <Elegantbeef> This is going to be fun |
23:02:57 | FromDiscord | <Dudugz> Good luck |
23:02:59 | FromDiscord | <jmgomez> Here an example of using async await to make a hover effect https://twitter.com/_jmgomez_/status/1649887235934765061/video/1 |
23:04:02 | FromDiscord | <Elegantbeef> Yea I'd just make a main loop timer and call it a day |
23:04:57 | FromDiscord | <Elegantbeef> Also using async in a game loop is horrendous if you want game time to be different than real time |
23:05:28 | FromDiscord | <jmgomez> yeah, but things can get more complicated when you start to compound them or wait for other to complete before acting |
23:05:29 | FromDiscord | <Elegantbeef> like that `sleepAsync` will fire in 500ms regardless if you pause the time |
23:05:58 | FromDiscord | <jmgomez> oh no, since it's connected to the loop it doesnt. When the world stop, it stop too |
23:06:05 | FromDiscord | <Elegantbeef> Ok |
23:06:28 | FromDiscord | <Elegantbeef> I assumed it was based of system primitives still and independent of the game loop |
23:07:06 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4w0t |
23:07:11 | FromDiscord | <Dudugz> It is also possible to make a cancelable timer, you can cancel if the world stop |
23:07:23 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4w0t" => "https://paste.rs/Izg" |
23:07:30 | FromDiscord | <Elegantbeef> I mean I know that it's possible 😄 |
23:08:01 | FromDiscord | <Elegantbeef> C#'s task system for instance does not work with Unity's time which means sleeping for 100ms is not the same if you set timescale to 0 |
23:08:24 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4w0w" => "https://play.nim-lang.org/#ix=4w0v" |
23:08:29 | FromDiscord | <jmgomez> You see? Nim integration on UE is better than C# in Unity 😛 |
23:08:52 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4w0v" => "https://play.nim-lang.org/#ix=4w0x" |
23:11:33 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4w0y |
23:11:37 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4w0y" => "https://paste.rs/epg" |
23:11:48 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4w0A" => "https://play.nim-lang.org/#ix=4w0z" |
23:12:08 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4w0z" => "https://play.nim-lang.org/#ix=4w0B" |
23:12:43 | FromDiscord | <BoomBang> How do I run a function with only the name of a function as a string in Nim? |
23:12:54 | FromDiscord | <Elegantbeef> You make a look up table |
23:14:19 | * | jmdaemon joined #nim |
23:15:08 | FromDiscord | <Elegantbeef> Hmm tuples + stack based inheritance might be all one needs to make a good GUI |
23:15:13 | FromDiscord | <Elegantbeef> Let's see how bad this goes 😄 |
23:15:57 | FromDiscord | <BoomBang> In reply to @Elegantbeef "You make a look": What's a look up table? |
23:16:17 | FromDiscord | <Elegantbeef> A table that you look values up in |
23:16:25 | FromDiscord | <BoomBang> In reply to @Elegantbeef "A table that you": Ohhhh |
23:16:32 | FromDiscord | <BoomBang> kind of like a dictionary |
23:16:53 | FromDiscord | <Elegantbeef> A dictionary is a table yes |
23:17:39 | FromDiscord | <BoomBang> I just want it to be able to get one function from a file and use it |
23:17:54 | FromDiscord | <BoomBang> like this: |
23:19:02 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4w0C |
23:24:16 | FromDiscord | <BoomBang> sent a code paste, see https://play.nim-lang.org/#ix=4w0E |
23:24:30 | FromDiscord | <Elegantbeef> You cannot do that |
23:24:32 | FromDiscord | <BoomBang> Kind of like import but I use functions from nim |
23:24:37 | FromDiscord | <Elegantbeef> They are not exported |
23:24:46 | FromDiscord | <Elegantbeef> Why do you want to use a string |
23:25:13 | FromDiscord | <BoomBang> (edit) "https://play.nim-lang.org/#ix=4w0E" => "https://paste.rs/IWM" |
23:25:34 | FromDiscord | <BoomBang> In reply to @Elegantbeef "Why do you want": So that you can use an arbitrary function |
23:25:55 | FromDiscord | <Elegantbeef> You cannot arbitrarily use functions Nim is statically compiled and only includes what you use |
23:27:13 | FromDiscord | <Dale> Sounds like you want function pointers |
23:27:26 | FromDiscord | <BoomBang> In reply to @Elegantbeef "You cannot arbitrarily use": oh |
23:27:49 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4w0F |
23:28:19 | FromDiscord | <BoomBang> sent a code paste, see https://play.nim-lang.org/#ix=4w0G |
23:28:26 | FromDiscord | <BoomBang> because the main file wouldn't know |
23:28:28 | FromDiscord | <Arathanis> oh, you gonna have to load any function you want to support |
23:28:46 | FromDiscord | <BoomBang> but ig it makes sense that it would need to be interpreted |
23:28:55 | FromDiscord | <Elegantbeef> Like I said Nim has dead code elimination and is statically typed |
23:29:02 | FromDiscord | <Elegantbeef> Which means you need to use all the procedures and know their type |
23:29:07 | FromDiscord | <Arathanis> its compiled, it will only have the functions it can tell are used in the code and nothing else |
23:30:02 | FromDiscord | <Arathanis> so yeah i misunderstood and beef is right |
23:30:05 | FromDiscord | <Elegantbeef> Technically being compiled doesnt really matter 😄 |
23:30:17 | FromDiscord | <Arathanis> ok also true on a technicality lol |
23:30:33 | FromDiscord | <Elegantbeef> Just no sane language doesnt do dead code elim |
23:30:53 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Just no sane language": maybe i want huge binaries? the man cant tell me what to do |
23:31:11 | FromDiscord | <Elegantbeef> Hey Nim used to not have dead code elim! |
23:31:41 | FromDiscord | <Arathanis> its 2023, if my program doesn't use all available RAM it will never be popular! |
23:31:44 | FromDiscord | <Arathanis> just look at Chrome! |
23:32:10 | FromDiscord | <Arathanis> dominate the RAM == dominate the market share |
23:32:11 | FromDiscord | <Arathanis> it is known |
23:32:44 | FromDiscord | <Dale> Is there not a pragama to tell that a prof shouldn’t be discarded? |
23:32:51 | FromDiscord | <Dale> (edit) "pragama" => "pragma" |
23:32:59 | FromDiscord | <Dale> (edit) "prof" => "proc" |
23:33:13 | FromDiscord | <Elegantbeef> Nope |
23:33:39 | FromDiscord | <Dale> I guess if you stick it in a structure then it would t matter anyway |
23:58:48 | * | progranner joined #nim |