00:16:05 | FromDiscord | <.bobbbob> is it good practice/style to have a const thats only used in a single function right above the function or should all consts just be defined at the top of a file? |
00:27:20 | FromDiscord | <intellij_gamer> If it's only used in that function I usually just put it inside the function |
00:33:42 | FromDiscord | <.bobbbob> In reply to @helloworld_09810 "hey how could I": you can cd into the directory of it and just run nimble install by itself, or you can import the source file directly |
00:34:53 | FromDiscord | <auxym> or pass the parent path of that package to the compiler with `--path` |
00:55:16 | FromDiscord | <ezquerra> In reply to @bostonboston "I guess I dont": The example I gave is simplified |
00:56:58 | FromDiscord | <bostonboston> In reply to @ezquerra "The example I gave": Does the length of a need to grow or shrink |
00:57:16 | FromDiscord | <bostonboston> And if so I think it's impossible to do what you want |
00:58:09 | FromDiscord | <ezquerra> In the original code it needs to do both. I want to leave the input unmodified (and make no copies) when size matches the openarray length, and modified it otherwise |
00:59:09 | FromDiscord | <bostonboston> Do you want the source array/sequence to stay the same length in all cases |
00:59:26 | FromDiscord | <bostonboston> Or is mutability the answer to what you want to do |
01:07:20 | FromDiscord | <ezquerra> I want to set the size of the input to the requested value but I do not want to create a copy unless it really is necessary |
01:29:17 | FromDiscord | <Elegantbeef> @ezquerra indirect the call with a proc that creates an openarray |
01:30:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
01:39:10 | FromDiscord | <demotomohiro> I think if `oa.len >= size` you can use `toOpenArray(oa, 0, size - 1)` to create smaller size openArray. |
01:46:07 | FromDiscord | <Elegantbeef> Correct |
04:00:54 | * | Guest52 joined #nim |
04:06:49 | * | Guest52 quit (Quit: Client closed) |
06:38:56 | FromDiscord | <yoyojambo> What is the difference between std/re and std/nre? Are both wrappers for PCRE? |
06:39:11 | FromDiscord | <odexine> api differences iirc |
06:39:26 | FromDiscord | <Elegantbeef> Yes one is newer, ideally you use the regex package on the repo. Really ideal you do not use regex |
06:39:27 | FromDiscord | <odexine> iirc nre was supposed to replace re but ended up not |
06:40:55 | FromDiscord | <yoyojambo> Thanks! You mean the nim-regex package right? |
06:40:55 | * | azimut quit (Ping timeout: 240 seconds) |
06:41:02 | FromDiscord | <Elegantbeef> The pure nim one |
06:41:12 | FromDiscord | <yoyojambo> Thanks |
06:41:34 | FromDiscord | <odexine> pure nim one has similar limitations to the rust one if you're familiar; backreferences iirc dont work |
06:42:09 | FromDiscord | <Elegantbeef> Luckily if you do not regex you never have these issures! |
07:04:04 | * | azimut joined #nim |
07:08:55 | * | azimut quit (Ping timeout: 240 seconds) |
07:54:31 | * | Qaziquza quit (Ping timeout: 256 seconds) |
09:06:34 | NimEventer | New question by Nate Ackerman: Using nnkDotExpr to create an ident in Nim, see https://stackoverflow.com/questions/77673831/using-nnkdotexpr-to-create-an-ident-in-nim |
09:36:05 | FromDiscord | <_goel_> How do you make it work this in Nim 2.0?↵`for k, v in mpairs(arr):` |
09:36:27 | FromDiscord | <Elegantbeef> What do you mean? |
09:36:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:36:47 | FromDiscord | <Elegantbeef> Works just fine |
09:37:18 | FromDiscord | <_goel_> It says "wrong number of variables" |
09:37:30 | FromDiscord | <Elegantbeef> No it doesnt |
09:39:11 | FromDiscord | <demotomohiro> Maybe you are using '.' instead of ',' in for loop variable. |
09:40:38 | FromDiscord | <_goel_> I don't know, i'm using Nim 2.1.1, maybe is because the plugin says the LSP is using an older version (possibily incompatible). I'll try to update that |
09:40:53 | FromDiscord | <Elegantbeef> Ah yes not listening to the compiler |
09:41:01 | FromDiscord | <Elegantbeef> Listen to the compiler not your tooling regardless where you are |
09:55:41 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:56:30 | FromDiscord | <Elegantbeef> Pragma goes after return type |
10:00:53 | * | krux02 joined #nim |
10:18:39 | FromDiscord | <Phil> I wonder why we have this duality in naming between error and exception |
10:19:02 | FromDiscord | <Phil> They mean the same but the inconsistency annoys me every time when I define a new error and then raise it with newException |
10:20:09 | FromDiscord | <Elegantbeef> problem solved |
10:20:11 | FromDiscord | <Elegantbeef> Just don't use `newException` |
10:21:49 | FromDiscord | <Phil> The issue is that it's such a nice utility, I'd need to alias it basically and that's annoying to maintain and another thing making my codebase "special" if somebody else looks over it |
10:22:07 | FromDiscord | <Phil> Being different from the lang standard is friction, I at least try to keep that low |
10:22:15 | FromDiscord | <Elegantbeef> no I mean `raise (ref MyException)(msg: ...)` |
10:22:21 | FromDiscord | <Phil> (edit) "friction," => "friction for others," |
10:23:04 | FromDiscord | <rakgew> ah ok - thank you so much! |
10:23:37 | FromDiscord | <Phil> Maybe straight up ditching the utility is not soooo bad... just don't understand why that naming wasn't unified |
10:23:48 | FromDiscord | <Phil> Likely because it's not that big a deal I guess |
10:25:45 | FromDiscord | <griffith1deadly> just make alias for newException like newError :nim1: |
10:26:00 | FromDiscord | <Elegantbeef> Bleh |
10:27:00 | FromDiscord | <Phil> I mean, I'd support a name change for it, the problem is more that I don't want to introduce a third way of raising exceptions in general.↵Having more things to do the same just introduces friction and debates on which to use |
10:27:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:28:22 | FromDiscord | <Phil> Yeah, I guess like the "not having to specify parameters" thing, as stated it's not a big deal, just not a fan of having both the words "Error" and "Exception" in use as synonyms |
10:28:38 | FromDiscord | <Phil> I guess I like |
10:28:54 | FromDiscord | <Phil> by not specifying parameters I mean not specifying their names |
10:29:16 | FromDiscord | <Elegantbeef> The plus side is that whenever you add fields to exceptions you have the same syntax for all of them |
10:29:30 | FromDiscord | <Elegantbeef> no `newException` 90% and `T(...)` for the other 10% |
10:56:44 | FromDiscord | <planetis_m> why does random.nim ended up using the costly skipRandomNumbers in initRand https://github.com/nim-lang/Nim/blob/devel/lib/pure/random.nim#L604 and not what's suggested in https://prng.di.unimi.it/ ↵↵> We suggest to use SplitMix64 to initialize the state of our generators starting from a 64-bit seed, as research has shown that initialization must be performed with a generator radically different in nature from the one initialized t |
11:11:10 | FromDiscord | <demotomohiro> In reply to @planetis_m "why does random.nim ended": iirc, someone called `initRand(seed: int64)` with similar values (used time in short time or sequential numbers) to create multiple Rand object.↵Then, these `Rand`s generates similar value. |
11:13:07 | FromDiscord | <demotomohiro> So `skipRandomNumbers` was added so that multiple `Rand` initialized with similar seed generates different randam numbers. |
11:14:42 | * | derpydoo joined #nim |
11:21:44 | FromDiscord | <planetis_m> Isn't the same issue being solved by using SplitMix64 generator |
11:21:54 | FromDiscord | <planetis_m> (edit) "Isn't the same issue being solved by using ... SplitMix64generator?" added "the" | "generator" => "generator?" |
11:27:59 | FromDiscord | <Chronos [She/Her]> Out of curiosity, why aren't there checks for an unsigned integer overflowing? |
11:31:37 | FromDiscord | <Phil> I assume holdover from C |
11:31:41 | FromDiscord | <demotomohiro> In reply to @planetis_m "Isn't the same issue": Probably, yes. But we don't know how user provide seeds.↵If you want 2 `Rand`, initialize one `Rand` and copy it and call `skipRandomNumbers` with second `Rand`.↵If you want 3rd `Rand`, copy 2nd `Rand` and call `skipRandomNumbers` with 3rd one.↵| We provide ready-made jump functions for a number of calls equal to the square root of the period, to make it easy generating non-over |
11:32:02 | FromDiscord | <demotomohiro> (edit) "In reply to @planetis_m "Isn't the same issue": Probably, yes. But we don't know how user provide seeds.↵If you want 2 `Rand`, initialize one `Rand` and copy it and call `skipRandomNumbers` with second `Rand`.↵If you want 3rd `Rand`, copy 2nd `Rand` and call `skipRandomNumbers` with 3rd one.↵| We provide ready-made jump functions for" => "sent" | "number of calls equal to the square root of the period, to make it eas |
11:32:21 | FromDiscord | <odexine> In reply to @isofruit "I assume holdover from": Yes pretty much |
11:32:51 | FromDiscord | <demotomohiro> In reply to @chronos.vitaqua "Out of curiosity, why": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#language-design-why-are-unsigned-types-discouragedqmark↵> Unsigned int types are used for algorithms that randomize bit patterns. |
11:34:06 | FromDiscord | <Chronos [She/Her]> In reply to @demotomohiro "https://internet-of-tomohiro.netlify.app/nim/faq.en": Oh, does that mean some algorithms use overflowing for randomisation? |
11:34:14 | FromDiscord | <planetis_m> In reply to @demotomohiro "Probably, yes. But we": sure but my question was about initRand calling internally skip not about the use case that skip is useful. As seen in skip's runnable example |
11:34:19 | FromDiscord | <Chronos [She/Her]> Not all/a lot, just a few? |
11:35:13 | FromDiscord | <odexine> Some algorithms use overflowing as an “easy modulo” |
11:35:16 | FromDiscord | <demotomohiro> In reply to @chronos.vitaqua "Oh, does that mean": Hash or pseudo random number generaters, overflow happens frequently. |
11:44:34 | FromDiscord | <demotomohiro> In reply to @planetis_m "sure but my question": If users create multiple `Rand` properly using SplitMix64 or other ways and never call `initRand(seed: int64)` with similar seed values to create multiple `Rand`, I think we can remove `skipRandomNumbers` in `initRand(seed: int64)`.↵But I don't know if users really do so. |
11:46:58 | * | derpydoo quit (Ping timeout: 246 seconds) |
11:49:20 | FromDiscord | <niontrix (Tobias Heinlein)> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:50:39 | FromDiscord | <niontrix (Tobias Heinlein)> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:51:21 | * | derpydoo joined #nim |
11:51:58 | FromDiscord | <planetis_m> In reply to @demotomohiro "If users create multiple": I found the PR it implies that there is a different issue with a skewed first call to rand that doesn't follow the distribution https://github.com/nim-lang/Nim/pull/17468 |
12:06:44 | FromDiscord | <Phil> I can't say I've ever done anything with Sockets, only Websockets and Channels =/ |
12:07:29 | FromDiscord | <Phil> Sounds like it'd be better suited to be a forum question, chances are higher to get a response there as that gives more eyeballs a chance to look over the question |
12:08:29 | FromDiscord | <niontrix (Tobias Heinlein)> That's what I thought, too, a few minutes ago \:) |
12:11:23 | FromDiscord | <Chronos [She/Her]> In reply to @demotomohiro "Hash or pseudo random": Ah fair |
12:11:47 | FromDiscord | <Chronos [She/Her]> I wonder why Rust does this then... |
12:19:14 | FromDiscord | <Phil> Man, an async way to read input from the std-terminal would be really nice for my async examples in multithreaded communication |
12:58:47 | FromDiscord | <demotomohiro> In reply to @planetis_m "I found the PR": That issue might related to "Typical LFSR Issues" in↵https://www.pcg-random.org/posts/a-quick-look-at-xoshiro256.html |
13:11:12 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:13:36 | FromDiscord | <demotomohiro> In C, `#define FOO bar` just replaces `FOO` in the source code to bar. |
13:14:24 | FromDiscord | <rakgew> ah, so it is just an alias? |
13:15:14 | FromDiscord | <demotomohiro> yes. |
13:15:27 | * | cnx quit (Ping timeout: 260 seconds) |
13:15:40 | FromDiscord | <rakgew> thnk you!↵so then I actually can keep the nim const.. - but need to find how to get uint8\_t working |
13:16:50 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:17:17 | FromDiscord | <demotomohiro> #define is often used to define a constant value like `#define PI 3.141`.↵So c2nim converts #define to const values.↵But in your case, it is used to define type names. |
13:18:59 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:19:41 | FromDiscord | <rakgew> I see. thank you for your clear explanation. |
13:20:02 | FromDiscord | <rakgew> aha so c2nim got that perfectly right. \:-D |
13:20:09 | FromDiscord | <demotomohiro> `uint8_t` in C is a builtin type like `uint8` in Nim. |
13:20:22 | FromDiscord | <rakgew> a wait type intstead of const |
13:20:29 | FromDiscord | <rakgew> let me try.. \:-D |
13:22:25 | FromDiscord | <demotomohiro> In C, type aliases are usually defined using typedef like `typedef uint8_t UBYTE;`.↵Defining type aliases like `#define UBYTE uint8_t` looks bit strange. |
13:22:26 | FromDiscord | <rakgew> yay!! \\o/ that worked!↵thank you so much @demotomohiro ! |
13:23:32 | FromDiscord | <rakgew> so the nim uint8 is the correct equivalent for the uint8\_t ? |
13:24:01 | FromDiscord | <rakgew> at first I had asumed it needed cuint8 - for it coming from c? |
13:24:48 | FromDiscord | <odexine> likely cuint8 should be used |
13:25:18 | FromDiscord | <odexine> seems like it doesnt exist actually (i forgot, yes uint8 is the same as uint8_t) |
13:25:26 | FromDiscord | <demotomohiro> Both `uint8_t` in C and `uint` in Nim are 8bit unsigned int. |
13:26:22 | FromDiscord | <odexine> uint8 you mean haha |
13:26:41 | FromDiscord | <demotomohiro> you are right. my mistake. |
13:29:06 | FromDiscord | <demotomohiro> I don't think we needs `cuint8` as it is obvious that it is 8bit unsigned int.↵We needs `cint` or `cuint` because sizeof `int` or `unsigned int` in C is depends on platform/OS/compiler. |
13:30:00 | FromDiscord | <us> is there any compare of nim and https://github.com/fubark/cyber ? |
13:36:08 | FromDiscord | <Clonkk> Scripting language vs statically.compiled one usually don't have the same use case |
13:36:28 | FromDiscord | <demotomohiro> Nimscript can be embed to applications:↵https://github.com/beef331/nimscripter↵But I don't know if it supports concurrency. |
13:44:21 | * | cnx joined #nim |
13:49:57 | * | cnx quit (Ping timeout: 256 seconds) |
13:51:30 | FromDiscord | <rakgew> I was just wondering\: is there maybe already somewhere a repo that has wrappers for common c stdio functions like in nim? |
13:52:52 | FromDiscord | <rakgew> I just got fopen to work and then started with fread, when I thought\:↵I am probably not the first person needing them in nim, right? \:-D |
13:52:57 | FromDiscord | <Phil> As in, somebody doing an alternative implementation of std/syncio? |
13:53:24 | FromDiscord | <Phil> Or somebody just providing bindings for the stuff that std/syncio uses? |
13:53:50 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:53:57 | FromDiscord | <Phil> Ah, bindings then |
13:53:59 | FromDiscord | <rakgew> right - the bindings. \:-D |
13:56:02 | FromDiscord | <Phil> Hmm not that I see anything from the jump |
13:56:18 | FromDiscord | <Phil> I guess typically you use binding-generators and that's that |
13:57:36 | FromDiscord | <rakgew> I see. thank you for the response. |
13:59:28 | * | redj joined #nim |
14:04:32 | * | cnx joined #nim |
14:19:07 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
14:22:06 | FromDiscord | <demotomohiro> https://github.com/nim-lang/Nim/blob/devel/lib/std/syncio.nim↵syncio module wraps these C stdlib functions. |
14:23:24 | FromDiscord | <demotomohiro> `size_t` in C should be `csize_t` in Nim.↵`size_t` and `int` in C can be different size. |
14:24:15 | FromDiscord | <demotomohiro> !eval echo sizeof(cint), " ", sizeof(csize_t) |
14:24:18 | NimBot | 4 8 |
14:25:34 | FromDiscord | <rakgew> ah - very nice!! @demotomohiro\: thank you so much!! \:-D |
14:36:11 | * | jmdaemon quit (Ping timeout: 260 seconds) |
14:40:23 | FromDiscord | <rakgew> ../lib/std/syncio.nim is quite the binding treasure trove.. \:-D |
14:45:43 | FromDiscord | <Phil> I mean this raises the question of why not use std/syncio directly 😛 |
14:46:17 | FromDiscord | <demotomohiro> If you don't know much about C, these articles might help:↵https://internet-of-tomohiro.netlify.app/nim/gccguide.en↵https://internet-of-tomohiro.netlify.app/nim/clibrary.en |
14:47:13 | FromDiscord | <takemichihanagaki3129> How can I know if I'm running from bash or Poweshell from Nimscript? |
14:47:42 | FromDiscord | <takemichihanagaki3129> I know that I can do that for OSes with `hostOS`, is there something similar for shells? |
14:48:16 | FromDiscord | <rakgew> @demotomohiro \:↵thank you for the links! ideed I do not much know about c. \:-D↵I will read there (although I quite prefer nim!) ;-) |
14:49:07 | FromDiscord | <rakgew> hmm, good point - well I just learnt of it a few minutes ago. \:-D↵(@Phil) |
14:50:59 | FromDiscord | <Phil> In reply to @takemichihanagaki3129 "How can I know": Hmm the linux way would be to check `echo $0` that'll print out the shell name |
14:51:14 | FromDiscord | <Phil> (edit) "check" => "execute from the shell" |
14:51:36 | FromDiscord | <Phil> If that works on powershell no idea |
14:53:04 | FromDiscord | <rakgew> is there no $SHELL on ps? |
15:11:06 | FromDiscord | <takemichihanagaki3129> In reply to @isofruit "Hmm the linux way": Won't work on PS. |
15:11:15 | FromDiscord | <takemichihanagaki3129> In reply to @rakgew "is there no $SHELL": No, there is not. |
15:11:38 | FromDiscord | <odexine> PS is special |
15:11:47 | FromDiscord | <Phil> In reply to @takemichihanagaki3129 "Won't work on PS.": In that case an error response is still a response no?↵Can check if it works, if it doesn't its PS |
15:13:59 | FromDiscord | <takemichihanagaki3129> sent a code paste, see https://play.nim-lang.org/#ix=html> |
15:14:12 | FromDiscord | <takemichihanagaki3129> It's not the best solution, but works. |
15:14:14 | FromDiscord | <takemichihanagaki3129> Thanks. |
15:14:26 | FromDiscord | <takemichihanagaki3129> (edit) "solution," => "solution for other things," |
15:14:34 | FromDiscord | <takemichihanagaki3129> (edit) "works." => "works for this." |
15:49:44 | * | lucasta joined #nim |
16:37:53 | * | derpydoo quit (Ping timeout: 252 seconds) |
16:56:48 | FromDiscord | <ezquerra> In reply to @Elegantbeef "<@974046326088163438> indirect the call": Thank you @ElegantBeef! I wish there was a simpler way though |
17:13:37 | * | Guest62 joined #nim |
17:15:06 | * | Guest62 quit (Client Quit) |
17:43:12 | FromDiscord | <rakgew> sent a long message, see <!doctype html> |
17:48:43 | * | derpydoo joined #nim |
17:56:18 | FromDiscord | <Phil> Wouldn't you be using rather an "openArray" parameter or the like for this kind of stuff? |
17:56:44 | FromDiscord | <Phil> Not that I'm experienced but "array behind a pointer" makes my mind go towards openarray stuff immediately |
17:57:06 | FromDiscord | <Phil> And with openArray as your input type index-access should work just fine |
18:07:05 | FromDiscord | <rakgew> interesting - I had not though about openarray.↵I thought probably the the statically sized lookup table would be more performant. but to be honest with a full display switch rate of 2 full seconds for one full screen update of the e-ink display, performance is really not much of a concern there. \:-D↵I assumed keeping it close to the c-implementation with the static array might help me getting it accomplished at all. |
18:14:28 | FromDiscord | <Phil> I mean other than that the more experienced C-folks can answer that for you most likely, so beef and PMunch |
18:25:24 | FromDiscord | <rakgew> yes, they would surely know probably a boring piece of cake for them \:-D↵I still remember that cool keyboard stream by PMunch.↵well, for now I will {.emit.} those blocks and see how far I get..↵(@Phil) |
18:25:52 | FromDiscord | <odexine> i can take a look |
18:26:01 | FromDiscord | <bostonboston> `proc EPD_1IN54_V2_Lut(lut: openArray[cuchar]) =` |
18:26:07 | FromDiscord | <bostonboston> i think is all you need to do |
18:26:19 | FromDiscord | <bostonboston> like phil said |
18:27:07 | FromDiscord | <odexine> when it comes to c compat you probably want to use ptr UncheckedArray, but i dont know the full context yet |
18:27:10 | FromDiscord | <xyzzy2165> hi all! is there a way to compile nim to the current directory ?↵I am trying out a mixed C++ / nim project ... I want the folder structure to be↵`src-cpp, src-nim, src-nim-output` and then I want to write a make file that compiles everything. |
18:27:24 | FromDiscord | <Phil> @mratsim ↵> Welcome to nimble complete lunacy.↵You really know how to get my hopes up 😄 |
18:27:45 | FromDiscord | <rakgew> ah? ok I will try \:-D thank you all for looking into it!!↵maybe I should paste the version with the emits tor context |
18:28:27 | FromDiscord | <bostonboston> and depending on the sig of `EPD_1IN54_V2_SendData()` you may need `EPD_1IN54_V2_SendData(lut[i].addr)` |
18:29:15 | FromDiscord | <odexine> i'd like more context of usages yes |
18:30:24 | FromDiscord | <rakgew> @odexine \: here is the full file pasted\:↵https://paste.debian.net/1301398/ |
18:30:47 | FromDiscord | <rakgew> ^^ including the {.emit.} "cheats".. ;-D |
18:31:21 | FromDiscord | <odexine> oh hey waveshare |
18:31:27 | FromDiscord | <odexine> bet i have the exact model, not sure tho |
18:31:51 | FromDiscord | <rakgew> yes - cool! |
18:32:09 | FromDiscord | <rakgew> some day I plan on getting the one with the buttons.. \:-D |
18:33:31 | FromDiscord | <odexine> yeah i think anything that isnt a proc that's using emit should intake openarray[UBYTE] instead |
18:34:37 | FromDiscord | <odexine> this has the problem of needing `addr` when using the `ptr UBYTE` procs (the emit ones) though, so you probably should convert them to pure nim as well |
18:35:01 | FromDiscord | <odexine> why do you emit the full/partial vars btw? |
18:35:31 | FromDiscord | <rakgew> well, the compiler was complaining |
18:35:50 | FromDiscord | <bostonboston> I was going to recommend that as well, remove as much of the emits and importc as possible |
18:35:56 | FromDiscord | <rakgew> @odexine \: ok thank you! - I will give that a shot! \:-D |
18:36:20 | FromDiscord | <rakgew> yes - ideally I would love to be completey rid of it |
18:36:47 | FromDiscord | <rakgew> currently I only have it where got stuck |
18:37:07 | FromDiscord | <rakgew> in the other files I almost did not need emit at all.. |
18:37:40 | FromDiscord | <bostonboston> dddddddddddddddddddddddddddddddddddd |
18:37:47 | FromDiscord | <bostonboston> oops |
18:37:56 | FromDiscord | <bostonboston> pulling keys out of my keyboard |
18:38:20 | FromDiscord | <rakgew> that i d for delete for each emit, haha \:-D |
18:44:36 | FromDiscord | <Phil> It appears that docgen really would need some work - Or I guess contributing to hax's haxdoc given my recent nim doc problems.↵Ouchies |
18:44:43 | FromDiscord | <Phil> (edit) "docgen" => "nim doc" |
18:44:48 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:46:05 | Amun-Ra | yes, doc target needs some love |
18:46:31 | FromDiscord | <rakgew> @odexine \: thank you so much!! \:-D |
18:46:34 | FromDiscord | <Phil> Not just some, given that hax opted for an entirely new project rather than fixing up nim doc |
18:46:41 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:46:56 | FromDiscord | <odexine> btw, this does no bounds checking whatsoever |
18:46:59 | FromDiscord | <odexine> you might want to do that |
18:47:21 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:47:23 | FromDiscord | <odexine> seems like thats it |
18:47:36 | FromDiscord | <Phil> Does hax actually still lurk here or are they completely out? |
18:47:47 | FromDiscord | <odexine> technically `EPD_1IN54_V2_Lut` is also just replace, but i didnt think about it |
18:47:54 | FromDiscord | <odexine> In reply to @isofruit "Does hax actually still": still here very rarely |
18:47:54 | Amun-Ra | Phil: html5, better argument handling, etc. |
18:48:25 | FromDiscord | <Phil> In reply to @Amun-Ra "<@180601887916163073>: html5, better argument": You mean what docgen needs for improvement, or what haxdoc is doing better? |
18:48:46 | Amun-Ra | Phil: first one |
18:49:04 | FromDiscord | <Phil> I mean, before any HTML or argument handling whatsoever |
18:49:15 | FromDiscord | <rakgew> @odexine ok thank you - good to know! \:-D↵I just finished reverting all those cuchars - now I get compile error\:↵Error\: invalid type\: 'openArray[UBYTE]' for var↵does the openArray not work for UBYTE? |
18:49:21 | FromDiscord | <haxscramper> I have notifications on my name from matrics but that's about it↵(@Phil) |
18:49:25 | FromDiscord | <odexine> In reply to @rakgew "<@259277943275126785> ok thank you": ah |
18:49:34 | FromDiscord | <odexine> i forgot to account for mutability |
18:49:40 | FromDiscord | <odexine> let me check again |
18:49:42 | Amun-Ra | Phil: displaying arguments in the docs |
18:49:44 | FromDiscord | <odexine> brain was in C mode sorry |
18:49:55 | FromDiscord | <Phil> In reply to @haxscramper "I have notifications on": Ah check, I've ran into the rather infamous "nim doc forces me to do evil things, I don't like, ahhhhhhh" problem that mratsim also ran into |
18:50:25 | FromDiscord | <Phil> He linked to haxdoc which makes me believe you've acquired the domain knowledge for the problem space and an overview over how dire the situation is overall |
18:50:54 | FromDiscord | <rakgew> @odexine no worries. |
18:50:59 | FromDiscord | <odexine> In reply to @rakgew "<@259277943275126785> ok thank you": huh, can you send the whole error? |
18:51:08 | FromDiscord | <rakgew> sure |
18:51:15 | FromDiscord | <odexine> i dont read any code with mutability so far, since i dont know what some of these procs really do |
18:51:30 | FromDiscord | <haxscramper> More or less, yes. The main problem with nim doc is that it does not have any sort of data model for the documentation that you can nicely present later on, json is garbage HTML is hardcoded, so ... |
18:51:58 | FromDiscord | <Phil> Wait. so basically no proper abstraction layers and all hax all the way downs (no pun intended)? |
18:52:12 | FromDiscord | <Phil> Shit |
18:55:58 | FromDiscord | <haxscramper> It has been some time ago, so things might've changed a bit, but this sums things up |
18:56:01 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:56:02 | FromDiscord | <haxscramper> I think the perfect architecture for this kind of tools would be a data collector dumping json with a clearly defined schema and then you can parse it as you want |
18:56:04 | FromDiscord | <haxscramper> Separate compute from action, this kind of thing, First collect the code form pure semantic analysis and then do various computations on that. I think right now you can get a whole build fail if you have a wrong backtick in docs, or if your runnable example is wrong. |
18:56:04 | FromDiscord | <rakgew> yes quite cryptic, some of the parts. \:-/↵(@odexine) |
18:56:07 | FromDiscord | <Phil (he/him)> How feasible do you still believe it to be to e.g. kick haxdoc into a proper place compared to shaping up nim doc?↵I mean I know you've got an obvious opinion given that you started one tool likely because nim doc was/seemed beyond repair.↵I'd still like to hear your assessment.↵Not that I have time right now or any time in the near future, but I'm contemplating where to allocate time when I have downtime from owlkettle |
18:56:26 | FromDiscord | <Phil (he/him)> I entirely agree with your architecture there.↵Basically make an IR, from that IR render to whatever |
18:58:04 | FromDiscord | <Phil (he/him)> IR being intermediate representation |
18:58:24 | FromDiscord | <haxscramper> I think you can try to focus on nim doc first, last time I seriously touched it was at least a year ago if not more. For haxdoc there were other considerations, so probably easier to assess the current feasibility based on the intented architecuture. There is an RFC for JSON split https://github.com/nim-lang/RFCs/issues/447 ... with 1 comment but anyway |
18:58:25 | FromDiscord | <odexine> In reply to @rakgew "<@259277943275126785> \: this is": ahh, when it comes to vars, you cant use openarray; in this case it is indeed appropriatre to use array[159, UBYTE] here |
19:02:15 | FromDiscord | <haxscramper> For haxdoc I wanted to dump things into sqlite, be able to recreate the whole call graph on demand, interface with sourcetrail, track extra information about exception propagation, dump into many other formats and so on. |
19:02:16 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:02:17 | FromDiscord | <haxscramper> This might be an overkill, you can instead develop a data model for the JSON and see how far nim doc is from it |
19:02:20 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:02:22 | FromDiscord | <Phil (he/him)> I think that's an insanely cool project, but my first priority would be to get basic functionality to something useable that can tide people over in the meantime with something that is at least to some level of standard, if not insanely cool.The absolutely cool stuff like, as you mentioned, being able to monitor an entire project's callgraphs etc. imo really is a "later" kind fo project |
19:02:54 | FromDiscord | <haxscramper> You would be surprised how much things you can do if you just focus on getting the data model right. Even if you just target a dumb plumbing CLI tool that takes one (1) module and outputs exactly 1 json file from it, only stuff declared in that module file, you can easily built on top of this later on |
19:04:08 | FromDiscord | <Phil (he/him)> By which I mean I'm annoyed that my threads-as-local-server project can't have proper docs for its integration-modules for integration with other frameworks (lets be real, I wrote this for owlkettle and so that folks that want to integrate with other stuff have an easier time) and I want to fix that 😅️ |
19:04:10 | FromDiscord | <haxscramper> because if you have a JSON with right format (the most important part would be getting fully qualified naming scheme right, so importing from other modules would resolve to a name relative to the project root) then you can do other things on top of that |
19:04:45 | FromDiscord | <Phil (he/him)> Hmmm fair.↵Thanks for linking the RFC btw, I'll take a look.↵It also reminds me that I could've sworn PMunch wanted also stuff in that direction |
19:07:14 | FromDiscord | <Phil (he/him)> Ah, its his name behind the RFC, I recalled correctly |
19:07:47 | FromDiscord | <.bobbbob> for nimble, how do I overide something like run or build with a new task to do my own thing? Or am I supposed to do something else? |
19:08:31 | FromDiscord | <Phil> I mean, I can't claim to run into this problem because I pretty much never use those tasks |
19:08:42 | FromDiscord | <Phil> I just define my own tasks.↵Wait, do you know how to define your own nimble tasks? |
19:09:05 | FromDiscord | <rakgew> @.bobbbob \: I usually do it with with tasks like "release" |
19:09:10 | FromDiscord | <.bobbbob> yeah thats what I did but idk I like typing build or run better |
19:10:24 | FromDiscord | <Phil> nimble release was also what I did, I honetly just entirely ignore nimbles pre defined tasks |
19:10:36 | FromDiscord | <Phil> The only exception being test because its a nice-ish test-runner |
19:15:22 | FromDiscord | <Phil (he/him)> haxscramper Without having looked at any code\: Why does jsondoc not do it? |
19:17:25 | FromDiscord | <helloworld_09810> In reply to @isofruit "A way would be": this worked but when I tried it for a second package it didn't work |
19:18:34 | FromDiscord | <Phil> In reply to @helloworld_09810 "this worked but when": This strongly depends on what your paths are etc.↵Keep in mind that the path you put in there is a relative path to whereever you're calling the command from |
19:19:33 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:20:13 | FromDiscord | <Phil> Wait, it doesn't split out the comments as their own thing? |
19:20:15 | FromDiscord | <haxscramper> zero semantic data and I can't event ask a question 'what function returns this object' |
19:20:26 | FromDiscord | <haxscramper> yes, this↵(@Phil) |
19:20:33 | FromDiscord | <Phil> Okay I understand |
19:20:40 | FromDiscord | <Phil> Basically pretend it doesn't exist and rework |
19:20:41 | FromDiscord | <helloworld_09810> In reply to @isofruit "This *strongly* depends on": the other package is in the same directory as the first and it doesn't work |
19:21:45 | FromDiscord | <Phil> In reply to @helloworld_09810 "the other package is": I guarantee you there's an aspect being overlooked somewhere↵But without any reference to look at I can't really say anything about the specific problem |
19:22:05 | FromDiscord | <haxscramper> I need to take another look at the json generator code, but basically you would be writing 95% of the missing functionality, so ...↵(@Phil) |
19:22:23 | FromDiscord | <helloworld_09810> In reply to @isofruit "I guarantee you there's": any idea of what I should look for? |
19:22:54 | FromDiscord | <Phil> I don't know your project structure, what the command looks like that you're using and which directory you're calling from, blind advice is a bit hard to give here |
19:23:54 | FromDiscord | <helloworld_09810> I just have it all in a `nim.cfg` |
19:24:59 | FromDiscord | <Phil (he/him)> I think for me the first thing would be more the data model really. That's where everything stands and falls and that's bound by domain knowledge.↵How you extract everything and put it into that data model afterwards is just an implementation detail |
19:25:34 | FromDiscord | <Phil (he/him)> Which means I'll need to also dive into code-parsing I guess which will be fun in its own right =/ |
19:27:00 | FromDiscord | <helloworld_09810> In reply to @isofruit "I don't know your": the command looks like `nim c -r --path="package2" --path="package1"` |
19:27:54 | FromDiscord | <helloworld_09810> (edit) "looks like" => "that I am running is" |
19:28:01 | FromDiscord | <helloworld_09810> (edit) "In reply to @isofruit "I don't know your": the command that I am running is ... `nim" added "" |
19:29:10 | FromDiscord | <Phil> Project structure? |
19:31:01 | FromDiscord | <haxscramper> `PNode` is similar to `NimNode`, although there are not a lot of debugging facilities for dumping the information you are working with. We have https://nim-works.github.io/nimskull/compiler/utils/astrepr.html and IIRC nim also has something similar with the same name? |
19:31:21 | FromDiscord | <Phil (he/him)> Sounds like sth to deep dive into with PMunch possibly, I just hope he took some time back then to look into things and has a decent idea for a starting point and how to get into the swing of things |
19:33:23 | FromDiscord | <rakgew> haxscramper (@haxscramper\:matrix.org) macros.dumpAstGen() ? |
19:35:17 | FromDiscord | <haxscramper> `dumpAstGen` returns the structure of calls for generating the code, but when working with compiler internals you need to see all the hidden info instead, like name of the parent module where the symbol for type was defined for example. |
19:51:15 | FromDiscord | <Phil> In reply to @haxscramper "zero semantic data and": Actually, for that question in particular, can't you just query the JSON file (or all JSON files of a project), filter for type skProc, then filter for signature with a return field whose value is "NimObject" ? |
19:51:53 | FromDiscord | <Phil> You need to do some computation to get there aka query your data, but the information is inside the JSON |
19:52:27 | FromDiscord | <Phil> So far the only thing I can see missing seems to be that comments don't look like they're being handled well |
19:59:32 | FromDiscord | <rakgew> haxscramper (@haxscramper\:matrix.org) \: I see, thank you for that info, that surely sounds very useful.↵are the tools to get this extra information also available when the code runs like in inim, or is it purely for external inspection? |
20:06:59 | FromDiscord | <haxscramper> Mostly for inspection, this is an internal implementation detail of the compiler, so you would need to expose it to the macro API to make anything out of it |
20:25:12 | * | lucasta quit (Quit: Leaving) |
20:47:35 | FromDiscord | <Elegantbeef> @ezquerra I mean it's already a pretty simple way 😄 |
20:48:31 | FromDiscord | <ezquerra> That’s true, but having to separate the code into an implementation procedure feels a bit hacky |
20:49:07 | FromDiscord | <ezquerra> It’d be nice to be able to assign a value into a let without a copy |
20:49:46 | FromDiscord | <Elegantbeef> Well it's less hacky than using a template to alias an `openArray` |
20:49:47 | FromDiscord | <Elegantbeef> There are no view types so there is no nice way to do this aside from using a parameter to capture an openarray |
20:51:06 | FromDiscord | <Elegantbeef> You can |
20:51:20 | FromDiscord | <Elegantbeef> But that implies the right hand side is a sequence that is `sink` |
20:51:30 | FromDiscord | <Elegantbeef> Or just a sequence that cursors |
20:57:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:57:06 | FromDiscord | <Elegantbeef> Which is just.... yea |
21:16:09 | FromDiscord | <ezquerra> As you said… yea 🙂 |
22:49:59 | * | Arthur quit (Quit: The Lounge running.on.hess.the.br) |
22:59:37 | FromDiscord | <Chronos [She/Her]> Can someone explain how concepts work, if they're not supposed to be use like interfaces? |
23:02:19 | FromDiscord | <Elegantbeef> They're generic constraints |
23:02:23 | FromDiscord | <Elegantbeef> You define the shape you want |
23:02:37 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/mathtypes.nim |
23:02:40 | FromDiscord | <Chronos [She/Her]> And how is that not similar to interfaces? |
23:02:53 | FromDiscord | <Elegantbeef> Interfaces are a runtime defined implementation generally |
23:03:11 | FromDiscord | <Chronos [She/Her]> Ah |
23:06:43 | FromDiscord | <Phil> Hmm, for my better understanding: https://github.com/nim-lang/Nim/issues/22510#issuecomment-1857436419↵What bit of the previous example was misusing the threading API? |
23:07:51 | FromDiscord | <Elegantbeef> Supposedly threads are supposed to be global... I don'tk now |
23:08:43 | FromDiscord | <Phil> Ah... hmm imo practically that's the same as running in a main proc, but fair |
23:08:59 | FromDiscord | <Elegantbeef> Yea I do not get why threads are supposed to be global |
23:09:43 | FromDiscord | <Phil> I was not sure if it was maybe the channel container that was passed around via pointer or the while-true loops that he shut off with a global atomic-bool |
23:10:33 | * | Qaziquza joined #nim |
23:10:47 | FromDiscord | <Phil> Araqs new example does show really nicely though how brutally the memory consumption jumps up |
23:11:08 | FromDiscord | <Phil> Always 4Kb at a time |
23:11:42 | FromDiscord | <Phil> Wait, that's the size of that seq |
23:11:57 | FromDiscord | <Elegantbeef> It's also the size of a page |
23:12:08 | FromDiscord | <Elegantbeef> Atleast in 32bit 😄 |
23:12:52 | FromDiscord | <Phil> Nevermind, if you change the seq to 100 the memory consumpion is way more sporadic so nevermind |
23:13:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
23:13:56 | FromDiscord | <Phil> (edit) |
23:57:22 | FromDiscord | <System64 ~ Flandre Scarlet> ``(osc.pAcc + prevSample)``↵I need to add an int16 to an uint16, what can I do? Do I absolutely need to cast? |
23:57:48 | FromDiscord | <Elegantbeef> `uint16(myVal) + myUint16` |
23:57:54 | FromDiscord | <Elegantbeef> How do people always resort to casting |
23:58:22 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "`uint16(myVal) + myUint16`": problem is prevSample can be negative |
23:58:27 | FromDiscord | <girvo> CAST ALL THE THINGS |
23:58:40 | FromDiscord | <Elegantbeef> So.... then what do you want the outcome to be? |
23:58:59 | FromDiscord | <Elegantbeef> Adding signed ints to unsigned values means you need to do something about the negatives |
23:59:50 | FromDiscord | <System64 ~ Flandre Scarlet> I don't want to turn the uint16 to an int16 because it goes from 0 to (2^16 - 1) |