00:03:12 | FromDiscord | <Elegantbeef> Araq says to write Nim that calls C |
00:07:08 | FromDiscord | <sOkam!> k ✍️ |
00:50:04 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4mQJ |
00:50:18 | FromDiscord | <Elegantbeef> What does "not work" mean |
00:50:20 | FromDiscord | <Nilts> it keeps on saying that the last child is not a child of e |
00:50:30 | FromDiscord | <Nilts> (edit) "it keeps on saying that the last child ... is" added "of e" |
00:50:39 | FromDiscord | <Elegantbeef> The actual error please |
00:53:23 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4mQK |
00:54:08 | FromDiscord | <Phil> Okay, docs: check. tests: check↵Setup for github pipelines to deploy docs and run tests: check↵I think nimword is finally ready for deployment, aw yeah |
00:54:16 | FromDiscord | <Phil> (edit) "deployment," => "publication," |
00:54:58 | FromDiscord | <Phil> But dear lord github pipelines keep being a pain |
00:55:20 | FromDiscord | <Elegantbeef> \`replaceChild(newChild, oldChild) |
00:55:21 | FromDiscord | <Elegantbeef> You're doing it backwards |
00:55:21 | FromDiscord | <Elegantbeef> Another case of reading the JS source |
00:55:37 | FromDiscord | <Nilts> In reply to @Elegantbeef "\`replaceChild(newChild, oldChild)": idk how i missed that, thanks 👍 |
00:55:39 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/dom.html#replaceChild%2CNode%2CNode%2CNode follows new, old |
01:16:59 | * | ltriant quit (Ping timeout: 248 seconds) |
01:28:43 | FromDiscord | <ringabout> What should I do to raises lists if Window and Linux raises different exceptions? |
01:30:00 | FromDiscord | <ringabout> What if an exception can never happen in reality, should I add it to raises lists or suppress it using `try except`? |
01:48:09 | FromDiscord | <ringabout> https://github.com/nim-lang/Nim/pull/21323#issuecomment-1413033755 |
02:32:21 | FromDiscord | <leorize> you should make them raise the same thing ofc |
02:32:55 | FromDiscord | <leorize> but usually you can just add it in raises |
02:34:27 | FromDiscord | <ringabout> I see, thanks. That's what I did, since they are platform-specific exceptions. |
02:35:19 | FromDiscord | <ringabout> Hi, leorize, did you happen to know why https://github.com/nim-lang/Nim/pull/19932/files doesn't pass the test? |
02:36:04 | FromDiscord | <ringabout> introduced by https://github.com/nim-lang/Nim/commit/6b2d8bfc8b9e46ae92e490111cb6a2abc49a32b6 |
02:37:33 | FromDiscord | <ringabout> Before `if sslVersion >= 0x010101000 and not sslVersion == 0x020000000:` is always false, so `SSL_CTX_set_ciphersuites` is never executed. |
02:42:06 | FromDiscord | <ringabout> I'm compiling nimble to debug. |
03:04:04 | FromDiscord | <ringabout> Or `SSL_CTX_set_ciphersuites` cannot be used when version exceeds 0x020000000. |
03:23:26 | FromDiscord | <leorize> you might have to update the cipher list |
03:25:22 | FromDiscord | <ringabout> In reply to @leorize "you might have to": I see, let me try again |
03:27:04 | FromDiscord | <leorize> hmm looks correct to me |
03:27:27 | FromDiscord | <leorize> can you reproduce this locally? |
03:28:30 | FromDiscord | <ringabout> I didn't reproduce it on Windows. |
03:28:58 | FromDiscord | <ringabout> I'm testing it using CI https://github.com/nim-lang/Nim/pull/21324 |
03:32:19 | FromDiscord | <ringabout> Btw, in `if sslVersion >= 0x010101000 and sslVersion != 0x020000000:` why does `0x020000000` is excluded? |
03:32:29 | FromDiscord | <ringabout> (edit) "does" => "is" | "is" => "" |
03:33:08 | FromDiscord | <leorize> `0x020000000` is libressl |
03:33:21 | FromDiscord | <ringabout> I see |
03:33:25 | FromDiscord | <leorize> this is why openssl version number jumps from 1 -\> 3 |
03:35:18 | FromDiscord | <ringabout> It defaults to `CiphersModern` https://github.com/nim-lang/Nim/pull/21324/commits/c531d1bcf934f124cf591f32c6b39964b3eb924f but it still fails the tests. |
03:35:47 | FromDiscord | <ringabout> nimble simply calls `newContext(verifyMode = sslVerifyMode)` |
03:36:24 | FromDiscord | <ringabout> Let me check cipher lists. |
03:40:34 | FromDiscord | <leorize> alright I think I got the problem |
03:40:54 | FromDiscord | <leorize> actually nvm |
03:40:59 | FromDiscord | <leorize> but there's a bug here none the less |
03:41:14 | FromDiscord | <leorize> so, this code will always fail with openssl \>= 3 |
03:44:01 | FromDiscord | <leorize> this is because `SSL_CTX_set_cipher_list` yields failure if it couldn't see any TLS \<= 1.2 ciphers |
03:45:16 | FromDiscord | <ringabout> Yeah, I suspected that. Though the manual says This function does not impact TLSv1.3 ciphersuites. I'm not so sure of its return. |
03:45:52 | FromDiscord | <leorize> it's still bolted onto a `raiseSSLError()` so... |
03:45:53 | FromDiscord | <ringabout> I'm moving it to the else branch, |
03:47:02 | FromDiscord | <leorize> frankly if you can't disable all ciphers then it's not gonna give you much more security given that TLS1.2 downgrade is possible if you don't set the cipher |
03:47:32 | FromDiscord | <leorize> there's this\: https://github.com/nim-lang/Nim/pull/14556 if you ever want to revive it |
03:48:06 | FromDiscord | <leorize> then you can skip `SSL_CTX_set_cipher_list` if min TLS ver is \>= 1.3 |
03:49:26 | FromDiscord | <ringabout> Yeah, I will keep that in mind. We shall see whether the action uses TLS 1.3 |
03:50:10 | FromDiscord | <ringabout> (edit) removed "We shall see whether the action uses TLS 1.3" |
03:50:36 | FromDiscord | <ringabout> I'm trying to identify the problem first. |
03:52:11 | FromDiscord | <ringabout> Or we could simply make it a define or a parameter in the worse case. |
03:53:23 | FromDiscord | <ringabout> Or we can figure out the return of `SSL_CTX_set_cipher_list` in TLS 3.0 situation. |
03:53:33 | FromDiscord | <ringabout> (edit) "3.0 situation." => "1.3situation." |
03:53:51 | FromDiscord | <leorize> at this point you should consider spinning up an Ubuntu 18.03 VM |
03:54:43 | FromDiscord | <ringabout> 18.03 ? |
03:55:10 | FromDiscord | <ringabout> The linux i386 is using ubuntu 18.04 |
03:56:36 | FromDiscord | <ringabout> I skipped the `SSL_CTX_set_cipher_list` check, but it failed at the same place |
03:56:42 | FromDiscord | <ringabout> https://github.com/nim-lang/Nim/actions/runs/4071078818/jobs/7012536718 |
04:04:48 | FromDiscord | <ringabout> Will `SSL_CTX_set_ciphersuites` fail if TLS < 1.3? |
04:06:36 | FromDiscord | <ringabout> It's not feasible without https://github.com/nim-lang/Nim/pull/14556/files |
04:09:16 | FromDiscord | <leorize> according to the manual it does |
04:09:45 | FromDiscord | <leorize> but that's only if you don't have TLS1.3 ciphers in the list |
04:09:48 | FromDiscord | <leorize> which we do have |
04:11:54 | FromDiscord | <ringabout> I can reproduce on Windows |
04:12:04 | FromDiscord | <ringabout> (edit) "I can reproduce ... on" added "it" |
04:12:16 | FromDiscord | <ringabout> It yields |
04:12:24 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4mQY |
04:12:41 | FromDiscord | <ringabout> for `SSL_CTX_set_ciphersuites` |
04:16:02 | FromDiscord | <ringabout> We probably need a separate parameter for `SSL_CTX_set_ciphersuites`. |
04:16:12 | FromDiscord | <ringabout> (edit) "a separate" => "an extra" |
04:22:24 | FromDiscord | <ringabout> https://media.discordapp.net/attachments/371759389889003532/1070559792210386984/image.png |
04:22:36 | FromDiscord | <ringabout> Other libraries use this fashion |
04:31:03 | * | arkurious quit (Quit: Leaving) |
04:33:04 | * | ltriant joined #nim |
04:42:49 | * | peterhil quit (Ping timeout: 252 seconds) |
04:47:10 | * | peterhil joined #nim |
04:49:31 | * | peterhil quit (Max SendQ exceeded) |
04:51:57 | * | peterhil joined #nim |
05:02:57 | * | rockcavera quit (Remote host closed the connection) |
05:24:46 | FromDiscord | <ringabout> @leorize finally I found the root cause |
05:26:14 | FromDiscord | <ringabout> https://media.discordapp.net/attachments/371759389889003532/1070575851684495370/image.png |
05:26:23 | FromDiscord | <ringabout> The return value of original `SSL_CTX_set_ciphersuites` is missed. |
05:27:10 | FromDiscord | <leorize> lol, so what error did it throw? |
05:27:39 | FromDiscord | <ringabout> Now it works |
05:27:49 | FromDiscord | <ringabout> In reply to @leorize "lol, so what error": No error |
05:28:35 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4mR5 |
05:28:38 | FromDiscord | <ringabout> No error reported. |
05:29:49 | FromDiscord | <leorize> did it return 1? |
05:29:49 | FromDiscord | <leorize> if it returns 1 then it's successful |
05:30:37 | FromDiscord | <ringabout> In reply to @leorize "did it return 1?": Yeah, I think so if cipherModern is used |
05:30:50 | FromDiscord | <ringabout> It works locally on my PC. |
05:38:17 | FromDiscord | <leorize> if its 1 then it should be fine, I think |
05:39:19 | FromDiscord | <ringabout> yeah |
05:56:25 | FromDiscord | <sOkam!> if i `importc` a function from a file, does the compiler just know where to get all of that file dependencies? |
05:56:54 | FromDiscord | <sOkam!> (edit) "if i `importc` a function from a ... file," added "c" |
05:57:29 | FromDiscord | <Elegantbeef> If you provide a header it includes the header |
05:57:39 | FromDiscord | <sOkam!> but what about the c files? |
05:57:58 | FromDiscord | <sOkam!> i understand if i give the header, then it has the declarations. but how do i link the actual code? |
05:57:58 | FromDiscord | <Elegantbeef> Nim is not a C compiler, if you need to compile in C files you can use `{.compile` |
05:58:15 | FromDiscord | <Elegantbeef> You can either link it using `compile` or passing like you would in C land |
05:58:24 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim#L3-L24 |
05:59:14 | FromDiscord | <sOkam!> i see. so after you say that, you can use importc? |
05:59:39 | FromDiscord | <Elegantbeef> That's all i do, the linker finds the symbols when it compiles |
06:01:46 | FromDiscord | <sOkam!> i imagine if I want to get all files inside a folder, i need to create a proc for it 🤔 |
06:03:27 | FromDiscord | <Elegantbeef> Well if you have a header that imports all your C files there isnt an issue |
06:03:33 | FromDiscord | <sOkam!> i always compile this project with `somefolder.glob(".c")`, because otherwise the buildsystem reaches the 4k lines without breaking a sweat ⚰️ |
06:04:07 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Well if you have": oh true |
06:04:27 | FromDiscord | <sOkam!> wait, import or include? |
06:04:36 | FromDiscord | <Elegantbeef> Otherwise you'd need to make a macro that iterated and found all the `.c` files |
06:04:49 | FromDiscord | <Elegantbeef> include of course |
06:05:00 | FromDiscord | <sOkam!> then i would need to create the file manually anyway |
06:05:07 | FromDiscord | <sOkam!> same problem, but moved to a C file |
06:05:42 | FromDiscord | <Elegantbeef> Well it's Nim macros vs C 😄 |
06:05:46 | FromDiscord | <sOkam!> the issue is 🐠 memory. i -always- always forget things. and be convinced that I did it, and waste 10h because i forgot some stupid small detail |
06:06:17 | FromDiscord | <Elegantbeef> You can always compile the object files before then link them manually aswell |
06:06:49 | FromDiscord | <sOkam!> is that not the same problem, but searchign for `.o` instead of `.c`? |
06:07:06 | FromDiscord | <Elegantbeef> Not if you make a build script |
06:07:13 | FromDiscord | <Elegantbeef> Using nimscript, make, cmake, or whatever fancy tools you see fit |
06:07:41 | FromDiscord | <sOkam!> but what do you build and how do you add it? |
06:07:50 | FromDiscord | <sOkam!> like thats what im not getting |
06:08:13 | FromDiscord | <sOkam!> its the interfacing with nim part of the buildsystem that im not grasping |
06:08:31 | FromDiscord | <Elegantbeef> You can pass linker flags just like you would if you were using C |
06:08:42 | FromDiscord | <Elegantbeef> So you'd just use `--passL` to link the objects you precompiled |
06:09:01 | FromDiscord | <Elegantbeef> Or you can use a macro to emit the `{.compile: ....}`s |
06:09:15 | FromDiscord | <Elegantbeef> Or you can generate a C file that includes your headers |
06:09:23 | FromDiscord | <Elegantbeef> then just compile that in nim |
06:09:31 | FromDiscord | <Elegantbeef> There are a few ways you can do this |
06:09:38 | FromDiscord | <sOkam!> i struggle with your demystifying macros article, i don't think i can tackle this without 3 weeks of being lost in macro land |
06:12:18 | FromDiscord | <Elegantbeef> Well I said a multitude of options to get a solution |
06:22:40 | FromDiscord | <tfp> is there a lib for something like linq |
06:22:49 | FromDiscord | <tfp> just like little combinators for iterators, not sure what you call it |
06:22:58 | FromDiscord | <Elegantbeef> zero functional |
06:23:17 | FromDiscord | <tfp> do u know if they're lazy? |
06:23:39 | FromDiscord | <Elegantbeef> > A library providing (almost) zero-cost chaining for functional abstractions in Nim. |
06:26:39 | FromDiscord | <tfp> well idk that doesn't mean it's lazy or not |
06:27:02 | FromDiscord | <tfp> it could just mean it's low overhead cos it's transpiling it to a little state machine |
06:27:05 | FromDiscord | <tfp> with macros or something |
06:27:16 | FromDiscord | <tfp> lazy means like, it doesn't evaluate the iterator until u ask it to |
06:27:16 | FromDiscord | <Elegantbeef> You can look at the generated code to see if it's lazy |
06:27:23 | FromDiscord | <tfp> ye it's not |
06:27:24 | FromDiscord | <Elegantbeef> I know what lazy means |
06:27:27 | FromDiscord | <tfp> i looked while u were explaining |
06:27:42 | FromDiscord | <tfp> it didn't seem like u did cos the title doesn't say anything about lazy |
06:27:53 | FromDiscord | <tfp> unless u were just pasting it not in response to my post |
06:28:06 | FromDiscord | <tfp> soz |
06:30:03 | FromDiscord | <tfp> maybe lazy doesn't even make sense in a language like nim |
06:30:52 | FromDiscord | <Elegantbeef> It does in some regards, but for iterators a lazy one doesnt make much sense |
06:31:25 | FromDiscord | <Elegantbeef> Closures exist, which would be the closest, but a normal inline iterator being 'lazy' doesnt really mean anything |
06:31:25 | FromDiscord | <Elegantbeef> It's pasted where it's call so there is really no way to make it 'lazy' |
06:31:38 | FromDiscord | <tfp> i think it's usually done because it saves a lot of memory |
06:31:55 | FromDiscord | <tfp> and potentially cpu if the iterator isn't used |
06:32:14 | FromDiscord | <Elegantbeef> Given what Nim iterators are i dont think it matters |
06:32:24 | FromDiscord | <tfp> what are nim iterators? |
06:32:39 | FromDiscord | <tfp> oh i see |
06:32:42 | FromDiscord | <Elegantbeef> Like i said inlined where called, or closure |
06:34:42 | FromDiscord | <tfp> so it just like unrolls it into a seq and then loops through it under the hood? |
06:34:53 | FromDiscord | <Elegantbeef> Nope |
06:35:11 | FromDiscord | <tfp> oh u mean inlined like as in an inlined function call? |
06:35:16 | FromDiscord | <Elegantbeef> No |
06:35:27 | FromDiscord | <Elegantbeef> Inlined as in the iterator is pasted as a C loop in the code as you wrote it |
06:36:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mRc |
06:36:08 | FromDiscord | <Elegantbeef> It actually uses a while loop internally afaik |
06:36:54 | FromDiscord | <tfp> that looks lazy to me |
06:37:19 | FromDiscord | <Elegantbeef> I wouldnt really call it lazy as much as just verbatim 😄 |
06:37:26 | FromDiscord | <Elegantbeef> Since Nim iterators are just fancy templates |
06:37:49 | * | ltriant quit (Ping timeout: 268 seconds) |
06:38:12 | FromDiscord | <tfp> well if u did a lot of work like in that for loop, but then in the iterator u only needed the 3rd element, for example |
06:38:28 | FromDiscord | <Elegantbeef> You'd iterate 3 times then break |
06:38:41 | FromDiscord | <Elegantbeef> Iterators are not collections, they're control flow |
06:39:18 | FromDiscord | <Elegantbeef> Closure iterators can be considered like streams, since they capture data |
06:39:54 | FromDiscord | <tfp> my brain hurts but i still think they have the same lazy properties |
06:40:12 | FromDiscord | <tfp> u would just have to implement it that way in a macro i guess? instead of the typical implementation |
06:40:34 | FromDiscord | <tfp> i guess u can't use dynamic dispatch with them though, right? |
06:40:56 | FromDiscord | <Elegantbeef> They're templates so of course not |
06:56:15 | FromDiscord | <tfp> oh jeeze |
06:56:35 | FromDiscord | <tfp> the nim compiler segfaults when i just stick zero_functional into my program and tried to use it in main |
06:57:02 | FromDiscord | <tfp> but i created an empty project to test and it doesn't segfault with the same 2 lines added |
06:57:18 | FromDiscord | <tfp> `import zero_functional` `let x = [1, 2, 3] --> map(it 2)` |
06:58:05 | FromDiscord | <tfp> i wiped cache in ~/.cache/nim too |
06:59:26 | * | kenran joined #nim |
07:03:37 | FromDiscord | <tfp> yeah i narrowed it down by binary search deleting lines of code |
07:03:57 | FromDiscord | <tfp> actually crazy how easy that is in nim because it doesn't support forward declarations |
07:04:15 | FromDiscord | <Elegantbeef> ● but it does support forward declarations\ |
07:04:57 | FromDiscord | <tfp> maybe for functions? i've only tried for types |
07:05:10 | FromDiscord | <Elegantbeef> Yea no forward declares for types |
07:05:18 | FromDiscord | <tfp> declaring `macro add(self: untyped, ty: typed, value: untyped) =` and then importing zero_functional makes the compiler segfault |
07:09:22 | FromDiscord | <tfp> i think i understand why |
07:09:32 | FromDiscord | <tfp> the first arg `self: untyped` is probably invoking some broken overload resolution thing |
07:13:02 | FromDiscord | <tfp> ye changing that type does fix it |
07:19:07 | FromDiscord | <sOkam!> @ElegantBeef lets say i went with the macro version for creating a glob of files to the compile pragma↵what should I be looking for in the module?↵i was thinking about it while cooking, and realized that I don't even know how a macro is meant to read a folder and interpret whatever is there 🤔↵any guidance of where I should be looking for the correct things? |
07:19:33 | FromDiscord | <Elegantbeef> `import std/os` and `walkFiles` or `walkDir` or whichever works |
07:19:55 | FromDiscord | <sOkam!> doesnt a macro only understand the ast at compile time? |
07:20:04 | FromDiscord | <Elegantbeef> Macros are code that run on the VM |
07:20:08 | FromDiscord | <sOkam!> if not, i was completely mistaken in my understanding (unsurprising, i know) |
07:20:10 | FromDiscord | <Elegantbeef> They are Nim code |
07:20:22 | FromDiscord | <sOkam!> what does it mean to run on the vm? |
07:20:28 | FromDiscord | <Elegantbeef> Macros take in AST and can operate on it |
07:20:37 | FromDiscord | <Elegantbeef> But it's just Nim code that is compiled to the VM |
07:20:53 | FromDiscord | <Elegantbeef> Macros dont even need to take in AST they can just emit it |
07:20:57 | FromDiscord | <sOkam!> so you can do anything inside a macro, but you also have access to the ast instead? |
07:21:28 | FromDiscord | <Elegantbeef> you have access to the AST of your parameters or your own generated NimNodes |
07:21:52 | FromDiscord | <sOkam!> i don't know what that means |
07:22:20 | FromDiscord | <sOkam!> is that relevant to this specific usecase? becasue i need to start as stupid dumb small as possible, if i want to actually understand it |
07:22:30 | FromDiscord | <Elegantbeef> When you call a macro with code you're given the AST of that code |
07:22:31 | FromDiscord | <Elegantbeef> No you do not need to take in any ast |
07:22:34 | FromDiscord | <Elegantbeef> you only need to generate it |
07:22:37 | FromDiscord | <sOkam!> k |
07:22:39 | FromDiscord | <sOkam!> ty |
07:23:34 | FromDiscord | <sOkam!> what do you do with the resulting output of the macro? |
07:23:50 | FromDiscord | <Elegantbeef> You emit `{.compile: yourFile.c.}` |
07:24:12 | FromDiscord | <sOkam!> the macro emits? because as a person i dont know how to emit |
07:24:26 | FromDiscord | <Elegantbeef> Yes |
07:24:31 | FromDiscord | <sOkam!> kinda joking, but also kinda serious because i don't know how to emit it 😄 |
07:24:42 | FromDiscord | <sOkam!> kk |
07:24:46 | FromDiscord | <Elegantbeef> Refer back to my macro tutorial |
07:25:24 | FromDiscord | <sOkam!> i only see one hit for the word emit in the article |
07:25:35 | FromDiscord | <Elegantbeef> Read the entire macro |
07:27:14 | FromDiscord | <Elegantbeef> tutorial\ |
07:27:16 | FromDiscord | <sOkam!> i still dont really get what i was asking |
07:27:20 | FromDiscord | <sOkam!> after reading that macro |
07:27:38 | FromDiscord | <sOkam!> yeah, you call it. but is that generated there, or how do you use the ast? |
07:27:45 | FromDiscord | <Elegantbeef> You dont |
07:27:50 | FromDiscord | <Elegantbeef> It emits ast that the compiler uses |
07:28:23 | FromDiscord | <sOkam!> so when you call the macro, the compiler reads whatever is inside as if it was outside? |
07:29:04 | FromDiscord | <Elegantbeef> The compile takes the AST you emit and then compiles it |
07:29:08 | FromDiscord | <Elegantbeef> You do not need to do anything with it |
07:29:16 | FromDiscord | <Elegantbeef> 'emit' means the ast you return from the macro |
07:29:20 | FromDiscord | <sOkam!> but what im not understanding is the emitting part |
07:29:25 | FromDiscord | <Elegantbeef> Macros are callers that can return AST |
07:29:32 | FromDiscord | <Elegantbeef> that returning of AST is 'emitting' im using |
07:29:35 | FromDiscord | <sOkam!> yeah i get that so far |
07:30:06 | FromDiscord | <sOkam!> when a variable returns a number, it can be thought of as emitting a number↵but... when a macro returns an ast, what the hell do you do with it. that's what im not getting |
07:30:25 | FromDiscord | <sOkam!> i understand a template, its just copypaste code |
07:30:44 | FromDiscord | <sOkam!> i don't know if a macro is doing the same in essence, that's the question i guess |
07:33:14 | FromDiscord | <sOkam!> let me rewrite that as a concrete/specific question:↵is (in practice and in simplified terms) a macro doing the same than a template in principle?↵wherever you write it, new code is generated right there? |
07:37:54 | FromDiscord | <Elegantbeef> It just compiles the code |
07:37:54 | FromDiscord | <Elegantbeef> The compiler gets AST and compiles it |
07:37:55 | FromDiscord | <Elegantbeef> You do not do anything with AST |
07:37:55 | FromDiscord | <Elegantbeef> You generate AST nodes give it to the`result` and it compiles the code |
07:38:20 | FromDiscord | <Elegantbeef> Yes they both generate code |
07:38:45 | FromDiscord | <Elegantbeef> One is basic code substitution, the other takes in AST and can run code on it to generate new Code |
07:50:57 | FromDiscord | <Rika> its like a function but you get code (in AST form) and return code to then be compiled |
08:03:21 | FromDiscord | <tfp> you can think of macros as programs that rewrite source code |
08:04:01 | FromDiscord | <tfp> so they are similar to templates in that manner like you mentioned |
08:04:33 | FromDiscord | <tfp> (edit) "programs" => "functions" |
08:04:55 | FromDiscord | <sOkam!> ty |
08:07:11 | FromDiscord | <sOkam!> the way you guys explain it makes it way more difficult to understand. i understand that's how it works, but for the total scrub nub (like me) it makes it harder↵saying "just like macros, but fancier" explains a whole lot more to me. if that's correct, then i've been overthinking macros this whole time, because the emit ast way of explaining makes it sound like they do separate things↵that's actually claryfing, ty. no wonder I was f'in |
08:07:50 | FromDiscord | <sOkam!> (edit) "macros," => "templates," |
08:10:49 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRl |
08:11:57 | * | PMunch joined #nim |
08:25:41 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRm |
08:36:38 | PMunch | I have no idea what you're doing sOkam, but that just looks like all kinds of wrong |
08:43:29 | FromDiscord | <sOkam!> In reply to @PMunch "I have no idea": im trying to glob a folder for all `.c` files, and make it output each as a compile pragma, without having to manually list all of them |
08:45:19 | PMunch | So `for file in walkDirRec: result.add quote do: {.compile(`file`).}` ? |
08:45:29 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRo |
08:45:30 | PMunch | Ah crap, those backticks probably messed up the formatting |
08:46:03 | FromDiscord | <sOkam!> result add |
08:46:21 | PMunch | Yeah, in the beginning of the macro you do `result = newStmtList()` |
08:46:40 | PMunch | Then you just add the compile pragmas to that statement list |
08:47:33 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/TAE |
08:47:40 | FromDiscord | <sOkam!> but no clue how that correct or incorrect that is |
08:48:00 | FromDiscord | <Elegantbeef> 100% incorrect |
08:48:19 | PMunch | Why are you using dumpAstGen for this? |
08:48:21 | FromDiscord | <sOkam!> thanks. how fix 🙈 |
08:48:26 | PMunch | Do you know what it does? |
08:48:35 | FromDiscord | <sOkam!> because the docs say something about it and i suck, probably |
08:48:53 | PMunch | @Elegantbeef, well it's not 100%, the macro definition looks correct :P |
08:48:58 | FromDiscord | <sOkam!> macro dumpAstGen(s: untyped): untyped↵Accepts a block of nim code and prints the parsed abstract syntax tree using the astGenRepr proc. Printing is done at compile time.↵↵You can use this as a tool to write macros quicker by writing example outputs and then copying the snippets into the macro for modification. |
08:49:00 | PMunch | (Apart from weird spacing) |
08:49:06 | FromDiscord | <Elegantbeef> `prints` |
08:49:15 | FromDiscord | <Elegantbeef> There's your first sign this is wrong |
08:49:38 | FromDiscord | <sOkam!> yes, what is that supposed to mean, if its not copying whats printed and pasting it into the macro? |
08:49:39 | PMunch | sOkam, I didn't want you to copy paste the documentation for it, I'm the one who wrote it so I'm perfectly aware of what it does :P |
08:49:56 | PMunch | sOkam, it's a debugging/helper tool |
08:50:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mRp |
08:50:02 | FromDiscord | <sOkam!> yea, i was just noting what my reference was |
08:50:07 | PMunch | Similar to dumpTree |
08:50:31 | FromDiscord | <sOkam!> if i write it with a macro i write, it does nothing. it just says ident mymacroname |
08:50:46 | PMunch | It allows you to supply some sample Nim code, then get the Nim code you need to put in your macro to generate that tree |
08:51:09 | FromDiscord | <sOkam!> and how is that wrong then? |
08:51:13 | PMunch | What you're looking for is `quote` |
08:51:16 | FromDiscord | <sOkam!> what you just wrote is what i understood |
08:51:32 | PMunch | sOkam, why did you try to call it in a loop with the same statement then? |
08:51:41 | PMunch | That would just print the same tree over and over again |
08:51:55 | FromDiscord | <sOkam!> and i copied the ooutput into a macro, but you guys say its wrong because the printed output is not for use, but the docs say its printing the resulting ast for using. 🧩 |
08:52:15 | PMunch | Oh, I was looking at your first snippet |
08:52:18 | FromDiscord | <sOkam!> In reply to @PMunch "sOkam, why did you": because i want to glob the folder |
08:52:20 | PMunch | There you call it in a loop |
08:52:39 | PMunch | But you seem to have put your loop inside the dumpAstGen call as well, which is probably not what you want |
08:53:01 | PMunch | But you shouldn't need dumpAstGen for this, just use `quote` |
08:53:02 | FromDiscord | <sOkam!> i only pasted what the dumpastgen macro said |
08:53:32 | PMunch | sOkam, I was talking about this snippet: https://play.nim-lang.org/#ix=4mRm |
08:54:23 | PMunch | But yeah, write a macro with a loop that adds the result from `quote` to the result |
08:54:30 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRq |
08:54:48 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4mRq" => "https://play.nim-lang.org/#ix=4mRr" |
08:56:26 | FromDiscord | <sOkam!> In reply to @PMunch "sOkam, I was talking": i was just trying to figure out what to do with it, because all ofthis is very vague. so in that example i was trying crap until something stuck in the wall 🤷♂️ |
08:57:16 | FromDiscord | <sOkam!> In reply to @PMunch "But yeah, write a": how do you differentiate what to put in `` or what not to? |
08:57:21 | PMunch | Huh, compile seems to be broken in `quote`: https://play.nim-lang.org/#ix=4mRt |
08:57:59 | PMunch | The stuff you put in backticks is what you want to lift from the outside scope |
08:58:11 | FromDiscord | <sOkam!> lift? |
08:58:21 | PMunch | e.g. in my snippet there the x is in backticks because it comes from the x in the loop |
08:58:33 | PMunch | Otherwise it would be treated as just the identifier x |
08:58:43 | FromDiscord | <sOkam!> so its like saying that x is untyped? |
08:59:33 | FromDiscord | <sOkam!> In reply to @PMunch "Otherwise it would be": also, is this not whats wanted, if its a replacement for the thing inside the variable? |
09:01:06 | PMunch | Something like this should work: https://play.nim-lang.org/#ix=4mRw |
09:01:36 | FromDiscord | <sOkam!> how do i add the flags to that? |
09:01:42 | FromDiscord | <sOkam!> also, tysm ✍️ |
09:01:49 | FromDiscord | <sOkam!> (edit) "✍️" => "✍️🙏" |
09:02:22 | PMunch | sOkam, nah it's not like untyped. Basically quote will treat everything as code which could be added anywhere. If you want to use the actual value of a variable you need to use backticks |
09:03:05 | FromDiscord | <Elegantbeef> Genast is better than quote do in that regard, you explicitly state what's 'captured' from the macro |
09:03:29 | PMunch | For adding more arguments just add them to the nnkCall tree after the newLit part |
09:05:07 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRz |
09:05:14 | PMunch | Seems like genAst doesn't work in this case either. https://play.nim-lang.org/#ix=4mRy |
09:05:37 | PMunch | sOkam, yes \* isn't a valid character constant in Nim |
09:05:55 | FromDiscord | <Elegantbeef> `"\\.c"` |
09:06:28 | PMunch | Seems to be a bug in the documentation actually |
09:06:37 | PMunch | Because it mentions "\*.ext" |
09:06:44 | PMunch | https://nim-lang.org/docs/os.html#walkFiles.i%2Cstring |
09:07:02 | FromDiscord | <sOkam!> yeah thats where i took it from |
09:07:57 | PMunch | You probably need to escape the backslash |
09:08:02 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRA |
09:08:04 | PMunch | So `\\*.c` |
09:08:17 | FromDiscord | <Elegantbeef> Yea genast wont behave differently to quote do, but i was talking about identifiers not needing backticks |
09:08:41 | PMunch | sOkam, I'm guessing you take a `string` as an argument to your macro? |
09:08:44 | FromDiscord | <Rika> dir: static string↵Perhaps |
09:08:47 | PMunch | You need to use `static[string]` |
09:09:00 | FromDiscord | <Elegantbeef> Yea needs to be static string since you're using it as a value |
09:09:05 | PMunch | `string` as an argument to a macro just gives you a NimNode to something that will be a string during runtime |
09:09:13 | FromDiscord | <Elegantbeef> You do not want to introspect he string so you need to specify "This is a value that will be known" |
09:09:42 | FromDiscord | <Elegantbeef> Well it gives you to a Node that is typed to a string |
09:09:44 | PMunch | It's a bit confusing, but you quickly get used to it |
09:10:12 | FromDiscord | <Elegantbeef> It can be a literal, a variable, a procedure call, just anything that would `typeof(expr) is string` |
09:10:52 | FromDiscord | <Elegantbeef> But it gives you the ast of that. So for like `myProc()` you'd get a `nnkCall(myProc)` |
09:11:55 | FromDiscord | <Elegantbeef> Oh pmunch the issue with genast/quotedo is on you |
09:12:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mRB |
09:13:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mRC |
09:13:03 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/NPm |
09:13:25 | FromDiscord | <Elegantbeef> They are really not that hard, they just require you to learn the compiler internals |
09:13:28 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix= |
09:13:29 | FromDiscord | <Elegantbeef> Cause you're working with AST so of course you do |
09:13:44 | FromDiscord | <Elegantbeef> You cannot use the glob part of walkFiles at CT |
09:13:47 | FromDiscord | <Elegantbeef> This is unrelated to macros |
09:14:14 | PMunch | @Elegantbeef, wait what? |
09:14:23 | FromDiscord | <Elegantbeef> wait what what? |
09:14:28 | FromDiscord | <sOkam!> how do you glob a folder for all its files at compile time? |
09:14:40 | FromDiscord | <sOkam!> (edit) "how do you glob a folder for all its files ... at" added "matching a pattern" |
09:14:44 | FromDiscord | <Elegantbeef> Command syntax + `:` = second parameter to the command call |
09:14:56 | FromDiscord | <Elegantbeef> walkDirs + `endsWith` likely |
09:15:08 | FromDiscord | <Elegantbeef> Or walkFiles + endsWith |
09:15:33 | FromDiscord | <Elegantbeef> Not all Nim code works at CT cause of the fact it's imported C |
09:15:44 | FromDiscord | <Elegantbeef> The Nim VM does not by default have CFFI enabled |
09:15:48 | FromDiscord | <sOkam!> as an if, below it, or as part of the iterator? |
09:16:00 | FromDiscord | <Elegantbeef> Inside of the iteration |
09:16:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mRD |
09:17:05 | FromDiscord | <Elegantbeef> Don't throw all your knowledge out cause the walls changed colour |
09:17:05 | FromDiscord | <Elegantbeef> It's the same principle as any other code, it's just working on making code |
09:17:54 | FromDiscord | <Elegantbeef> Pmunch how goes explaining your wait what |
09:19:10 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4mRF if you need to check 😄 |
09:19:50 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRG |
09:19:53 | FromDiscord | <sOkam!> am i missing some module? |
09:20:42 | PMunch | @Elegantbeef, I don't get it. That AST seems fine to me |
09:20:42 | FromDiscord | <Elegantbeef> Reread my code |
09:20:42 | FromDiscord | <Elegantbeef> `walkDir` |
09:20:59 | FromDiscord | <Elegantbeef> Remove do |
09:21:07 | PMunch | Both the echo and the pragma are in the quote call |
09:21:18 | FromDiscord | <Elegantbeef> hmph you're right 😄 |
09:21:24 | FromDiscord | <sOkam!> oh, the classic syntax detail missed ⚰️ |
09:21:34 | FromDiscord | <sOkam!> ty, as usual saving my ass |
09:21:52 | PMunch | @Elegantbeef, without the `do` it messes up, as expected |
09:21:54 | FromDiscord | <Elegantbeef> The difference with `genast(x)` is that it's a proc call i imagine |
09:22:58 | FromDiscord | <sOkam!> what does result.repr do at the end of the macro? |
09:23:13 | FromDiscord | <Elegantbeef> shows the code representation of the macro |
09:23:25 | FromDiscord | <sOkam!> i thought it would echo what its doing, but its not printing anything. does it not do anything if the loop dind't find files? |
09:23:57 | FromDiscord | <Elegantbeef> Did you call the macro? |
09:24:17 | FromDiscord | <sOkam!> double negative removed:↵does it echo if the macro is empty at the end of the for loop iteration? |
09:24:54 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4mRH but yea it shows that with `.add genAst(x):` it does add it to the add stmt which is why it errors |
09:25:02 | FromDiscord | <Elegantbeef> Rightly errors but unhelpful to reason |
09:25:16 | FromDiscord | <Elegantbeef> It echos whatever is inside the result |
09:25:17 | FromDiscord | <sOkam!> yeah i called it with `test2(".")`, but there are no .c files in the dir↵so don't know if that means that the macro is empty so there is nothing to echo. i would assume it would echo even if the macro is empty |
09:25:28 | FromDiscord | <Elegantbeef> It will echo still |
09:25:31 | FromDiscord | <Elegantbeef> It should be an empty line |
09:25:59 | FromDiscord | <Elegantbeef> You can echo anything else you want to like `result.kind` |
09:26:13 | FromDiscord | <sOkam!> ah true, its there. i missed it because its right next to the `.....` |
09:27:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mRL |
09:27:25 | FromDiscord | <Elegantbeef> The `do:` part of the syntax is no longer required in 1.6+ iirc |
09:27:26 | FromDiscord | <Elegantbeef> Might've been 1.4 |
09:27:48 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRM |
09:27:56 | FromDiscord | <Elegantbeef> You didnt pass the string |
09:28:02 | FromDiscord | <Elegantbeef> You passed the path entry |
09:28:22 | FromDiscord | <Elegantbeef> Or i think it's real name is path component |
09:28:45 | FromDiscord | <sOkam!> its basically what pmuch wrote, i don't really know whats been passed to it |
09:28:52 | FromDiscord | <Elegantbeef> ... |
09:29:01 | FromDiscord | <Elegantbeef> `newLit(myPathEntry.path)` |
09:29:06 | FromDiscord | <Elegantbeef> Cmon sokam you're really trying my patience |
09:29:09 | FromDiscord | <Elegantbeef> 😄 |
09:29:15 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mRN |
09:29:24 | FromDiscord | <Elegantbeef> `newLit(x)` |
09:29:33 | FromDiscord | <Elegantbeef> You're passing a path component not a string |
09:29:48 | FromDiscord | <Elegantbeef> Like i said do not lose your knowledge cause you're doing something new |
09:29:51 | FromDiscord | <Elegantbeef> This is just Nim code |
09:30:29 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Cmon sokam you're really": dont answer, ignore me, if you are being annoyed. i didnt ask you because i know im stupid beyond stupid for this stuff, and i will struggle like a dum idiot for 3weeks and still make stupid mistakes like this. thats my artist brain being horrifically bad at programming↵so yea, just ignore me if you are annoyed by my dumb level questions |
09:31:09 | FromDiscord | <Elegantbeef> It was a joke |
09:31:25 | FromDiscord | <sOkam!> k mb |
09:31:56 | FromDiscord | <sOkam!> In reply to @Elegantbeef "You're passing a path": i didn't write that path. i don't know what to pass |
09:31:59 | FromDiscord | <Phil> Have you already arrived at the fundamental truths that every language construct in nim is just a static pattern of nodes that you can use macros to build? |
09:32:31 | FromDiscord | <sOkam!> In reply to @Isofruit "Have you already arrived": i know that from like months ago. knowing it and knowing how to -use- it... well, thats something else 😄 |
09:32:33 | FromDiscord | <Elegantbeef> Do you even know what that `nnkPragma.newTree` is generating? |
09:32:33 | FromDiscord | <Phil> That one helped me wrap my head around it a lot more |
09:32:43 | FromDiscord | <Phil> Eh, fair |
09:32:44 | FromDiscord | <Elegantbeef> Hint\: it's `{.compile: myString.}` |
09:33:07 | FromDiscord | <Elegantbeef> `newLit` takes a VM value and converts it into a compiler value |
09:33:08 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Do you even know": nope, i was trying the dumpastgen version, and pmunch helped with that, and i don't know what it does |
09:33:33 | FromDiscord | <Elegantbeef> Well time to stop putting yourself down and actually read the code to understand what we're doing |
09:33:50 | FromDiscord | <Elegantbeef> `nnkPragma` is a nim node kind this is the way Nim's ast is 'typed' |
09:34:01 | FromDiscord | <sOkam!> well i was trying, but you guys mentioned it was in all ways wrong, so i went with pmuch code instead |
09:34:12 | FromDiscord | <Elegantbeef> `newTree` makes a tree of AST with the node inside |
09:34:17 | FromDiscord | <Elegantbeef> Sure but actually try to understand what you're using |
09:34:29 | FromDiscord | <Elegantbeef> Dont grab a pipe wrench to hit a nail without understanding that it's' a screw |
09:34:58 | FromDiscord | <Elegantbeef> Ah i'm so good at making stupidly absurd analogies that help no one but my self |
09:35:05 | FromDiscord | <ringabout> I'm using the search to find latest PR regarding Nim and kill time https://media.discordapp.net/attachments/371759389889003532/1070638477395361885/image.png |
09:35:14 | FromDiscord | <Elegantbeef> Point is actually try to grok the tools you're using, dont just copy paste code cause it works |
09:35:39 | FromDiscord | <Elegantbeef> So what is your present definition of a macro? |
09:36:38 | FromDiscord | <Phil> node-pattern-generator |
09:36:41 | FromDiscord | <Elegantbeef> The simplest definition is just "user defined compiler pass" |
09:37:01 | FromDiscord | <Elegantbeef> Which is a complex way of saying "You can take in data, then emit nodes the compiler can process" |
09:37:18 | FromDiscord | <Phil> Yes, but it is expressed in dumber words that I can understand |
09:37:19 | FromDiscord | <Elegantbeef> A StmtList is as it sounds, a collection of statements |
09:37:25 | * | rockcavera joined #nim |
09:37:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mRR |
09:38:23 | FromDiscord | <Phil> TBH this is the first time I'm seeing a compile pragma |
09:38:26 | FromDiscord | <Elegantbeef> Which we look at using `dumpTree:` and see that's it's a stmtlist with a bunch of `nnkPragma(nnkCall(compile), path)` |
09:38:32 | FromDiscord | <Elegantbeef> So we know not that we need to emit this node structure |
09:38:40 | FromDiscord | <Elegantbeef> It's only really for including C, so you likely do not need to care |
09:38:52 | FromDiscord | <Elegantbeef> I'm still on the path to getting sokam to understand macros |
09:39:16 | FromDiscord | <Elegantbeef> But at this point i think sokam has died due to macros being macros |
09:39:45 | FromDiscord | <Elegantbeef> If you followed my macros tutorial the first thing you should've done was the dumptree |
09:39:51 | FromDiscord | <Phil> Actually, now that I have slept I can make an SO question about what I learned yesterday in dynamically loading C-procs |
09:40:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mRT |
09:40:19 | FromDiscord | <Elegantbeef> So now we need to make a macro that emits that |
09:40:23 | FromDiscord | <Phil> BTW can you only import C-procs using dynlib/importc pragma? Why not constants? |
09:40:33 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/Qts |
09:40:41 | FromDiscord | <Elegantbeef> Which loops us back to pmunch's code you provided |
09:40:56 | FromDiscord | <Elegantbeef> Constants need to be known at Nim compile time↵(@Phil) |
09:41:23 | FromDiscord | <Elegantbeef> I think you can import constants though, but it doesnt make much sense |
09:41:24 | FromDiscord | <Elegantbeef> Since you cannot operate on them |
09:42:15 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim#L100-L149 these bad boys exist and compile, but i've never used them so no clue 😄 |
09:42:45 | FromDiscord | <Phil> In reply to @Elegantbeef "Constants need to be": Well, they don't have to be `const` in nim, was more like, for example with openssl yesterday.↵It has `#define OPENSSL_VERSION_MAJOR x`, can that not be imported and assigned to a runtime `let` variable in global context |
09:42:47 | FromDiscord | <Phil> (edit) "context" => "context?" |
09:43:34 | FromDiscord | <Elegantbeef> You could use codedecl or emit yes |
09:44:10 | FromDiscord | <Elegantbeef> But what benefit does that have you with dynamic libraries |
09:44:16 | FromDiscord | <Elegantbeef> `define`s arent inside the dynamic library |
09:47:38 | FromDiscord | <ringabout> How other script languages implement callback like native interface? Does them use hash tables to dispatch calls? |
09:47:59 | * | ltriant joined #nim |
09:49:51 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4mRW |
09:52:07 | FromDiscord | <Elegantbeef> I assume phil wanted it to work with dynlib, which like I said simply does not work |
09:53:29 | FromDiscord | <Elegantbeef> Not to say you're wrong, just to crush phil's enthusiasm |
09:53:33 | FromDiscord | <pyolyokh> well even without runtime selection of the library like nim does normally, even with traditional dynamic linking, that's not to work unless the header is correct for the library you actually use. |
09:54:48 | FromDiscord | <pyolyokh> sorry this is a drive-by. I'm just making the narrow point that you can `#include` a header and use its constants if you want, but you can't elevate them to Nim constants without actually telling the Nim compiler what the constants are. |
09:55:11 | FromDiscord | <ringabout> If JS backend switches to es6 class, doesn't that mean the Nim compiler doesn't need to generate type information for classes since there shall be no need? |
10:28:17 | FromDiscord | <Phil> In reply to @Elegantbeef "Not to say you're": Awww |
10:28:53 | FromDiscord | <Phil> Anyway, I wrote my learning down in an SO question. I'd say "Self answered SO Question incoming" but the nimeventer bot has been broken for months now |
10:29:20 | PMunch | Oh yeah, where did that thing go? |
10:29:56 | FromDiscord | <Phil> I assume whoever originally was responsible for that bot vanished, then nobody felt responsible, it broke eventually and since then nobody looked at it? |
10:30:23 | PMunch | It looks like it was Yardanico's work, I thought they where still around? |
10:40:04 | FromDiscord | <Phil> Anyway, https://stackoverflow.com/questions/75321763/how-do-you-import-different-proc-from-openssl-depending-on-the-openssl-version-i/75321764#75321764 in case beef wants to look at it and point out anything super egregiously wrong 😛 |
10:58:42 | FromDiscord | <turbo> what's an elegant way to deduplicate a seq of objects by a specific field? |
11:00:15 | FromDiscord | <Phil> `std/sequtils.filterIt` ? |
11:01:11 | FromDiscord | <Phil> Actually, that might become problematic |
11:01:12 | FromDiscord | <Phil> hmm |
11:01:38 | FromDiscord | <Phil> I have no way that performance-wise makes sense |
11:05:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mSa |
11:05:15 | FromDiscord | <turbo> sent a code paste, see https://paste.rs/iX5 |
11:07:22 | FromDiscord | <Phil> So you have 2 separate sequences and want to make sure that no element from seq1 gets added to seq2 where that field is already present? |
11:07:55 | FromDiscord | <turbo> yep |
11:08:10 | FromDiscord | <Phil> I'd turn seen into a set with (toSet) |
11:08:15 | FromDiscord | <Phil> (edit) "(toSet)" => "toSet()" |
11:08:26 | FromDiscord | <Phil> After you generate it of course, so extra-step |
11:08:40 | PMunch | Yeah turn it into a hash-set but provide your own hash implementation which only considers that one field |
11:08:42 | FromDiscord | <Phil> Mostly because sets are much faster and checking if a given value is within the set |
11:09:11 | FromDiscord | <Phil> Or you do what PMunch suggested, I think then you can skip the `map` step |
11:16:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mSb |
11:17:43 | FromDiscord | <Phil> So performance doesn't strictly speaking matter all that much, the main reason I always prefer sets when it comes to "check if x is in y" is because sets are explicitly for that purpose, so you communicate the purpose of that code better by using sets since you're sending the message "I'll use that to check if x is contained in y" |
11:21:53 | PMunch | @Phil, I get a much worse performance diff than you do @Phil |
11:22:05 | PMunch | 0.005 vs 0.032 in debug mode |
11:22:18 | PMunch | The set version registers as 0.000 in release mode |
11:22:35 | FromDiscord | <Phil> Huh, yeah I was only in debug mode for that, fair point |
11:23:08 | FromDiscord | <Phil> Yeah, set is infinity percent faster xD |
11:23:44 | FromDiscord | <Phil> At this point I'm running out of RAM to test this though xD |
11:23:51 | PMunch | I added a zero to both numbers (1000 samples in a 100_000_000 units). In release mode the set takes 0.003ms while the seq takes 175.828ms |
11:23:57 | PMunch | So yeah, pretty big difference |
11:24:00 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mSc |
11:24:36 | FromDiscord | <Phil> That's overall true, but we should keep in mind that we had a sequence here with `100_000_000` entries, it's rare-ish to get anything in that size |
11:25:55 | FromDiscord | <Phil> The fact that for 100_000_000 entries it's still at average time 0 is insane though |
11:26:03 | FromDiscord | <Phil> Like, wtf |
11:26:53 | PMunch | I went down in size, but up in samples: http://ix.io/4mSf |
11:27:00 | PMunch | Still a big diff with only a million entries |
11:27:20 | PMunch | Of course ints are packed quite tightly, larger objects would be more punishing on the cache |
11:29:32 | * | advesperacit joined #nim |
11:30:43 | PMunch | Tested with an object with a 100 byte dummy field, 0.038 for a set, 13.740 for a seq |
11:30:53 | PMunch | Although that compared the entire object for the seq version |
11:35:12 | FromDiscord | <Piqueiras> why cant it evaluate i at compile time? https://media.discordapp.net/attachments/371759389889003532/1070668708843896912/image.png |
11:36:34 | PMunch | @Phil, @turbo, a slightly more realistic comparison: http://ix.io/4mSi/ |
11:36:54 | PMunch | Ugh, strip the last `/` of that link |
11:42:36 | FromDiscord | <pyolyokh> In reply to @Piqueiras "why cant it evaluate": Nim's occasionally pretty good about stuff like this. It probably just isn't, here, because of insufficient love for tuples. Or in other words, if you make an issue the work might get done. |
11:42:41 | FromDiscord | <Phil> In reply to @Piqueiras "why cant it evaluate": Huh, curious. This seems to be more an issue with accessing a tuple via index than anything else, because I can be evaluated at compiletime.↵An alternative you could do is use a macro that "unrolls" that for-loop to make it simple, or you just write the assignment out |
11:42:57 | FromDiscord | <Phil> (edit) "I" => "`i`" |
11:43:04 | FromDiscord | <Piqueiras> i swear i am so confused lmao |
11:43:34 | FromDiscord | <Piqueiras> https://media.discordapp.net/attachments/371759389889003532/1070670810643177502/image.png |
11:43:39 | FromDiscord | <Piqueiras> i had to legit do this |
11:45:37 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mSk |
11:45:56 | FromDiscord | <Phil> That's with Vector as an object instead of a tuple though |
11:47:10 | FromDiscord | <Phil> The `getField` macro I use is one of those things that imo should've been available in the first place, I use it all the damn time for stuff like this |
11:48:53 | FromDiscord | <Piqueiras> yea I didnt make an object cause it seemed kinda weird |
11:48:59 | FromDiscord | <Piqueiras> even tried array before and didnt allow me |
11:49:57 | FromDiscord | <Phil> The benefit of objects is that they have the necessary utility things to iterate over them |
11:51:13 | FromDiscord | <Phil> Tuples have more of a role as a "utility" data structure of sorts, used here and there when you e.g. need to return 2 things at once and the caller is supposed to know that and unpack it, rather than containing serious data |
11:52:49 | FromDiscord | <pyolyokh> fieldPairs works on tuples though. |
11:52:55 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4mSn |
11:53:12 | FromDiscord | <Phil> It does? TIL |
11:53:48 | FromDiscord | <Phil> In that case, there you go @Piqueiras |
11:54:17 | FromDiscord | <Piqueiras> hmm let me see |
11:54:59 | FromDiscord | <Piqueiras> yea its cool |
11:55:04 | FromDiscord | <Phil> Just for clarity in case you're wondering what that macro is all about:↵It essentially turns `v1.getField(field)` with field containing the static string `"x"` into `v1.x`. |
11:55:24 | FromDiscord | <planetis> tuples are only useful when returning multiple things from procs, otherwise just use an object |
11:55:36 | FromDiscord | <pyolyokh> they're also useful if you want to say `(1, 2, 3)` |
11:55:42 | FromDiscord | <Piqueiras> I mean I never used a macro even after a while of using C so lol |
11:55:47 | FromDiscord | <Piqueiras> ty |
11:56:04 | FromDiscord | <planetis> In reply to @pyolyokh "they're also useful if": yeah but that opens a can of worms with type safety |
11:56:07 | FromDiscord | <Phil> `v1.x` is called a dot-expression and `ident(fieldName)` with fieldName containing `"x"` is what turns "x" into the "field" x |
11:56:43 | FromDiscord | <arne> sent a code paste, see https://play.nim-lang.org/#ix=4mSo |
11:57:10 | FromDiscord | <Phil> Yeah that's the third thing that imo should've been in the std lib from the start:↵A macro for unrolling static for-loops |
11:57:11 | FromDiscord | <Piqueiras> sent a code paste, see https://play.nim-lang.org/#ix=4mSp |
11:57:26 | FromDiscord | <pyolyokh> In reply to @Piqueiras "is there a way": no. use an array. You said arrays didn't work for you, but arrays definitely work. |
11:57:45 | FromDiscord | <Piqueiras> i mean so that i can make Vector[4] and its 4 dimensional now |
11:57:47 | FromDiscord | <Piqueiras> or sth |
11:57:55 | FromDiscord | <pyolyokh> although array types also have static lengths, so you probably want seq |
11:58:06 | FromDiscord | <arne> @Piqueiras look at nim-glm |
11:58:17 | FromDiscord | <pyolyokh> or if you're comfortable with a bunch of generics over the length, arrays still work |
11:58:28 | FromDiscord | <planetis> Even more macros that do the same thing exist https://github.com/status-im/nim-drchaos/blob/master/drchaos/common.nim#L8-L73 and usage https://github.com/status-im/nim-drchaos/blob/master/drchaos/common.nim#L395 |
11:58:30 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4mSq |
11:58:56 | FromDiscord | <arne> https://github.com/stavenko/nim-glm/blob/master/glm/vec.nim#L19-L27 |
11:59:24 | FromDiscord | <Piqueiras> In reply to @pyolyokh "although array types also": like they would not vary during execution |
11:59:41 | FromDiscord | <Piqueiras> i can do Vector[2] or Vector[3] but wouldnt be able to sum them, for example |
12:00:15 | FromDiscord | <arne> @Piqueiras take a look at that link |
12:00:21 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4mSs |
12:01:03 | FromDiscord | <Piqueiras> ty |
12:02:53 | FromDiscord | <Piqueiras> why didnt it work before 🫠 |
12:03:00 | FromDiscord | <arne> sent a long message, see http://ix.io/4mSt |
12:03:51 | FromDiscord | <Piqueiras> sent a code paste, see https://play.nim-lang.org/#ix=4mSu |
12:04:08 | FromDiscord | <Piqueiras> is there a reason for choosing arrays, tuples, objects etc? |
12:04:14 | FromDiscord | <arne> why don't you just use nim-glm? |
12:04:15 | FromDiscord | <pyolyokh> we never saw the array attempt, so it might've been something unrelated, that you thought meant arrays didn't work. |
12:04:30 | FromDiscord | <arne> or do you want to learn writing all this stuff? |
12:04:35 | FromDiscord | <crow> In reply to @Piqueiras "i can do Vector[2]": how do you define a sum of Vector[2] and Vector[3] anyways |
12:04:56 | FromDiscord | <crow> you could maybe make sum take two generic params and define it that way |
12:05:18 | FromDiscord | <Piqueiras> In reply to @arne "or do you want": mostly I guess lol |
12:05:32 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4mSw |
12:05:46 | FromDiscord | <arne> I've spent a lot of time to make nim-glm a perfect implementation of glsl in Nim |
12:05:56 | FromDiscord | <pyolyokh> In reply to @Piqueiras "mostly I guess lol": well ftr the nim-glm stuff looks like what you would end up with if you tried to do this seriously |
12:05:58 | FromDiscord | <arne> to the point to compile Nim to glsl. |
12:06:21 | PMunch | Hmm, has anyone else been met by "overwrite" warnings in nimble lately? |
12:06:37 | FromDiscord | <pyolyokh> and the swizzle ops especially are probably worth it |
12:07:24 | FromDiscord | <crow> sent a code paste, see https://paste.rs/phH |
12:07:48 | FromDiscord | <crow> (edit) "https://play.nim-lang.org/#ix=4mSy" => "https://play.nim-lang.org/#ix=4mSx" |
12:07:55 | FromDiscord | <crow> so if you define `+`[N, M] you can return Vector[N] or Vector[M] depending on which one is smaller |
12:08:12 | FromDiscord | <crow> I guess you'd need macros for this kind of thing...? |
12:08:42 | FromDiscord | <arne> not really |
12:08:48 | FromDiscord | <arne> you need a `when` statement |
12:08:49 | FromDiscord | <Phil> Not at runtime, you'd need to use when |
12:08:56 | FromDiscord | <Phil> Dang, too slow |
12:09:11 | FromDiscord | <crow> hmm, but can you have different return types based on a when statement? |
12:09:13 | FromDiscord | <arne> and you must use `auto` as the return type |
12:09:33 | FromDiscord | <crow> and will the when statement evaluate separately on every generic call with new type combos are added? |
12:09:35 | FromDiscord | <crow> ah okay okay |
12:09:36 | FromDiscord | <crow> nice |
12:09:45 | FromDiscord | <Phil> In reply to @crow "hmm, but can you": That's a generic, you don't really have different return types. You just copy-paste the proc multiple times and one time you copy paste it so it returns one with N = 3 and one with N = 4 |
12:09:53 | FromDiscord | <arne> and I think you can't use `return` but I am not sure right now, it might actually work. |
12:09:58 | FromDiscord | <Phil> (edit) "just" => "(as in, the compiler)just" |
12:10:02 | FromDiscord | <Phil> (edit) "compiler)just" => "compiler) just" |
12:11:18 | FromDiscord | <Phil> Actually, that would still mess up then because your N is not controlling the output |
12:11:39 | FromDiscord | <Phil> So if you call it with foo[3] and your compiletimeFunction dishes out a value < 0.5 you'll sometimes get a compiler error |
12:11:50 | FromDiscord | <crow> sent a code paste, see https://play.nim-lang.org/#ix=4mSz |
12:12:11 | FromDiscord | <crow> i guess this would still not be able to imply the length of result |
12:12:41 | FromDiscord | <crow> (edit) "https://play.nim-lang.org/#ix=4mSz" => "https://play.nim-lang.org/#ix=4mSA" |
12:13:15 | FromDiscord | <planetis> @arne you seem to know a lot about nim-glm is it your project? |
12:13:24 | FromDiscord | <arne> yes |
12:13:38 | FromDiscord | <arne> I am that krux02 on github |
12:14:32 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4mSC |
12:14:46 | FromDiscord | <crow> thanks |
12:14:46 | FromDiscord | <arne> originally that project was created by stavenco, but I rewrote everything, it is just the name that stayed |
12:15:05 | FromDiscord | <planetis> wow long time no see! how is it going? |
12:15:45 | FromDiscord | <arne> (edit) "stavenco," => "stavenko," |
12:16:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4mSD |
12:16:34 | FromDiscord | <pyolyokh> I just saw `compileTimeRandom()` and thought, "hey that doesn't work, too bad" |
12:16:43 | FromDiscord | <arne> yea, I am doing things here and there, I am trying to port my Nim to Glsl project to Jai, but I don't really have the energy left that I had when I did all of this in Nim. |
12:17:22 | FromDiscord | <crow> In reply to @pyolyokh "I just saw `compileTimeRandom()`": i made it up yeah |
12:17:33 | FromDiscord | <crow> i was trying to create an example code |
12:17:35 | FromDiscord | <planetis> are you still using nim or just passing by? |
12:17:44 | FromDiscord | <arne> I am just passing by |
12:18:08 | FromDiscord | <arne> but I still have all my knowledge about Nim living in my head rent free |
12:19:06 | FromDiscord | <arne> this nim-glm thing really isn't in the spotlight enogh. I've seen constantly that people tried to do things nim-glm style. |
12:20:01 | FromDiscord | <arne> I've spent so much time working on it and with it, that it could easily become standard library. But instead we still have people reimplementing it. |
12:21:10 | FromDiscord | <arne> It might also be that people just hate the idea to write vector math in the style of glsl |
12:21:23 | FromDiscord | <arne> but don't think that's true |
12:22:26 | FromDiscord | <arne> with "constantly" I mean, it happened really a lot that people asked questions about implementing vector math in Nim |
12:23:01 | FromDiscord | <arne> but I am not active anymore, so my sample rate is a bit lowerd |
12:26:37 | * | jmdaemon quit (Ping timeout: 252 seconds) |
12:35:17 | * | ltriant quit (Ping timeout: 246 seconds) |
12:39:25 | FromDiscord | <planetis> I don't think you can ever reach consensus between individuals unless they pay you to put up with each other |
12:39:47 | FromDiscord | <planetis> Just look up how many raylib bindings exist |
12:41:24 | FromDiscord | <Piqueiras> I dont have to use N on the second right?↵Or is it necessary so theyre same size https://media.discordapp.net/attachments/371759389889003532/1070685367830855740/image.png |
12:44:08 | FromDiscord | <planetis> They are the same size since the bind to the same generic vector |
12:44:26 | FromDiscord | <planetis> If you don't want that split the arguments |
12:47:20 | FromDiscord | <Phil> Here I go, get curious whether there is a nib lib for caching returns of a proc, find something called "Kashae" that looks pretty nice, good readme, nice API.↵"How is the author" I think.↵Beef↵Of course it's beef |
12:47:29 | FromDiscord | <Phil> (edit) "nib" => "nice" |
12:47:40 | FromDiscord | <Phil> (edit) "API.↵"How" => "API.↵"Who" |
12:47:45 | FromDiscord | <arne> don't do equality checks on floating point numbers |
12:48:13 | FromDiscord | <arne> they are not precise, equality works in special cases, but it is not the norm |
12:48:28 | FromDiscord | <Piqueiras> In reply to @arne "don't do equality checks": yea I supposed it could lead to errors |
12:49:18 | FromDiscord | <planetis> Dumb question but those of you who work a lot with computer graphics, how often do you need == for matrices? |
12:49:22 | FromDiscord | <arne> `abs(dot(v1,v2)) < ε` |
12:49:57 | FromDiscord | <arne> the thing is `==` on matrices doesn't work, therefore you can't need it. |
12:50:06 | FromDiscord | <planetis> In reply to @arne "`abs(dot(v1,v2)) < ε`": And you would call that == or something else like =~ |
12:50:31 | FromDiscord | <Phil> I think `=~` is a fair shout |
12:50:32 | FromDiscord | <planetis> In reply to @arne "the thing is `==`": Yeah sorry lost in translation I meant vectors |
12:50:51 | FromDiscord | <arne> an operator is bad, because that ε highly depends on the task you are doing and operators only take two arguments |
12:51:02 | FromDiscord | <planetis> There is no word for it in my mother tongue I think |
12:51:03 | FromDiscord | <arne> it is the same with vectors |
12:51:15 | FromDiscord | <Phil> Fair shout, so more a `nearEqual` proc |
12:51:35 | FromDiscord | <arne> length2(v1 - v2) < ε |
12:51:59 | FromDiscord | <arne> I usally just write it out |
12:52:43 | FromDiscord | <arne> the thing is, if you want your ε to be precise, you would need to compute the length of the vector, wich involves a `sqrt` (expensive) |
12:53:17 | FromDiscord | <arne> therefore I prefor to just write `length2` so that it is obvious that I am in squared length domain |
12:54:13 | FromDiscord | <planetis> Good to know, and what about integer vectors are these useful for anything? |
12:54:23 | FromDiscord | <arne> barely |
12:54:37 | FromDiscord | <arne> but they exist |
12:55:18 | FromDiscord | <arne> integres encoded as float64 or float32 are precise btw |
12:55:38 | FromDiscord | <arne> they can be compared with `==` that is one of those special cases I talked about |
12:57:41 | FromDiscord | <planetis> Thanks for the answers Arne |
12:57:56 | FromDiscord | <Piqueiras> uhmm https://media.discordapp.net/attachments/371759389889003532/1070689528546869258/image.png |
12:58:11 | FromDiscord | <Piqueiras> cannot instantiate: 'N' |
13:00:57 | FromDiscord | <sOkam!> is there a way to get the path of the current file at compile time from inside the code of that file?↵something like the python version of `file` |
13:07:07 | FromDiscord | <arne> In reply to @Piqueiras "uhmm": it can't infer `N` |
13:07:23 | FromDiscord | <arne> toVector[3](1,2,3) should work |
13:07:37 | PMunch | Seriously, every time I run `nimble test` it downloads and installs the requirements over again |
13:07:52 | PMunch | Asking me if I want to override the old package since it's the same as the one I have installed |
13:08:01 | PMunch | This didn't use to be the case, did it? |
13:08:35 | FromDiscord | <sOkam!> @ElegantBeef @PMunch do you guys know where the path of `{.compile: "somefile.c".}` files starts searching from? |
13:08:52 | PMunch | Hmm, not really |
13:09:46 | FromDiscord | <jmgomez> In reply to @sOkam! "<@145405730571288577> <@392962235737047041> do you": IIRC the C compiler search path |
13:09:52 | FromDiscord | <Ntsékees> Is it possible to mark a function as executable at compile-time (provided it receive compile-time arguments)? |
13:10:14 | PMunch | {.compileTime.} |
13:10:32 | FromDiscord | <Ntsékees> Cool, thanks. |
13:10:38 | FromDiscord | <jmgomez> In reply to @Ntsékees "Is it possible to": you dont really need to mark it though |
13:10:54 | PMunch | Oh yeah, that's more to hide it from the runtime |
13:11:12 | FromDiscord | <sOkam!> In reply to @jmgomez "IIRC the C compiler": which one is that? whatever is configured in nimble as `srcDir`, or something else? |
13:12:18 | FromDiscord | <Ntsékees> > `{.compile: "somefile.c".}`↵Maybe if you put the name of a file that doesn't exist, the search path will be shown in an error message? |
13:12:39 | FromDiscord | <jmgomez> should be ``--cincludes`` (https://nim-lang.org/docs/nimc.html) I usually just do `:t` or `passC` to pass argument to the actual compiler |
13:12:51 | FromDiscord | <jmgomez> (edit) "`:t`" => "`-t`" |
13:13:11 | FromDiscord | <sOkam!> handy, ty ✍️ |
13:19:15 | FromDiscord | <sOkam!> i think i spoke too soon, its not finding any of them 🤔 |
13:19:33 | FromDiscord | <arne> In reply to @PMunch "Oh yeah, that's more": unless `{.compileTime.}` is used on variables. Then it makes it compile time only but also available at runtime 😉 |
13:19:36 | FromDiscord | <sOkam!> where does the --cincludes go? |
13:19:50 | FromDiscord | <planetis> In reply to @sOkam! "i think i spoke": use the full path to compile |
13:19:57 | FromDiscord | <planetis> that's what I do at least |
13:20:19 | FromDiscord | <sOkam!> In reply to @planetis "use the full path": how do i get the full path of a file at compile time? |
13:20:29 | FromDiscord | <planetis> currentSourcePath().parentDir |
13:21:47 | * | ltriant joined #nim |
13:22:07 | FromDiscord | <arne> @planetis here is an example https://github.com/krux02/nimAntTweakBar/blob/master/AntTweakBar.nim |
13:23:19 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/esz |
13:26:55 | * | ltriant quit (Ping timeout: 260 seconds) |
13:29:42 | FromDiscord | <sOkam!> @planetis tysm, that was really helpful. exactly what i was looking for 🙏 |
13:31:16 | FromDiscord | <planetis> you are welcome, I am glad it worked |
13:51:38 | * | azimut quit (Ping timeout: 255 seconds) |
13:52:47 | * | azimut joined #nim |
13:57:17 | * | ltriant joined #nim |
14:03:12 | * | ltriant quit (Ping timeout: 264 seconds) |
14:05:45 | arkanoid | why I have .nimble/pkgs and .nimble/pkgs2 ? |
14:07:05 | FromDiscord | <ringabout> nimble 14.0 install packages to `.nimble/pkgs2` |
14:07:10 | FromDiscord | <ringabout> (edit) "install" => "installs" |
14:08:28 | arkanoid | mmm why |
14:08:33 | arkanoid | btw, got it |
14:08:36 | FromDiscord | <ringabout> You might remove `.nimble/pkgs`, which might cause some problems. |
14:09:57 | FromDiscord | <ringabout> The new nimble use different paths in order to support lock files, which requires different paths that conflicts with the previous paths. |
14:10:08 | arkanoid | makes sense |
14:10:47 | arkanoid | I just have a split horizon now, some projects wants to be on devel, some on stable, but they share libs |
14:11:36 | arkanoid | PMunch: I'm dealing with the issue I've opened on Futhark. It drills down to local version not updating as expected |
14:12:19 | FromDiscord | <ringabout> Yeah, there is also a bug I believe that new nimble cannot remove old installed packages in `.nimble/pkgs`. |
14:13:04 | PMunch | Oh wait, is this what's causing all my packages to update all the time as well? |
14:13:18 | arkanoid | basically if I have a -#head version of futhark installed, and I re-do nimble install futhark, nimble install downloads latest tagged version (0.7.4), but nimble build still uses futhark-#head, which is behing 0.7.4 |
14:13:27 | PMunch | Hmm, I don't have pkgs2 though.. |
14:14:55 | arkanoid | so I end up with different versions of same package installed, withing multiple pkgs[2] root, and build sistem doesn't pick the latest installed if -#head is present, which may be older that lastest installed |
14:15:23 | arkanoid | all-in-all, it makes sense, but you must be extra careful |
14:15:30 | arkanoid | or just pin version in requirements |
14:23:51 | arkanoid | talking about futhark, not it's not just about it, I found my vscode editor not picking up correctly .nim files in .cache folder, so I end up having a nim program that compiles and run, but vscode check that doesn't find all the definitions found in .cache |
14:24:34 | PMunch | Yeah.. |
14:24:56 | PMunch | I think nimsuggest stores files in a different temp directory or something, which messes with Futhark |
14:25:02 | PMunch | At least I think that's what's going on |
14:28:11 | arkanoid | this is another reason why I give up using the suggested futhark path, and copy back the generted nim file into src folder |
14:28:27 | arkanoid | futhark is ahead nim tooling |
14:28:32 | arkanoid | :P |
14:30:36 | PMunch | Hold that thought |
14:32:06 | arkanoid | btw, I'm trying to grasp the part of opir code that deals with C macros |
14:32:58 | PMunch | Good luck :P |
14:33:02 | PMunch | That part is a bit of a mess |
14:33:32 | arkanoid | just like all my code! |
14:33:42 | PMunch | It's the only part which isn't just a conversion to JSON but rather actually parsing C code |
14:36:27 | arkanoid | is there a way to run opir/futhark ignoring the cache and forcing re-parsing even if the C code in unchanged? |
14:36:34 | arkanoid | I can delete whole project cache, sure |
14:40:59 | arkanoid | nevermind, I've found opirRebuild |
15:09:19 | FromDiscord | <Require Support> `VARIANT args = new VARIANT[2];` what would this be in nim? |
15:11:08 | FromDiscord | <jtv> That's a bit vague. Do you want an array of two references to a data object, where the data objects are references to something on the heap? Or do you need it to be a union type per the word VARIANT? |
15:11:38 | PMunch | arkanoid, https://github.com/PMunch/futhark#shipping-wrappers |
15:12:05 | PMunch | That might be of interest to you :) |
15:12:20 | FromDiscord | <Require Support> honestly I have no idea, its cpp and have no idea what it is doing but I think its an array of two references |
15:12:22 | PMunch | I added a `outputPath` argument to ease with shipping Futharkd libraries :) |
15:12:56 | FromDiscord | <Require Support> (edit) "honestly I have no idea, its cpp and have no idea what it is doing but I think its an array of two references ... " added "@jtv" |
15:13:07 | PMunch | @Require_Support, wouldn't that just be `args: array[2, VARIANT]` in Nim? |
15:13:13 | PMunch | Wouldn't be on the heap though.. |
15:13:15 | arkanoid | that `when` block is very similar to what I am using now to go back and forth futhark/static nim |
15:13:26 | FromDiscord | <Require Support> In reply to @PMunch "@Require_Support, wouldn't that just": I'll test |
15:13:40 | arkanoid | but now futharkFile makes it easy! |
15:13:52 | arkanoid | I mean outputPath :P |
15:14:06 | PMunch | arkanoid, yeah I've held out on writing that section until I saw how people dealt with this situation, myself included :) |
15:14:31 | arkanoid | I am trying to figure how I should build the json seaction when "def = (long)0x00000000" |
15:15:01 | arkanoid | what would be the resulting `"type": {"kind": "alias", "value": def}` ? |
15:17:30 | PMunch | Well it should be {"kind": "base", "value": "clong"} |
15:18:27 | PMunch | Essentially you need to modify this to take a set of booleans for each of the internal checks: https://github.com/PMunch/futhark/blob/master/src/opir.nim#L329 |
15:18:34 | arkanoid | but `template parseReturn` is not returning ctypes |
15:18:53 | PMunch | Then parse and strip the casts off of def from there while obtaining the booleans |
15:19:04 | PMunch | arkanoid, yes it is |
15:19:10 | PMunch | Look carefully at this line: https://github.com/PMunch/futhark/blob/master/src/opir.nim#L349 |
15:19:20 | PMunch | It appends "c" to the values |
15:19:27 | arkanoid | oooh, right, I'm dumb |
15:19:30 | arkanoid | correct |
15:20:01 | PMunch | But I've gotta run |
15:20:02 | * | PMunch quit (Quit: Leaving) |
15:44:04 | * | LuxuryMode joined #nim |
15:50:34 | * | arkurious joined #nim |
15:56:56 | FromDiscord | <arne> PMunch: you do know about https://futhark-lang.org/ do you? |
16:00:19 | * | ltriant joined #nim |
16:05:20 | * | ltriant quit (Ping timeout: 248 seconds) |
16:17:28 | FromDiscord | <ShalokShalom> he made it |
16:17:38 | arkanoid | I need an hand to understand a piece of code |
16:18:13 | arkanoid | where is HexInt/BinInt/OctInt defined here? https://github.com/PMunch/futhark/blob/d63b1269b15373656e1e85c791f6e5d6165f0c0e/src/opir.nim#L352 |
16:18:49 | arkanoid | I've tried searching it in whole github, but it's not there https://github.com/search?q=HexInt+language%3ANim&type=Code&ref=advsearch&l=Nim&l= |
16:19:18 | arkanoid | it is used in line "value = `parse x`(def[0..pos])" where x is untyped |
16:20:29 | arkanoid | should I expect it to become "parse HexInt(def[0..pos])" ? Where is it defined? |
16:21:41 | FromDiscord | <leorize> it's not a defined variable, it's a part of a name template |
16:21:43 | FromDiscord | <leorize> https://github.com/PMunch/futhark/blob/d63b1269b15373656e1e85c791f6e5d6165f0c0e/src/opir.nim#L339 |
16:22:15 | arkanoid | exactly, but then what does it mean "parse HexInt(def[0..pos])" ? |
16:22:19 | FromDiscord | <leorize> HexInt is simply transformed into `parseHexInt` which is in `std/parseutils` |
16:22:28 | FromDiscord | <Phil> @Yardanico if I were interested in getting Nimeventer to run again, what could I do? |
16:22:56 | arkanoid | leorize, where is the space between parse and x going? |
16:23:00 | FromDiscord | <leorize> you gotta read this template code\: https://github.com/PMunch/futhark/blob/d63b1269b15373656e1e85c791f6e5d6165f0c0e/src/opir.nim#L322-L346 |
16:23:11 | FromDiscord | <leorize> the space is removed |
16:23:16 | arkanoid | this is new to me |
16:23:17 | FromDiscord | <leorize> this is an identifier construction construct |
16:23:45 | FromDiscord | <leorize> see https://nim-lang.org/docs/manual.html#templates-identifier-construction |
16:24:16 | arkanoid | thanks! learnt something new |
16:25:12 | * | kenran quit (Remote host closed the connection) |
16:28:41 | FromDiscord | <Coachonko> Are there other languages that use arbitrary array indexes like nim? |
16:28:57 | FromDiscord | <leorize> pascal |
16:29:16 | arkanoid | best ide ever |
16:29:27 | FromDiscord | <Coachonko> Interesting |
16:30:05 | arkanoid | my eye sensitivity to blue color has been tamperer by turbo pascal ide |
16:30:22 | Zevv | are you that old |
16:30:29 | FromDiscord | <Coachonko> I come from c++ and js, what is the use case of setting custom array indexes? Like is there a legitimate one? |
16:30:30 | FromDiscord | <leorize> truth to be told if the language has operator overloading you can always make arbitrary indices happen \:p |
16:31:04 | FromDiscord | <leorize> mostly used for enum indexing, since nim's enum are strongly typed and not a bunch of ints |
16:31:54 | * | ltriant joined #nim |
16:34:28 | FromDiscord | <Coachonko> Thanks for the information |
16:37:13 | * | ltriant quit (Ping timeout: 268 seconds) |
16:46:35 | FromDiscord | <sOkam!> can someone explain this wizardry?↵C code, compiled with gcc: 400kb↵C code, compiled with nimc, called from Nim: 100kb 👀 ↵same exact code? how is that poss? |
16:52:20 | FromDiscord | <Array in ∀ Matrix> it probably isnt the exact code as the nim compiler practices magic. compare the c source code it made to the c code u wrote |
16:53:14 | * | jmdaemon joined #nim |
16:53:25 | FromDiscord | <Array in ∀ Matrix> the c code the nim compiler made is i think in `.cache/nim` |
17:03:29 | * | ltriant joined #nim |
17:08:13 | * | ltriant quit (Ping timeout: 252 seconds) |
17:24:17 | * | ltriant joined #nim |
17:28:40 | * | ltriant quit (Ping timeout: 260 seconds) |
17:40:59 | ixmpp | also you could probably get enough variation for that based on gcc compiler flags alone |
17:41:30 | ixmpp | -O3 vs -O0, -funroll-loops, -gdwarf-4, etc |
17:55:05 | * | azimut quit (Ping timeout: 255 seconds) |
18:19:20 | * | PMunch joined #nim |
18:33:24 | * | ltriant joined #nim |
18:38:25 | * | ltriant quit (Ping timeout: 252 seconds) |
19:33:01 | PMunch | Just got back on and read the IRC log, seems I have some questions |
19:33:22 | PMunch | @arne, yes I know about Futhark lang, but I didn't at the time I named Futhark |
19:33:39 | PMunch | I even googled around to see if I had any meaningful name conflicts.. |
19:34:25 | PMunch | arkanoid, HexInt and those are just combined with the word parse here: https://github.com/PMunch/futhark/blob/d63b1269b15373656e1e85c791f6e5d6165f0c0e/src/opir.nim#L339 |
19:34:41 | PMunch | So they call parseHexInt, parseBinInt, etc. from strutils I believe |
19:36:50 | PMunch | Ah I see leorize already answered that one |
19:38:42 | * | peterhil quit (Remote host closed the connection) |
19:39:13 | * | peterhil joined #nim |
19:47:04 | arkanoid | PMunch: yeah I already got explanation from leorize. Basically I didn't know about template identifier contruction |
19:47:26 | PMunch | It's not a very commonly used feature |
19:48:25 | arkanoid | PMunch: it's quite an hard choice how to deal with casts in C defines. The cast could be anything, and here without clang assistance there's zero chance to do a good job. |
19:48:40 | arkanoid | the only idea I have is to turn casts into literal suffixes |
19:48:53 | arkanoid | (long)42 > 42L |
19:49:21 | arkanoid | it's wrong, for many reasons, but maybe better than nothing? |
19:50:15 | PMunch | Oh yeah, I didn't even consider casting from incompatible types.. |
19:50:21 | PMunch | But probably that's "good enough" |
19:50:44 | PMunch | An alternative is to do it the way I said, but the result would be the same |
19:52:07 | * | peterhil quit (Ping timeout: 252 seconds) |
19:52:23 | arkanoid | the way you said? |
19:52:48 | arkanoid | you mean reading back to front with the template? |
19:53:13 | arkanoid | I already have in place a small algorithm to rewrite casts as literals |
19:53:19 | * | peterhil joined #nim |
19:53:43 | arkanoid | this runs before that template, than the logic is the same |
19:54:13 | arkanoid | question is how many string types should I support. |
19:55:41 | * | peterhil quit (Max SendQ exceeded) |
19:56:27 | PMunch | https://irclogs.nim-lang.org/02-02-2023.html#15:18:27 |
19:56:38 | PMunch | And my next message |
19:58:04 | PMunch | Since parseReturn is ever only called once you should actually be able to get away with moving the four booleans out of the template and pre-populate them based of the cast type |
19:58:57 | PMunch | So essentially move lines 333-336 up above the template, then check if def starts with `(long)` for example and set the `long` field accordingly |
19:59:10 | PMunch | All the while removing it from `def` |
20:00:15 | PMunch | So only support "unsigned", "long", "long long", and "size" (and of course variations like unsigned long and unsigned long long) |
20:00:16 | * | peterhil joined #nim |
20:00:24 | PMunch | Just unsigned means "unsigned int" |
20:02:20 | * | peterhil quit (Max SendQ exceeded) |
20:06:29 | * | peterhil joined #nim |
20:13:46 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
20:17:38 | FromDiscord | <PunchCake> does anyone know how i can compile fidget to run on the web?↵i did nim js -d:release but it only generated a js file |
20:23:24 | FromDiscord | <PunchCake> nvm figured out that my vscode live server plugin was broken |
20:23:45 | FromDiscord | <PunchCake> crazy how just 1 guy can make a gui lib that competes with flutter |
20:27:46 | FromDiscord | <corey> Is there an idiomatic way to use `var` in loops to mutably modify a variable? |
20:28:42 | FromDiscord | <corey> sent a code paste, see https://play.nim-lang.org/#ix=4mUB |
20:29:49 | FromDiscord | <leorize> `for child in parent.children.mitems` |
20:30:03 | FromDiscord | <corey> Ah nice... |
20:30:08 | FromDiscord | <corey> I was sure I was "holding it wrong" |
20:30:25 | FromDiscord | <leorize> alternatively, iterating indices always work \:p |
20:30:54 | FromDiscord | <corey> The compiler is making me declare the `parent` param as `var` which is logical |
20:32:09 | FromDiscord | <corey> I guess it's fair to say, if you want to modify nested containers on a parameter, you need to declare the whole param as var to modify down the property tree |
20:36:24 | FromDiscord | <corey> sent a code paste, see https://play.nim-lang.org/#ix=4mUH |
20:36:37 | FromDiscord | <corey> @leorize Is this how you would write this? Assuming you weren't using maps/reducers etc. |
20:37:52 | FromDiscord | <leorize> you should get rid of the `: void` but that's pretty much how I'd do it w/o map-reduce |
20:46:34 | * | advesperacit quit (Changing host) |
20:46:34 | * | advesperacit joined #nim |
20:49:33 | FromDiscord | <corey> Any reason? Just inference? |
20:49:42 | FromDiscord | <corey> Thanks for the help |
20:57:22 | FromDiscord | <Phil> In reply to @corey "Any reason? Just inference?": Eh, mostly because it's not standard. In nim seeing a `:` generally indicates that something will be returned.↵That might (unlikely but possible) become relevant if you start doing really complex things with your procs via macros, but I wouldn't worry about it generally. ↵I wouldn't say it's a big deal, just a preference. |
20:58:53 | FromDiscord | <Phil> For the most part because macros parsing your proc (if you start using a lib with nice little pragmas etc. on your proc that magically do a lot of things) might actually start interpreting `:void` as you actually wanting to return something and generate code accordingly, so it's more of a "defensive" mechanism for when you have packages generate code for you I'd say, unless leorize has other thoughts on this, this is at least everything I ca |
20:59:31 | FromDiscord | <corey> Well received 👍 👍 |
21:00:02 | FromDiscord | <corey> Appreciate the detailed info |
21:00:55 | FromDiscord | <PunchCake> whats the best opengl library? |
21:01:08 | FromDiscord | <leorize> for the most part we don't annotate `void` in Nim unless strictly necessary, that type is slightly problematic |
21:05:07 | FromDiscord | <Phil> ElegantBeef we got opengl questions, I got no idea on that |
21:05:33 | FromDiscord | <leorize> #gamedev is probably the better place to ask |
21:05:40 | FromDiscord | <PunchCake> i am no game dev |
21:05:53 | FromDiscord | <PunchCake> im building a gui library |
21:06:04 | FromDiscord | <Phil> game dev deals a lot with opengl though, so could still be a good idea |
21:06:13 | FromDiscord | <PunchCake> alright |
21:06:22 | FromDiscord | <Phil> Wait, gumbercules is available @Gumbercules |
21:06:26 | FromDiscord | <PunchCake> is there some defacto standard gui library here in the nim community |
21:06:43 | FromDiscord | <PunchCake> like tkinter for python |
21:07:09 | FromDiscord | <Phil> Not that I'm aware of.↵There are a couple things that there's more buzz around, recently there came out a wrapper for QTwidgets, there's also owlkettle which IIRC was for GTK |
21:07:46 | FromDiscord | <Phil> There's also a wrapper around QT's QML API called nimqml that I have at least seen some people look at and play around a bit with |
21:07:52 | FromDiscord | <PunchCake> i just dont know why every gui library i come a cross is very poorly documented here |
21:08:14 | FromDiscord | <PunchCake> so its time i make one myself |
21:09:08 | FromDiscord | <Phil> I mean, I have no experience with native GUI generally (I do mostly webdev), but I can provide support in terms of how to set up a nim-lib and corresponding pipelines if you're not already familiar with it |
21:09:21 | FromDiscord | <Phil> (edit) "I mean, I have no experience with native GUI generally (I do mostly webdev), but I can provide support in terms of how to set up a nim-lib and corresponding ... pipelines" added "github" |
21:09:38 | FromDiscord | <PunchCake> In reply to @Isofruit "I mean, I have": no its not native |
21:09:50 | FromDiscord | <Phil> Haven't used it myself yet, but treeform also provides a pretty decent template repo for nim-libs |
21:09:52 | FromDiscord | <PunchCake> its just drawing to opengl and compiling for every platform |
21:09:53 | FromDiscord | <Gumbercules> In reply to @Isofruit "Wait, gumbercules is available": sorry, entertaining the kiddo |
21:09:54 | FromDiscord | <Gumbercules> what's up? |
21:10:03 | FromDiscord | <Phil> best opengl lib you're aware of for nim? |
21:10:10 | FromDiscord | <PunchCake> yes |
21:10:25 | FromDiscord | <Gumbercules> well, first of all, I wouldn't use OpenGL if I was writing a GUI library |
21:10:31 | FromDiscord | <PunchCake> vulkan? |
21:10:34 | FromDiscord | <Gumbercules> or at least I wouldn't tightly couple my GUI library to OpenGL |
21:10:34 | FromDiscord | <Gumbercules> no |
21:10:41 | FromDiscord | <PunchCake> what would i use |
21:10:43 | FromDiscord | <Gumbercules> I wouldn't tightly couple the GUI library to any graphics API |
21:10:43 | FromDiscord | <PunchCake> skia? |
21:10:49 | FromDiscord | <Gumbercules> you'd use the native operating system GUI APIs |
21:11:03 | FromDiscord | <PunchCake> wont really work |
21:11:04 | FromDiscord | <Gumbercules> if you're talking about creating an actual cross platform GUI library |
21:11:09 | FromDiscord | <PunchCake> yep |
21:11:16 | FromDiscord | <Gumbercules> so like Qt is the holy grail of this right? |
21:11:20 | FromDiscord | <Gumbercules> what does Qt use? |
21:11:24 | FromDiscord | <PunchCake> native |
21:11:25 | FromDiscord | <Gumbercules> definitely not any graphics API, it uses the native windowing / GUI apis |
21:11:27 | FromDiscord | <Gumbercules> right |
21:11:43 | FromDiscord | <Gumbercules> no one wants a cross platform GUI library that uses OpenGL and doesn't have the look and feel of the native operating system GUI |
21:11:49 | FromDiscord | <PunchCake> i meeaaaan |
21:11:52 | FromDiscord | <PunchCake> discord |
21:11:54 | FromDiscord | <PunchCake> figma |
21:11:56 | FromDiscord | <Gumbercules> these are electron |
21:11:58 | FromDiscord | <PunchCake> vscode |
21:12:02 | FromDiscord | <Gumbercules> and people dislike them because they're not native |
21:12:09 | FromDiscord | <Gumbercules> it's an easy hack |
21:12:16 | FromDiscord | <PunchCake> In reply to @Gumbercules "and people dislike them": they dislike them because of the huge bundle sizes and ram usage |
21:12:21 | FromDiscord | <Gumbercules> well that also |
21:12:33 | FromDiscord | <PunchCake> personally before i ever became i programmer i didnt know wtf is native |
21:12:43 | FromDiscord | <PunchCake> as long as it looks good and works im good |
21:12:49 | FromDiscord | <Gumbercules> in that case, there are already quit ea few of these |
21:12:52 | FromDiscord | <Gumbercules> but if you want to add to the pile |
21:13:06 | FromDiscord | <Gumbercules> OpenGL is fine, but it's deprecated on macOS |
21:13:11 | FromDiscord | <Phil> In reply to @Gumbercules "and people dislike them": I mean, I dislike them because they eat my battery, the looks will be custom in the end anyway |
21:13:14 | FromDiscord | <PunchCake> In reply to @Gumbercules "OpenGL is fine, but": metals :) |
21:13:15 | FromDiscord | <Gumbercules> so you're already shooting yourself in the foot |
21:13:17 | FromDiscord | <PunchCake> (edit) ":)" => ":(" |
21:13:18 | FromDiscord | <Gumbercules> well |
21:13:24 | FromDiscord | <Gumbercules> you could use something like Sokol or BGFX |
21:13:35 | FromDiscord | <Phil> It'd be super fire if they ate like 20MB RAM and barely made a dip for my CPU |
21:13:35 | FromDiscord | <Gumbercules> I'm using wgpu-native |
21:13:58 | FromDiscord | <PunchCake> idk man |
21:14:06 | FromDiscord | <PunchCake> if i were to go with the native route |
21:14:14 | FromDiscord | <PunchCake> where can i even learn to access these apis |
21:14:20 | FromDiscord | <Gumbercules> sec |
21:14:49 | * | ltriant joined #nim |
21:15:57 | FromDiscord | <Gumbercules> https://learn.microsoft.com/en-us/windows/win32/↵https://developer.apple.com/documentation/appkit↵https://www.x.org/releases/current/doc/ |
21:16:10 | FromDiscord | <Gumbercules> those would be the three |
21:16:24 | FromDiscord | <PunchCake> wtf is x.org |
21:16:25 | FromDiscord | <Gumbercules> for Windows, macOS and Linux respectively |
21:16:33 | FromDiscord | <Gumbercules> X is Linux's native desktop windowing API |
21:16:37 | FromDiscord | <PunchCake> linux just ship gtk man |
21:16:42 | FromDiscord | <PunchCake> its too much of a headache |
21:17:03 | FromDiscord | <leorize> there's also wayland these days |
21:17:21 | FromDiscord | <Gumbercules> ah yeah, Wayland exists now, I forget because I barely use Linux |
21:17:22 | FromDiscord | <PunchCake> the opengl route looks much easier |
21:17:31 | FromDiscord | <Gumbercules> it is for sure, but then you're not really making anything novel |
21:17:50 | FromDiscord | <Gumbercules> there are already quite a few of these libraries floating around in Nim userland |
21:18:03 | FromDiscord | <PunchCake> i just need something that works, emphasizes MVVM, and has a gui builder |
21:18:07 | FromDiscord | <Gumbercules> one thing Nim doesn't have, is a nice immediate mode GUI library, similar to Dear IMGUI |
21:18:19 | FromDiscord | <PunchCake> In reply to @Gumbercules "one thing Nim doesn't": heh |
21:18:30 | FromDiscord | <PunchCake> it took imgui 7 years to reach where they are now |
21:18:42 | FromDiscord | <Gumbercules> sure, but one needs to start somewhere 🙂 |
21:18:53 | FromDiscord | <Gumbercules> I imagine you could create an immediate mode GUI library in a week or so if you were dedicated to the cause |
21:18:56 | FromDiscord | <PunchCake> 7 years im either a chess grandmaster or drunk with a prostitute |
21:19:00 | FromDiscord | <Gumbercules> I'm not saying it's going to be as feature rich as Dear IMGUI |
21:19:03 | FromDiscord | <Gumbercules> but you could get the basics done |
21:19:21 | FromDiscord | <PunchCake> In reply to @Gumbercules "I imagine you could": something very simple? |
21:19:27 | FromDiscord | <Gumbercules> something like.... |
21:19:32 | FromDiscord | <PunchCake> do note that i never ever worked on a gui lib before |
21:19:36 | FromDiscord | <PunchCake> i have to start somewhere |
21:19:37 | FromDiscord | <Gumbercules> https://github.com/rxi/microui |
21:19:45 | * | ltriant quit (Ping timeout: 252 seconds) |
21:19:56 | FromDiscord | <Gumbercules> 1100 sloc of ANSI C |
21:20:07 | FromDiscord | <Gumbercules> that's doable in a week - I could probably port that in a weekend |
21:20:28 | FromDiscord | <PunchCake> first of |
21:20:39 | FromDiscord | <PunchCake> i assume i have to know some geometry right |
21:20:43 | FromDiscord | <Gumbercules> no not really |
21:21:01 | FromDiscord | <Gumbercules> I mean, the math is secondary to knowing how to architect one of these correctly |
21:21:12 | FromDiscord | <Gumbercules> you'd want to make them agnostic to the graphics API |
21:21:52 | FromDiscord | <Gumbercules> and allow someone to write a custom "backend" that would take the draw commands your library generates, and do what one will with draw commands, using whatever graphics API they want to |
21:22:05 | FromDiscord | <Gumbercules> this is how Dear IMGUI / Nuklear / MicroUI etc all work |
21:22:21 | FromDiscord | <Gumbercules> what you need to do the laying out of widgets is what's known as a layout engine |
21:22:52 | PMunch | @Gumbercules, why spend a week to port it when you can wrap it with Futhark today? |
21:23:10 | FromDiscord | <Gumbercules> some people don't like including C in their projects |
21:23:15 | FromDiscord | <Gumbercules> I'm not advocating that anyone do that btw, |
21:23:17 | FromDiscord | <Gumbercules> (edit) "btw," => "btw" |
21:23:25 | PMunch | Fair enough |
21:23:26 | FromDiscord | <Gumbercules> also I haven't used Furthark yet haha - I still just wrap my own libraries by hand |
21:23:35 | FromDiscord | <Gumbercules> but I should probably at some point take a gander 🙂 |
21:23:41 | PMunch | I mean having something like that in pure Nim would be really neat |
21:23:51 | FromDiscord | <PunchCake> the better option is:↵add a cache layer on top of microui and make it retained mode |
21:24:11 | FromDiscord | <Gumbercules> ORCSolver is a newer algorithm for layout engine I believe |
21:24:25 | PMunch | I'm a touch biased on how great it is, but for me Futhark has been extremely useful |
21:24:34 | FromDiscord | <Elegantbeef> Pmunch i'd say cause microui is a simple UI library that'd be better served in native Nim |
21:24:42 | FromDiscord | <Gumbercules> I forget about the other one that's popular (layout algorithm) |
21:24:54 | FromDiscord | <Elegantbeef> Cassowary i think |
21:24:58 | FromDiscord | <Gumbercules> In reply to @PunchCake "the better option is:": sure you could do this but you'd probably want to just start from scratch |
21:24:58 | PMunch | I originally used it to write a DLL/so for Unbound, basically wrapped their entire internal structure so I could call all their procs |
21:24:59 | FromDiscord | <Elegantbeef> Or maybe i just like birds |
21:25:07 | FromDiscord | <Gumbercules> Thanks @ElegantBeef that's the one |
21:25:20 | FromDiscord | <Gumbercules> In reply to @PMunch "I originally used it": I need to be able to bind to everything statically |
21:25:34 | PMunch | Had earlier spent a week writing it by hand, but in a couple of versions it had slowly drifted away from me and everything broke |
21:25:41 | PMunch | With Futhark the wrapping is automatic :) |
21:26:00 | PMunch | @Gumbercules, that's also possible |
21:26:02 | FromDiscord | <Gumbercules> @PunchCake if you want my wgpu bindings let me know and I can gist them or whatever |
21:26:06 | FromDiscord | <Gumbercules> In reply to @PMunch "<@204328759715692544>, that's also possible": sweet |
21:26:16 | PMunch | I mean even the example in the main README is a static build |
21:26:29 | FromDiscord | <Gumbercules> haha sorry, like I mentioned I haven't checked it out yet |
21:26:39 | FromDiscord | <Gumbercules> I'm so used to just pulling in a C library and starting to wrap it as I use things from it |
21:26:59 | PMunch | The problem is if the library updates and now you have to do the entire wrapping again |
21:27:04 | FromDiscord | <PunchCake> In reply to @Gumbercules "<@655759729477287956> if you want": sure |
21:27:05 | FromDiscord | <Gumbercules> also I kind of got burned out using the other wrapper generator |
21:27:10 | PMunch | Or if you accidentally miss something and have misaligned structs |
21:27:25 | FromDiscord | <PunchCake> i assume wgpu can run on android ios windows linux macos |
21:27:34 | FromDiscord | <PunchCake> maybe with wasm on the web as well |
21:27:39 | PMunch | @Gumbercules, the benefit of Futhark is that it uses libclang. And you know what is really good at properly understanding C code? A C compiler |
21:27:47 | FromDiscord | <Gumbercules> ah |
21:28:01 | PMunch | I had tried c2nim and nimterop to wrap Unbound as well |
21:28:02 | FromDiscord | <Gumbercules> does it support `cl.exe` or `vcc.exe` rather? |
21:28:12 | PMunch | Gave them about a week each of work before I just gave up |
21:28:14 | FromDiscord | <Elegantbeef> You say that pmunch but let's look at varargs 😄 |
21:28:19 | FromDiscord | <Gumbercules> In reply to @PunchCake "maybe with wasm on": yes all of those - https://gist.github.com/zacharycarter/6f4813395399fc85b6c67f478c6c146c - here you go |
21:28:45 | FromDiscord | <PunchCake> In reply to @Gumbercules "yes all of those": thanks |
21:28:46 | PMunch | It doesn't care what you actually use for compilation, libclang is just used to translate the C headers into something the macro can easily read |
21:28:58 | PMunch | I typically compile with GCC even though I build the bindings with libclang |
21:29:02 | FromDiscord | <Elegantbeef> Well in theory using clang to generate them can make issues |
21:29:04 | FromDiscord | <Gumbercules> just beware there's a line or two in there that isn't up to date with the wgpu-native stuff because I'm extending their library |
21:29:07 | PMunch | You could potentially run into some bugs, but eh |
21:29:26 | FromDiscord | <Gumbercules> In reply to @PMunch "I typically compile with": yeah I figured you were using libclang for the generation, I just wanted to make sure it was compiler independent, thanks for the info |
21:29:34 | PMunch | @Elegantbeef, ey varargs wasn't my fault! |
21:29:36 | FromDiscord | <Gumbercules> In reply to @Elegantbeef "Well in theory using": true |
21:29:40 | FromDiscord | <PunchCake> In reply to @Gumbercules "just beware there's a": alright |
21:29:52 | PMunch | That's just poorly defined C headers using pre-ansi style |
21:29:57 | FromDiscord | <Elegantbeef> Well any code that conditionally checks for clang features will be generated incorrectly, but I've yet run into it |
21:30:04 | FromDiscord | <Elegantbeef> Lol pmunch so defensive! |
21:30:20 | PMunch | It's technically correct, but since Nim uses more strict compile flags you get errors :P |
21:30:26 | FromDiscord | <Elegantbeef> Pmunch that wine issue i mentioned earlier is so funny |
21:30:42 | FromDiscord | <Elegantbeef> Turns out the networking stack attempted to send a message to port 0 |
21:30:55 | FromDiscord | <Elegantbeef> Which on windows doesnt error on sending, but on linux errors cause it's dumb |
21:31:03 | PMunch | Port 0? |
21:31:07 | PMunch | Does that even exist? |
21:31:11 | FromDiscord | <PunchCake> yes |
21:31:18 | FromDiscord | <Elegantbeef> Turns out sending to port 0 makes no sense, but windows in it's infinite wisdom doesnt error |
21:31:19 | FromDiscord | <Elegantbeef> It doesnt |
21:31:20 | FromDiscord | <PunchCake> it means ask the operating system to give you a free port |
21:31:23 | FromDiscord | <Elegantbeef> Port 0 is a wild card for binding |
21:31:25 | FromDiscord | <PunchCake> it does |
21:31:31 | FromDiscord | <Elegantbeef> But for sending it doesnt make any sense |
21:31:31 | FromDiscord | <PunchCake> it does something |
21:31:37 | FromDiscord | <Elegantbeef> Not when you send to it |
21:31:41 | FromDiscord | <PunchCake> yeah pretty much |
21:31:48 | FromDiscord | <PunchCake> its like sending to a brick wall lol |
21:31:54 | PMunch | Yeah sending to a wildcard doesn't make much sense :P |
21:32:12 | PMunch | "Eh, just send this packet to someone, I'm sure they'll appreciate it" |
21:32:29 | FromDiscord | <Elegantbeef> Port 0 is impossible to bind on windows, so why does it allow sending to it.... who knows |
21:32:29 | FromDiscord | <Elegantbeef> Anyway i have to go wireshark it now to ensure i'm write and then make a merge request to wine |
21:32:34 | PMunch | That's such a silly bug :P |
21:33:14 | FromDiscord | <PunchCake> In reply to @Gumbercules "yes all of those": wait what do i need to do to get this running |
21:33:37 | FromDiscord | <Gumbercules> https://github.com/gfx-rs/wgpu-native - you need to build that project or download the binary release |
21:33:53 | FromDiscord | <Gumbercules> https://github.com/gfx-rs/wgpu-native/blob/master/examples/triangle/main.c - there's a basic triangle rendering example |
21:34:13 | PMunch | @Elegantbeef, getting code into Wine is pretty cool though |
21:34:21 | FromDiscord | <PunchCake> In reply to @Gumbercules "https://github.com/gfx-rs/wgpu-native/blob/master/e": all of that just to draw a triangle |
21:34:25 | FromDiscord | <Gumbercules> yup |
21:34:39 | FromDiscord | <Gumbercules> but this will work on all operating systems and wasm |
21:34:40 | FromDiscord | <PunchCake> this looks harder that it seems lol |
21:34:47 | PMunch | Anyways, I should get ready for bed |
21:34:47 | FromDiscord | <Gumbercules> graphics programming isn't easy |
21:34:55 | FromDiscord | <Gumbercules> probably the most difficult domain of programming in existence |
21:35:05 | FromDiscord | <PunchCake> In reply to @Gumbercules "probably the most difficult": thats motivating |
21:35:06 | FromDiscord | <PunchCake> well shit |
21:35:18 | FromDiscord | <PunchCake> i know nothing in geometry what am i supposed to do |
21:35:28 | PMunch | Let me know if you run into any issues with Futhark once you give it a try @Gumbercules :) |
21:35:29 | FromDiscord | <Gumbercules> most of the math is linear algebra |
21:35:39 | FromDiscord | <Gumbercules> In reply to @PMunch "Let me know if": will do PMunch! |
21:35:43 | FromDiscord | <PunchCake> In reply to @Gumbercules "most of the math": dude i failed college algebra |
21:35:53 | FromDiscord | <PunchCake> just regular algebra |
21:35:57 | * | PMunch quit (Quit: leaving) |
21:35:58 | FromDiscord | <Gumbercules> well, it's also a gateway to learning 🙂 |
21:36:11 | FromDiscord | <Gumbercules> I failed the AP computer science test |
21:36:24 | FromDiscord | <PunchCake> whats that |
21:36:26 | FromDiscord | <PunchCake> ap |
21:36:27 | FromDiscord | <Gumbercules> and I've been programming for a living since I was 19 |
21:36:41 | FromDiscord | <Elegantbeef> Pmunch getting code into wine is cool, but it feels so silly that it's code that just does "Hey windows is dumb, we work around it" |
21:36:42 | FromDiscord | <Gumbercules> advanced placement, it's basically a college level entry course taught in HS |
21:36:53 | FromDiscord | <Gumbercules> I mean, I probably got a C in regular comp sci in HS |
21:37:04 | FromDiscord | <PunchCake> In reply to @Gumbercules "I mean, I probably": oh alright |
21:37:08 | FromDiscord | <Gumbercules> also a terrible math student |
21:37:20 | FromDiscord | <Gumbercules> don't let those past experiences define you - sometimes for something to click you just need the right teacher |
21:37:27 | FromDiscord | <Gumbercules> or the right way of having it explained to you |
21:37:32 | FromDiscord | <PunchCake> in cs im the best in all sections according to the dean but i suck so much at maths |
21:37:42 | FromDiscord | <PunchCake> In reply to @Gumbercules "don't let those past": 🙏 |
21:39:33 | FromDiscord | <Gumbercules> In reply to @PunchCake "🙏": https://media.discordapp.net/attachments/371759389889003532/1070820798438318181/Savov_I._No_bullshit_guide_to_linear_algebra_draft_2016ISBN_9780992001018O518s_MAl_.pdf |
21:40:10 | FromDiscord | <PunchCake> In reply to @Gumbercules "": 518 pages is a lot for a no bs guide |
21:40:22 | FromDiscord | <Phil> In reply to @Gumbercules "and I've been programming": Not only more life experience, even got a 6 year head start on me , dangit |
21:40:39 | FromDiscord | <Gumbercules> In reply to @PunchCake "518 pages is a": true.... |
21:40:55 | FromDiscord | <PunchCake> plus this happens https://media.discordapp.net/attachments/371759389889003532/1070821139338756156/image.png |
21:41:12 | FromDiscord | <Gumbercules> In reply to @Isofruit "Not only more life": yeah well you were also employed as a scientist first so... |
21:41:22 | FromDiscord | <Phil> Fair |
21:41:26 | FromDiscord | <Gumbercules> In reply to @PunchCake "plus this happens": oh crap - yeah let me get rid of that sorry |
21:41:28 | FromDiscord | <Gumbercules> I was working on something |
21:41:33 | FromDiscord | <PunchCake> np |
21:41:51 | FromDiscord | <PunchCake> btw i just dumped all of the wgpu release stuff into the dir for now |
21:42:03 | FromDiscord | <PunchCake> clean up will come after i get some working model |
21:42:17 | FromDiscord | <Gumbercules> updated - https://gist.github.com/zacharycarter/6f4813395399fc85b6c67f478c6c146c |
21:42:34 | FromDiscord | <PunchCake> thanks |
21:42:47 | FromDiscord | <Gumbercules> be back in a few, kiddo is going haam |
21:43:18 | FromDiscord | <PunchCake> In reply to @Gumbercules "be back in a": alr see ya |
21:50:50 | FromDiscord | <PunchCake> hm i wonder what this err means https://media.discordapp.net/attachments/371759389889003532/1070823635067084880/message.txt |
21:51:07 | FromDiscord | <PunchCake> im guessing it cant find the .lib files |
21:51:51 | FromDiscord | <Gumbercules> you are going to need to link to different libraries |
21:52:02 | FromDiscord | <Gumbercules> since you're using mingw |
21:52:28 | FromDiscord | <Gumbercules> alternatively you can compile with the MSVC compiler by adding the flag `-cc:vcc` to `nim c -r your_nim_program.nim` |
21:52:51 | FromDiscord | <Gumbercules> those libraries should be somewhere in the MinGW distribution you installed, but as to where I'm no tsure |
21:52:51 | FromDiscord | <PunchCake> let me try |
21:53:01 | FromDiscord | <Gumbercules> (edit) "no tsure" => "not sure" |
21:53:52 | FromDiscord | <Gumbercules> also the `wgpu_native.lib` related error means you need to have built the static version of `wgpu-native` with the `cargo build` command |
21:54:24 | FromDiscord | <Gumbercules> in fact you probably need to use `--cc:vcc` because I believe `wgpu-native` is going to use the `MSVC` compiler |
21:54:25 | FromDiscord | <PunchCake> i just downloaded the bins |
21:54:39 | FromDiscord | <Gumbercules> yeah even there I think you'll need to use `vcc.exe` |
21:54:52 | FromDiscord | <Gumbercules> because I'm pretty sure they compiled the windows binaries with `cl.exe` |
21:54:57 | FromDiscord | <Gumbercules> which nim wraps with `vcc.exe` |
21:55:12 | FromDiscord | <Gumbercules> they might have a set of mingw binaries but I'm not sure.... |
21:55:24 | FromDiscord | <Gumbercules> they're pretty easy to build via `cargo build` regardless |
21:55:32 | FromDiscord | <PunchCake> it will take ages |
21:55:34 | FromDiscord | <Gumbercules> just make sure you clone the submodules first |
21:55:36 | FromDiscord | <PunchCake> you know how rust is |
21:55:39 | FromDiscord | <Gumbercules> haha |
21:55:45 | FromDiscord | <Gumbercules> it's not THAT bad - I did it last night |
21:55:54 | FromDiscord | <PunchCake> its pretty bad with tauri |
21:55:59 | FromDiscord | <Gumbercules> since I was adding some stuff to their libraries |
21:56:11 | FromDiscord | <Gumbercules> In reply to @PunchCake "its pretty bad with": no experience with that mess haha |
21:57:15 | FromDiscord | <PunchCake> i keep getting the same error |
21:57:16 | FromDiscord | <Gumbercules> I just always use `vcc.exe` on Windows - it simplifies life for me not having to worry about `mingw` / `clang` |
21:57:28 | FromDiscord | <Gumbercules> hmmm - do you have the Windows 10 SDK installed? |
21:57:29 | FromDiscord | <PunchCake> `nim c --run wgpu.nim --cc:vcc` this is what im running btw |
21:57:34 | FromDiscord | <PunchCake> In reply to @Gumbercules "hmmm - do you": yes |
21:57:34 | FromDiscord | <Gumbercules> errr try |
21:57:42 | FromDiscord | <Gumbercules> `nim c --cc:vcc -r wgpu.nim` |
21:58:11 | FromDiscord | <PunchCake> `LINK : fatal error LNK1181: cannot open input file '.\wgpu-native\target\debug\wgpu_native.lib'`↵`Error: execution of an external program failed: 'vccexe.exe` |
21:58:24 | FromDiscord | <Gumbercules> okay now you just need to fix that path to `wgpu_native.lib` |
21:58:36 | FromDiscord | <PunchCake> alright bet |
21:58:48 | FromDiscord | <PunchCake> its in the same dir btw |
21:59:06 | FromDiscord | <PunchCake> it compiles |
21:59:08 | FromDiscord | <Gumbercules> \o/ |
21:59:14 | FromDiscord | <Phil> Anyone compiling on windows? |
21:59:17 | FromDiscord | <Gumbercules> me |
21:59:28 | FromDiscord | <Gumbercules> compiling what though... |
21:59:32 | FromDiscord | <PunchCake> In reply to @Isofruit "Anyone compiling on windows?": me |
22:00:00 | FromDiscord | <PunchCake> @Gumbercules the wgpu.nim is just bindings yeah it doesnt draw anything |
22:00:01 | FromDiscord | <Phil> Could one of you folks check out appdev, there's a windows specific issue there (the guy has a minimal example), but I can't really replicate it when I don't have a windows machine anywhere |
22:00:15 | FromDiscord | <Gumbercules> In reply to @PunchCake "<@204328759715692544> the wgpu.nim is": correct |
22:00:19 | FromDiscord | <PunchCake> alright |
22:00:25 | FromDiscord | <PunchCake> In reply to @Isofruit "Could one of you": i'll see what i can do |
22:00:45 | FromDiscord | <Phil> Thank! |
22:01:30 | FromDiscord | <PunchCake> np |
22:03:30 | FromDiscord | <PunchCake> `{.passC: "/I.\\wgpu-native\\ffi /I\\wgpu-native\\ffi\\webgpu-headers".}` ↵@Gumbercules what does this do |
22:04:04 | FromDiscord | <Gumbercules> that adds the `wgpu-headers` directory to the compiler's include path |
22:04:06 | FromDiscord | <Phil> > The passc pragma can be used to pass additional parameters to the C compiler like one would using the command-line switch --passc:↵https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-passc-pragma |
22:04:19 | FromDiscord | <PunchCake> ahh alright |
22:04:24 | FromDiscord | <PunchCake> i guess i dont have to modify it then |
22:04:30 | FromDiscord | <Gumbercules> you probably don't even need it |
22:04:40 | FromDiscord | <PunchCake> so i'd just comment it out |
22:04:49 | FromDiscord | <PunchCake> eh if it isnt breaking something im gonna leave it there |
22:04:49 | FromDiscord | <Gumbercules> since the header files are in the same directory as your `.nim` file |
22:05:08 | FromDiscord | <Gumbercules> you'll need it if the header files aren't in the same dir as your nim source |
22:05:23 | FromDiscord | <PunchCake> alright |
22:05:34 | FromDiscord | <PunchCake> so is there some docs of this lib? |
22:05:45 | FromDiscord | <PunchCake> or am i going to have to reverse engineer it |
22:06:04 | FromDiscord | <Phil> If there are doc comments and they don't host their api docs you can at least generate those |
22:06:16 | FromDiscord | <Phil> Something along the lines of the nim std-lib docs |
22:06:36 | FromDiscord | <Phil> You'd need to clone the repo, run a nim doc command and then at least you can look at that |
22:06:46 | FromDiscord | <Phil> (edit) "You'd need to clone the repo, run a nim doc command and then at least you can look at that ... " added "(locally)" |
22:06:49 | FromDiscord | <PunchCake> wdym |
22:06:55 | FromDiscord | <PunchCake> there is no comments bro |
22:07:05 | FromDiscord | <PunchCake> literally zero |
22:07:19 | FromDiscord | <PunchCake> (for the nim bindings) |
22:07:21 | FromDiscord | <Phil> Oooff |
22:07:36 | * | m5zs7k quit (Remote host closed the connection) |
22:07:42 | FromDiscord | <Phil> I didn't look at whatever lib was referenced so I didn't know ^^' |
22:07:51 | FromDiscord | <Gumbercules> if you look at any `wgpu-native` C example code - you just need to do the same invocations in Nim |
22:08:09 | FromDiscord | <Gumbercules> I generally don't document my bindings since they're mine and I don't really get in the habit of generating bindings for others to use anymore |
22:08:15 | FromDiscord | <Gumbercules> I just am willing to share whatever I produce |
22:08:23 | FromDiscord | <PunchCake> anymore |
22:08:28 | FromDiscord | <Gumbercules> when I was much younger I thought maintaining bindings for other swould be fun |
22:08:28 | FromDiscord | <Gumbercules> yeah |
22:08:32 | FromDiscord | <PunchCake> looks like something went sideways lol |
22:08:39 | FromDiscord | <Gumbercules> https://github.com/zacharycarter/nuklear-nim |
22:08:43 | FromDiscord | <Gumbercules> for instance |
22:08:47 | * | m5zs7k joined #nim |
22:08:49 | FromDiscord | <Gumbercules> eh it's just a lot of work, without much payoff |
22:09:10 | FromDiscord | <Gumbercules> no one else is using my main project (yet) so until then there isn't much incentive as it just gets in the way of real work |
22:09:30 | FromDiscord | <Gumbercules> which would be making my main project useful to others (eventually - after I build what I'm building with it) |
22:09:48 | FromDiscord | <Gumbercules> https://github.com/Tail-Wag-Games/frag |
22:10:05 | FromDiscord | <Phil> ~~See, I use all the packages I write myself and benefit for anyone else is secondary, I'm still surprised my packages get through~~ |
22:10:06 | FromDiscord | <PunchCake> so wait all bindings do is just convert the objects to something that nim can understand? |
22:10:33 | FromDiscord | <Gumbercules> bindings simply allow you to call into C/C++ code |
22:10:46 | FromDiscord | <Phil> Not necessarily, typically people simplify the API somewhat.↵nim-libsodium is a good positive example for example |
22:10:47 | FromDiscord | <Gumbercules> so you basically replicate the type / procedure signature in Nim code that's in the C library |
22:11:04 | FromDiscord | <Gumbercules> this allows Nim to understand how to call the C routine |
22:11:08 | FromDiscord | <Phil> That's a binding for libsodium that adds a little bit on top.↵It could have of course simplified things a tiny bit more, but it was pretty good |
22:11:19 | FromDiscord | <Phil> is pretty good |
22:11:23 | FromDiscord | <Gumbercules> then you tell nim (via the `importc` pragma) to import the C routine instead of expecting a Nim implementation |
22:11:32 | FromDiscord | <Elegantbeef> The important thing about C libraries is that they're not actually C |
22:11:34 | FromDiscord | <Phil> (edit) "somewhat.↵nim-libsodium" => "somewhat on top, but generally yeah.↵nim-libsodium" |
22:11:41 | FromDiscord | <Phil> ? |
22:11:42 | FromDiscord | <PunchCake> hm i see |
22:11:49 | FromDiscord | <Elegantbeef> We use C to document ABI, but it has nothing related to C |
22:11:56 | FromDiscord | <Phil> Ah, yeah fair |
22:12:59 | FromDiscord | <PunchCake> anyways |
22:13:29 | FromDiscord | <Elegantbeef> I swear i'll write a pascal ABI file if i ever make a system library |
22:13:35 | FromDiscord | <PunchCake> will reading the wgpu docs translate to the actual nim bindings? |
22:13:44 | FromDiscord | <Gumbercules> yeah |
22:13:47 | FromDiscord | <Gumbercules> well wgpu-native |
22:13:53 | FromDiscord | <Gumbercules> wgpu is a complicated project.... |
22:13:55 | * | m5zs7k quit (Ping timeout: 268 seconds) |
22:13:58 | FromDiscord | <Elegantbeef> Assuming you're reading the system library docs and not the rust docs |
22:14:02 | FromDiscord | <Gumbercules> webgpu is the specification |
22:14:20 | FromDiscord | <Gumbercules> wgpu is the Mozilla (Rust) implementation of the specification, Google has one too (Dawn) |
22:14:22 | FromDiscord | <PunchCake> yes native |
22:14:35 | FromDiscord | <Gumbercules> `wgpu-native` is the C API for `wgpu` |
22:14:36 | * | m5zs7k joined #nim |
22:14:42 | FromDiscord | <PunchCake> for now how can i just spawn an empty window and i'll figure out the rest |
22:14:55 | FromDiscord | <Elegantbeef> Take it from me, those Rust programmers dont always make their system libraries very usable |
22:15:03 | FromDiscord | <Gumbercules> yeah if you follow that triangle C code I shared and port it to Nim you should end up with a triangle example in Nim |
22:15:13 | FromDiscord | <Gumbercules> In reply to @Elegantbeef "Take it from me,": this one works quite well |
22:15:18 | FromDiscord | <Elegantbeef> Wasmer(WasmTime?) didnt even expose a way to query if a function existed in their system library |
22:15:19 | FromDiscord | <Gumbercules> and is much easier to get your feet wet with vs Dawn |
22:15:38 | FromDiscord | <Gumbercules> building Dawn is a major PITA and the C interface is tightly coupled with GLFW |
22:15:38 | FromDiscord | <Elegantbeef> Yea I do believe so |
22:15:39 | FromDiscord | <PunchCake> alright lemme try |
22:15:41 | FromDiscord | <Gumbercules> which is annoying af |
22:16:17 | FromDiscord | <PunchCake> wait how old are you all if you dont mind me asking |
22:16:27 | FromDiscord | <Phil> Approaching my thirties |
22:16:28 | FromDiscord | <Gumbercules> that was way less painful than I thought it would be - switching out `sokol_gfx` for `wgpu-native` - not that I had much rendering functionality written yet but I get to throw away several thousand lines of code now, so that's cool |
22:16:31 | FromDiscord | <Gumbercules> 37 |
22:16:39 | FromDiscord | <Gumbercules> I'm old af |
22:16:42 | FromDiscord | <PunchCake> thats crazy |
22:16:45 | FromDiscord | <PunchCake> im only 20 |
22:16:59 | FromDiscord | <Gumbercules> I've been using Nim since I was 29 I think? |
22:17:07 | FromDiscord | <PunchCake> nim existed back then? |
22:17:08 | FromDiscord | <Gumbercules> almost eight years now |
22:17:13 | FromDiscord | <Gumbercules> Nim became Nim in 2015 I believe |
22:17:15 | FromDiscord | <Phil> Nim is slightly older than rest |
22:17:19 | FromDiscord | <Phil> (edit) "rest" => "rust" |
22:17:21 | FromDiscord | <Gumbercules> before that it was named Nimrod |
22:17:27 | FromDiscord | <Gumbercules> was all biblical and shit |
22:17:31 | FromDiscord | <PunchCake> nim just needs more devs |
22:17:36 | FromDiscord | <PunchCake> (edit) "nim just needs more devs ... " added "that use it" |
22:17:37 | FromDiscord | <Elegantbeef> Nim was released in 2008 iirc |
22:17:47 | FromDiscord | <Gumbercules> well yeah but it didn't become Nim until 2015 |
22:17:53 | FromDiscord | <Gumbercules> or somewhere around there |
22:18:00 | FromDiscord | <Gumbercules> before then it was like Araq, Dom and Fowlmouth |
22:18:11 | FromDiscord | <Gumbercules> maybe a couple other folks |
22:18:38 | FromDiscord | <Gumbercules> but not many people were aware of / used the language |
22:18:55 | FromDiscord | <Gumbercules> the compiler was also implemented in Object Pascal |
22:18:55 | FromDiscord | <Phil> I mean, even a moron like myself can actually access and directly interact with C code (albeit I initially needed some help I now at least have an idea on how to do so.... I just hate dealing with C-APIs) and then actually write in a sane language like nim, so I got my default if I ever want to write code that turns into binaries |
22:18:57 | * | ltriant joined #nim |
22:18:58 | FromDiscord | <Gumbercules> and it had a PHP backend |
22:21:04 | FromDiscord | <PunchCake> half of the stuff in the C code dont translate to nim |
22:21:27 | FromDiscord | <Gumbercules> like what? |
22:21:40 | FromDiscord | <PunchCake> for example `glfwCreateWindow` |
22:21:49 | FromDiscord | <Gumbercules> oh yeah, well that's a different library |
22:21:57 | FromDiscord | <Elegantbeef> It doesnt translate verbatim but it does translate |
22:22:13 | FromDiscord | <Gumbercules> https://github.com/nimgl/glfw |
22:22:16 | FromDiscord | <Elegantbeef> Much like human languages, you cannot just machine translate between them |
22:22:33 | FromDiscord | <PunchCake> shit was updated last year |
22:22:40 | FromDiscord | <Gumbercules> GLFW doesn't change THAT much |
22:22:58 | FromDiscord | <PunchCake> nim does |
22:23:00 | FromDiscord | <Elegantbeef> I love people that act like software not being updated tomorrow means it's abandonware |
22:23:22 | FromDiscord | <Gumbercules> man `{.borrow.}` is annoying af |
22:23:39 | FromDiscord | <Elegantbeef> Eh i like distincts so you sod off! |
22:23:40 | FromDiscord | <Gumbercules> I wish I could make a custom pragma that would borrow everything I want, easily, via a template |
22:23:44 | FromDiscord | <Gumbercules> I mean I like distincts |
22:23:44 | FromDiscord | <Elegantbeef> Though yes it's dumb |
22:23:52 | FromDiscord | <Gumbercules> I just don't like having to be explicit about what I want to borrow |
22:23:56 | FromDiscord | <Elegantbeef> I've got you covered |
22:23:58 | FromDiscord | <Gumbercules> and I don't want to have to write a macro every time |
22:24:00 | FromDiscord | <Gumbercules> oh sweeeeeet |
22:24:04 | FromDiscord | <PunchCake> plus whats a surface descriptor? |
22:24:05 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/lender.nim#L226-L242 |
22:24:33 | FromDiscord | <Gumbercules> In reply to @PunchCake "plus whats a surface": descriptors are generally C structs, in libraries like these, that will tell the API how to create some resource |
22:24:42 | FromDiscord | <Gumbercules> so in this case it's an object that describes how to create a surface |
22:24:48 | FromDiscord | <Elegantbeef> I dont know if lender is of the highest quality, but oh boy does it make borrowing so much easier |
22:24:51 | FromDiscord | <Gumbercules> and a surface, in webgpu, is a rendering contxt |
22:25:15 | FromDiscord | <PunchCake> i guess thats the thing that would make a window |
22:25:30 | FromDiscord | <Phil> In reply to @Elegantbeef "https://github.com/beef331/nimtrest/blob/master/len": Sidenote, cool caching lib btw |
22:25:38 | FromDiscord | <Boston> Are objects in nim sequential, or is there a way to make sequential |
22:25:53 | FromDiscord | <Gumbercules> In reply to @PunchCake "i guess thats the": GLFW will make the window |
22:25:55 | FromDiscord | <Elegantbeef> Objects are by default stack allocated |
22:26:03 | FromDiscord | <Elegantbeef> So they're sequentially stored |
22:26:14 | FromDiscord | <Elegantbeef> Oh phil, i have some bad news |
22:26:18 | FromDiscord | <PunchCake> In reply to @Gumbercules "GLFW will make the": this is so confusing man |
22:26:23 | FromDiscord | <Elegantbeef> Kashae has a bug |
22:26:25 | FromDiscord | <Gumbercules> welcome to graphics programming |
22:26:25 | FromDiscord | <Phil> No, don't tell me it's outdated or doesn't work anymore |
22:26:26 | FromDiscord | <Phil> Fuck |
22:26:37 | FromDiscord | <Gumbercules> it's a world of pain |
22:26:40 | FromDiscord | <Phil> Like, I have no explicit need for it, but caching proc results is such a general thing that you occasionally need |
22:26:41 | FromDiscord | <PunchCake> is there a way to at least see what arguments these bindings take |
22:26:49 | FromDiscord | <Gumbercules> look at the C docs |
22:26:57 | FromDiscord | <Elegantbeef> It doesnt properly handle caching so there is a non 0 chance of having hash collisions |
22:27:00 | FromDiscord | <Gumbercules> they'll take the same arguments as the C API |
22:27:04 | FromDiscord | <Elegantbeef> handle hashing |
22:27:05 | FromDiscord | <Phil> Sadness |
22:27:11 | FromDiscord | <PunchCake> In reply to @Gumbercules "look at the C": link? |
22:27:18 | FromDiscord | <PunchCake> or is it the same as the triangle example |
22:27:19 | FromDiscord | <Elegantbeef> I need to fix it, but i forgot |
22:27:28 | FromDiscord | <Gumbercules> https://www.glfw.org/docs/latest/window_guide.html |
22:27:36 | FromDiscord | <PunchCake> wish me luck gang |
22:27:58 | FromDiscord | <PunchCake> im literally going balls deep into graphics programmer while i know jack shit in math |
22:28:06 | FromDiscord | <Boston> In reply to @Elegantbeef "So they're sequentially stored": thank you |
22:28:08 | FromDiscord | <PunchCake> isnt it lovely |
22:28:09 | FromDiscord | <Phil> Insert Just do it video |
22:28:19 | FromDiscord | <PunchCake> (edit) "programmer" => "programming" |
22:28:26 | FromDiscord | <Elegantbeef> Dumb me thought `Table[Hash, T]` was fine |
22:28:28 | FromDiscord | <Phil> In reply to @PunchCake "isnt it lovely": Equally strange things have happened before |
22:28:30 | FromDiscord | <Gumbercules> I knew nothing about graphics programming |
22:28:32 | FromDiscord | <Gumbercules> and then made |
22:28:35 | FromDiscord | <Gumbercules> or Nim really |
22:28:37 | FromDiscord | <Gumbercules> and then made |
22:28:45 | FromDiscord | <Gumbercules> https://github.com/fragworks/frag |
22:28:48 | FromDiscord | <Elegantbeef> What i need to do is emit a `Table[(ArgsHere), T)` |
22:28:59 | FromDiscord | <Elegantbeef> It actually should make it simpler |
22:29:04 | FromDiscord | <Gumbercules> with a thick enough head, and enough walls, you can too |
22:29:22 | FromDiscord | <Phil> I had no idea of ORMs other than barely using one before and somehow became a major contributor to one... tbh I had no idea of any of the things I published packages for |
22:29:27 | FromDiscord | <Elegantbeef> PRs welcome phil 😛 |
22:29:27 | FromDiscord | <Elegantbeef> You need to learn macros eventually |
22:29:34 | FromDiscord | <PunchCake> In reply to @Gumbercules "https://github.com/fragworks/frag": nice man |
22:29:38 | FromDiscord | <Phil> Beef has me by the balls |
22:29:40 | FromDiscord | <Phil> Dang |
22:29:44 | FromDiscord | <Elegantbeef> I know nothing and contribute to the compiler occasionally |
22:29:56 | FromDiscord | <Gumbercules> In reply to @PunchCake "nice man": well the result wasn't great, but I've learned quite a bit since then |
22:30:02 | FromDiscord | <Gumbercules> and learned quite a bit via that project |
22:30:14 | FromDiscord | <Gumbercules> I also made - https://github.com/zacharycarter/zengine |
22:30:27 | FromDiscord | <Gumbercules> which was basically a port of Raylib (very early in Raylib's history) |
22:30:28 | FromDiscord | <PunchCake> the docs look useful... https://media.discordapp.net/attachments/371759389889003532/1070833608010506320/image.png https://media.discordapp.net/attachments/371759389889003532/1070833608287342652/image.png |
22:31:08 | FromDiscord | <Gumbercules> https://github.com/tail-wag-games/frag - is the last engine I'll ever make 🙂 but it's also proving quite useful and "it works" |
22:31:14 | FromDiscord | <Phil> I am convinced GUI code breaks your brain in a very specific way that makes it near impossible to write good docs |
22:31:25 | FromDiscord | <Gumbercules> it'll also be useful outside of games (for standalone desktop applications) |
22:31:37 | FromDiscord | <Elegantbeef> Fuck does it take forever to build wine, i'd rather make wine stomping on grapes |
22:31:46 | FromDiscord | <Phil> Why are you building wine? |
22:31:55 | FromDiscord | <PunchCake> phil you beat me to it |
22:32:53 | FromDiscord | <Elegantbeef> I've got a bug fix to submit |
22:33:12 | FromDiscord | <PunchCake> @Gumbercules yeah man i give up on your bindings im gonna go use glfw, but i do appreciate it 🙏 💯 |
22:33:15 | FromDiscord | <Elegantbeef> I was testing with just proton, but now i'm building wine from master so i can properly make a merge request |
22:33:45 | * | xet7 quit (Remote host closed the connection) |
22:34:36 | FromDiscord | <Phil> "I know nothing"↵"Let me make this merge request to wine" |
22:34:41 | FromDiscord | <PunchCake> 💀 |
22:35:12 | FromDiscord | <Elegantbeef> The cognitive dissonance about my intelligence will never end |
22:35:36 | FromDiscord | <Phil> Beef just likes to downplay his knowledge levels 😛↵Anyway, I'll... maybe look into the caching thing tomorrow? |
22:35:36 | * | xet7 joined #nim |
22:35:55 | FromDiscord | <Phil> It's late and I want to bask in the afterglow of having published my package about password hashing for dummies |
22:36:02 | FromDiscord | <Elegantbeef> I'll be around as always 😄 |
22:36:17 | FromDiscord | <Elegantbeef> Assuming you need some help. I do try my damndest to document how my macros work |
22:36:29 | FromDiscord | <Elegantbeef> Speaking of gumber, does lender make your life any easier or is it still asinine? |
22:37:02 | FromDiscord | <PunchCake> gumber is gone |
22:37:13 | FromDiscord | <PunchCake> he officially went crazy from gui programming |
22:37:23 | FromDiscord | <Elegantbeef> But i've done GUI programming |
22:37:28 | FromDiscord | <PunchCake> he is now in brazil selling drugs |
22:37:41 | FromDiscord | <Phil> Beef |
22:37:42 | FromDiscord | <Phil> That |
22:37:47 | FromDiscord | <Phil> I don't know how to tell you this |
22:37:50 | FromDiscord | <leorize> that explains a lot |
22:37:56 | FromDiscord | <Elegantbeef> Lol |
22:38:10 | FromDiscord | <Elegantbeef> I knew something was up |
22:38:17 | FromDiscord | <ShalokShalom> In reply to @Isofruit "I am convinced GUI": I think its more the object oriented nature of most GUIs, who break your brain |
22:38:19 | FromDiscord | <Elegantbeef> My gui looks like someone made it with crayons though |
22:38:25 | FromDiscord | <ShalokShalom> no matter if you write the docs |
22:38:27 | FromDiscord | <ShalokShalom> or the code |
22:38:54 | FromDiscord | <Phil> I've seen alright documented OO code, so I think it's only a contributor, not the deciding factor |
22:39:07 | FromDiscord | <Phil> And that doesn't explain why gnome is basically non-documented |
22:39:24 | FromDiscord | <Phil> Err GTK I mean |
22:39:25 | FromDiscord | <ShalokShalom> documented OO code is something different than OO based UI frameworks |
22:39:34 | FromDiscord | <ShalokShalom> In reply to @Isofruit "And that doesn't explain": Both |
22:39:51 | FromDiscord | <ShalokShalom> GTK and GNOME are two frameworks |
22:40:21 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "My gui looks like": sounds positive to me |
22:40:28 | FromDiscord | <ShalokShalom> I imagine pastel |
22:41:14 | FromDiscord | <leorize> gtk is documented, no? |
22:41:21 | FromDiscord | <ShalokShalom> well... |
22:41:30 | FromDiscord | <ShalokShalom> technically yes |
22:41:45 | FromDiscord | <ShalokShalom> there is documented and there is documented |
22:42:04 | FromDiscord | <PunchCake> In reply to @ShalokShalom "there is documented and": lovely |
22:42:18 | FromDiscord | <Elegantbeef> Nah pastels are high shelf crayons |
22:42:23 | FromDiscord | <ShalokShalom> https://youtu.be/gGZyVSOnqm0 |
22:42:35 | FromDiscord | <ShalokShalom> I recommend everyone this video |
22:42:44 | FromDiscord | <ShalokShalom> if they are about to settle for gtk |
22:42:47 | FromDiscord | <ShalokShalom> just saying |
22:42:58 | FromDiscord | <PunchCake> i know for a fact that its gonna be qt |
22:43:19 | FromDiscord | <PunchCake> ~~~i didnt guess at all im sure~~ |
22:44:40 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "The cognitive dissonance about": its more like body dysmorphic disorder |
22:44:44 | FromDiscord | <ShalokShalom> just for the brain |
22:44:59 | FromDiscord | <ShalokShalom> you dont know how intelligent you are |
22:45:13 | FromDiscord | <ShalokShalom> and when people tell you, you deny :p |
22:45:22 | FromDiscord | <leorize> the #1 reason to use gtk is because you don't use c++ \:p |
22:45:32 | FromDiscord | <Phil> TBH if I judged whether I was intelligent by looking at my own code I'd proclaim myself the dumbest person on the planet |
22:45:33 | FromDiscord | <ShalokShalom> you end up worse |
22:45:41 | FromDiscord | <Phil> Instead I look at my colleague's code and that makes me feel smart |
22:45:42 | FromDiscord | <ShalokShalom> since gtk has its object system as well |
22:46:20 | FromDiscord | <Elegantbeef> The bar isnt that high, it's more like nothing |
22:47:02 | FromDiscord | <ShalokShalom> In reply to @leorize "the #1 reason to": the guy in the video actually says he and Linus (who he writes the software with) actually hated both Cpp but Qt made it work |
22:47:03 | FromDiscord | <Gumbercules> In reply to @PunchCake "<@204328759715692544> yeah man i": glfw and webgpu don't do the same things |
22:47:08 | FromDiscord | <Gumbercules> glfw will just handle your windowing / event loop |
22:47:11 | FromDiscord | <ShalokShalom> ah, there he is 😄 |
22:47:14 | FromDiscord | <ShalokShalom> hi 👋🏻 |
22:47:14 | FromDiscord | <Gumbercules> webgpu is the rendering API |
22:47:18 | FromDiscord | <PunchCake> ah shit |
22:47:19 | FromDiscord | <Gumbercules> yeah sorry, needed to feed the baby |
22:47:24 | FromDiscord | <PunchCake> so i cant draw with glfw? |
22:47:29 | FromDiscord | <ShalokShalom> not in reverse? |
22:47:31 | FromDiscord | <Gumbercules> nope |
22:47:35 | FromDiscord | <Gumbercules> nope to both |
22:47:45 | FromDiscord | <Gumbercules> you could use `cglm` if you wanted to do both |
22:47:47 | FromDiscord | <Gumbercules> or `sdl2` |
22:47:48 | FromDiscord | <PunchCake> sent a code paste, see https://play.nim-lang.org/#ix=4mUY |
22:47:53 | FromDiscord | <Gumbercules> but you're not going to be doing any 3d with those |
22:48:03 | FromDiscord | <Gumbercules> err wayt soorry |
22:48:04 | FromDiscord | <Gumbercules> I meant |
22:48:06 | FromDiscord | <Gumbercules> CSFLM |
22:48:07 | FromDiscord | <PunchCake> i dont want 3d |
22:48:09 | FromDiscord | <Gumbercules> (edit) "CSFLM" => "CSFML" |
22:48:10 | FromDiscord | <PunchCake> i want 2d |
22:48:12 | FromDiscord | <leorize> yea but if you don't want to write C++ at all, Qt is just gonna be baggage↵(@ShalokShalom) |
22:48:34 | FromDiscord | <ShalokShalom> In reply to @leorize "yea but if you": Why? You can use Nim as an example |
22:48:35 | FromDiscord | <Gumbercules> https://github.com/Vladar4/sdl2_nim |
22:48:42 | FromDiscord | <Gumbercules> or |
22:48:47 | FromDiscord | <ShalokShalom> and since qml is a superset of js, you can use basically any language |
22:48:57 | FromDiscord | <Gumbercules> https://github.com/oprypin/nim-csfml |
22:49:06 | FromDiscord | <leorize> have you tried to wrap Qt?↵(@ShalokShalom) |
22:49:19 | FromDiscord | <Gumbercules> these aren't going to be performant renderers though |
22:49:21 | FromDiscord | <PunchCake> sent a code paste, see https://play.nim-lang.org/#ix=4mUZ |
22:49:22 | FromDiscord | <Gumbercules> they don't do any sprite batching |
22:49:24 | FromDiscord | <ShalokShalom> Its hard and that's why there are less bindings |
22:49:29 | FromDiscord | <Gumbercules> (edit) "they don't do any sprite ... batching" added "/ draw call" |
22:49:35 | FromDiscord | <ShalokShalom> but again, qml is a superset of qt |
22:49:44 | FromDiscord | <ShalokShalom> no bindings needed |
22:49:51 | FromDiscord | <ShalokShalom> (edit) "qt" => "js" |
22:49:58 | FromDiscord | <Gumbercules> In reply to @PunchCake "anyways since this is": what are you trying to do? create a window? |
22:50:03 | FromDiscord | <PunchCake> In reply to @Gumbercules "what are you trying": draw to it |
22:50:07 | FromDiscord | <Gumbercules> ah |
22:50:10 | FromDiscord | <leorize> almost all bindings have to go through a C++ bridge library |
22:50:12 | FromDiscord | <ShalokShalom> qt widget and qt quick are hard to wrap |
22:50:23 | FromDiscord | <Gumbercules> yeah, depending on the graphics API you're using this will vary |
22:50:23 | FromDiscord | <leorize> you still need it, qml is not magic↵(@ShalokShalom) |
22:50:32 | FromDiscord | <PunchCake> In reply to @Gumbercules "yeah, depending on the": im sooooo confused here |
22:50:35 | FromDiscord | <Gumbercules> GLFW itself, unlike SDL2 / SFML doesn't have any drawing logic |
22:50:41 | FromDiscord | <leorize> you need less, granted, but you still need to wrap something |
22:50:47 | FromDiscord | <ShalokShalom> In reply to @leorize "almost all bindings have": you know there are maintained qt widget and qt quick libraries for Nim? |
22:50:51 | FromDiscord | <PunchCake> im literally about to bash my head in the wall |
22:50:53 | FromDiscord | <Gumbercules> In reply to @PunchCake "im sooooo confused here": every operating system has it's own graphics API |
22:51:00 | FromDiscord | <Gumbercules> some graphics API serve multiple OS's |
22:51:12 | FromDiscord | <Gumbercules> these libraries (SDL2 / GLFW / SFML / etc...) |
22:51:12 | FromDiscord | <PunchCake> so i gotta use opengl + glfw? |
22:51:18 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4mV0 |
22:51:22 | FromDiscord | <Gumbercules> they mostly just wrap the native window APIs I linked you to earlier |
22:51:26 | FromDiscord | <Gumbercules> win32, X, appkit |
22:51:32 | FromDiscord | <PunchCake> so its just the WINDOW |
22:51:35 | FromDiscord | <PunchCake> not drawing to it? |
22:51:35 | FromDiscord | <Gumbercules> yes |
22:51:38 | FromDiscord | <Gumbercules> glfw will give you just a window |
22:51:48 | FromDiscord | <Gumbercules> then you'd use wgpu to create a rendering context and draw to it |
22:51:48 | FromDiscord | <PunchCake> what in the living fuck will i do with only a window bro |
22:51:52 | FromDiscord | <Gumbercules> not much |
22:51:57 | FromDiscord | <PunchCake> then whats the point |
22:52:05 | FromDiscord | <PunchCake> why not put it with opengl |
22:52:06 | FromDiscord | <Gumbercules> you need to start with a window |
22:52:13 | FromDiscord | <Gumbercules> opengl doesn't have any windowing logic |
22:52:19 | FromDiscord | <PunchCake> exactly |
22:52:19 | FromDiscord | <Gumbercules> it's a rendering API |
22:52:22 | FromDiscord | <PunchCake> why not include it |
22:52:24 | FromDiscord | <PunchCake> make it 2 in 1 |
22:52:32 | FromDiscord | <PunchCake> its sound logical |
22:52:41 | FromDiscord | <Gumbercules> well, at one point, most software developers believed in single component single responsibility |
22:52:47 | FromDiscord | <Gumbercules> so you have a library for your windowing |
22:52:51 | FromDiscord | <Gumbercules> a library for your drawing |
22:52:53 | FromDiscord | <Gumbercules> etc |
22:52:54 | FromDiscord | <PunchCake> bruuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuh |
22:53:17 | FromDiscord | <PunchCake> sent a code paste, see https://paste.rs/jAp |
22:53:18 | FromDiscord | <PunchCake> what do they mean by image |
22:53:25 | FromDiscord | <Gumbercules> hey, just be glad I didn't link you to - GLAD, GLEW, and SOIL |
22:53:46 | FromDiscord | <Gumbercules> In reply to @PunchCake "then what is the": I have no idea - can you share a link to that section of the docs? |
22:53:47 | FromDiscord | <leorize> I do know that nimqml uses DOtherside bridge but I haven't seen anything else↵(@ShalokShalom) |
22:54:00 | FromDiscord | <PunchCake> In reply to @Gumbercules "I have no idea": https://nimgl.dev/docs/glfw.html#GLFWImage |
22:55:08 | FromDiscord | <Gumbercules> https://www.glfw.org/docs/latest/groupwindow.html#ga7cc0a09de172fa7250872046f8c4d2ca |
22:55:15 | FromDiscord | <Gumbercules> looks like it's used for https://www.glfw.org/docs/latest/input_guide.html#cursor_custom |
22:55:15 | FromDiscord | <Gumbercules> and |
22:55:20 | FromDiscord | <Gumbercules> https://www.glfw.org/docs/latest/window_guide.html#window_icon |
22:55:45 | FromDiscord | <ShalokShalom> In reply to @leorize "I do know that": the qt widget bindings got announced on the forum a couple of weeks ago |
22:55:51 | FromDiscord | <PunchCake> oh god bruh |
22:56:05 | FromDiscord | <PunchCake> i havent wrote a single line and im going nuts already |
22:56:21 | FromDiscord | <ShalokShalom> https://forum.nim-lang.org/t/9785 |
22:56:23 | FromDiscord | <PunchCake> opengl it is fuck it |
22:56:33 | FromDiscord | <PunchCake> In reply to @ShalokShalom "https://forum.nim-lang.org/t/9785": no |
22:56:36 | FromDiscord | <Gumbercules> there's a lot of good OpenGL tutorials out there |
22:56:39 | FromDiscord | <PunchCake> is there wxwidgets bindings |
22:56:50 | FromDiscord | <PunchCake> i'd give blowjobs for that |
22:56:50 | FromDiscord | <Gumbercules> https://github.com/johnnovak/learnopengl-nim |
22:56:55 | FromDiscord | <Gumbercules> is probably a good place to start |
22:57:31 | FromDiscord | <PunchCake> ok bet |
22:57:59 | FromDiscord | <Gumbercules> good news is - even if you end up using another Graphics API |
22:58:01 | FromDiscord | <PunchCake> "A work in progress."↵"last commit in 2018" |
22:58:03 | FromDiscord | <Gumbercules> knowing OpenGL will serve you well |
22:58:19 | FromDiscord | <Gumbercules> well at least John was ambitious |
22:58:24 | FromDiscord | <PunchCake> was |
22:58:28 | FromDiscord | <PunchCake> was |
22:58:35 | FromDiscord | <Gumbercules> 🤷 |
22:59:30 | FromDiscord | <ShalokShalom> In reply to @PunchCake "no": this was not for you 😉 |
23:00:02 | FromDiscord | <ShalokShalom> @Gumbercules wasnt there an awesome abstraction layer for all those APIs? |
23:00:02 | FromDiscord | <PunchCake> damn alr |
23:00:04 | FromDiscord | <leorize> neat↵(@ShalokShalom) |
23:00:23 | FromDiscord | <Gumbercules> In reply to @ShalokShalom "<@204328759715692544> wasnt there an": there are a few - I just switched from `sokol_gfx` to `wgpu-native` |
23:00:24 | FromDiscord | <leorize> look at pmunch/wxnim↵(@PunchCake) |
23:00:26 | FromDiscord | <Gumbercules> but there's also `bgfx` |
23:00:36 | FromDiscord | <Gumbercules> and uhhh what's that other one called.... |
23:00:52 | FromDiscord | <Gumbercules> https://github.com/DiligentGraphics/DiligentEngine |
23:00:53 | FromDiscord | <Gumbercules> oh and |
23:01:02 | FromDiscord | <Gumbercules> https://github.com/ConfettiFX/The-Forge |
23:01:12 | FromDiscord | <Gumbercules> probably several other ones I haven't mentioned |
23:01:23 | FromDiscord | <PunchCake> In reply to @leorize "look at pmunch/wxnim (<@655759729477287956>)": eehh, 2 years ago was the last edit? the cpp repo gets merged every day... |
23:01:26 | FromDiscord | <Gumbercules> honestly if you want to just hit the ground running with something |
23:01:33 | FromDiscord | <Gumbercules> https://github.com/r-lyeh/FWK - is what I'd use |
23:01:38 | FromDiscord | <Gumbercules> could create bindings for it in an hour |
23:01:43 | FromDiscord | <Gumbercules> and you basically have a game engine ready to go |
23:01:54 | FromDiscord | <Gumbercules> single header lib too |
23:02:04 | FromDiscord | <Gumbercules> only OpenGL is supported though |
23:02:11 | FromDiscord | <PunchCake> In reply to @Gumbercules "could create bindings for": at this point why dont you make a tool that generates bindings |
23:02:12 | FromDiscord | <ShalokShalom> i think there is another one... |
23:02:15 | FromDiscord | <PunchCake> would save you a lot of time |
23:02:28 | FromDiscord | <Gumbercules> In reply to @PunchCake "at this point why": @PMunch already has 🙂 |
23:02:34 | FromDiscord | <Gumbercules> they mentioned it earlier - furthark |
23:02:36 | FromDiscord | <Gumbercules> I think it's named |
23:02:39 | FromDiscord | <PunchCake> oh yeah |
23:02:46 | FromDiscord | <Gumbercules> In reply to @PunchCake "would save you a": I tend to wrap as I go |
23:02:49 | FromDiscord | <PunchCake> then wtf are you doing making it by hand |
23:02:57 | FromDiscord | <Gumbercules> so like, I want to use this C library - I pull it in and start wrapping as I need things |
23:03:02 | FromDiscord | <Gumbercules> well, most of my libraries are already wrapped |
23:03:13 | FromDiscord | <Gumbercules> https://github.com/Tail-Wag-Games/frag/tree/master/thirdparty |
23:03:18 | FromDiscord | <PunchCake> ah alright |
23:03:30 | FromDiscord | <PunchCake> or you know what |
23:03:32 | FromDiscord | <Gumbercules> I also have a lot of experience iwith Nim |
23:03:39 | FromDiscord | <Gumbercules> so I get things done rather quickly with the language |
23:03:50 | FromDiscord | <Gumbercules> and I know C very well, as well |
23:03:51 | FromDiscord | <PunchCake> since i have nothing better to do i'll try making a gui library rather than consuming one maybe i'll learn a thing or two |
23:03:58 | FromDiscord | <PunchCake> In reply to @Gumbercules "and I know C": lucky |
23:04:02 | * | estiquelapice quit () |
23:04:04 | FromDiscord | <PunchCake> spent 3 months studying pointers |
23:04:06 | FromDiscord | <Gumbercules> eh, I'm just old |
23:04:19 | FromDiscord | <Gumbercules> pointers were alien as fuck to me in HS / college |
23:04:22 | * | estiquelapice joined #nim |
23:04:28 | FromDiscord | <Gumbercules> I don't think I grasped pointers until my mid to late twenties |
23:04:33 | FromDiscord | <Gumbercules> much less double pointers |
23:04:54 | FromDiscord | <PunchCake> In reply to @Gumbercules "much less double pointers": i like how you can just make infinite pointers and its still valid lol |
23:05:04 | FromDiscord | <Gumbercules> there's a meme.... |
23:05:10 | FromDiscord | <PunchCake> xD |
23:05:16 | FromDiscord | <Gumbercules> https://media.discordapp.net/attachments/371759389889003532/1070842367571148841/4QFTxQB.png |
23:05:41 | FromDiscord | <PunchCake> In reply to @Gumbercules "": then someone fucks up and points to nothing |
23:05:45 | FromDiscord | <PunchCake> isnt it nice |
23:05:47 | FromDiscord | <ShalokShalom> i probably mean wgpu |
23:05:47 | FromDiscord | <Gumbercules> honestly, if you really want to grasp systems programming, learn some asm |
23:06:00 | FromDiscord | <Gumbercules> In reply to @ShalokShalom "i probably mean wgpu": probably - that's the Rust / Mozilla implementation of the WebGPU spec |
23:06:03 | FromDiscord | <Gumbercules> Dawn is Google's |
23:06:11 | FromDiscord | <PunchCake> In reply to @Gumbercules "honestly, if you really": i have an old 8088 book that my father used to study in college |
23:06:11 | FromDiscord | <ShalokShalom> i see |
23:06:29 | FromDiscord | <PunchCake> i think its worth a read yeah? |
23:06:32 | FromDiscord | <ShalokShalom> asm helped me to understand programming very differently |
23:06:48 | FromDiscord | <Gumbercules> In reply to @PunchCake "i think its worth": probably, although there are lots of good resources online for this type of thing now |
23:06:57 | FromDiscord | <Gumbercules> https://nandgame.com/ - is fun for logic gates |
23:07:13 | FromDiscord | <PunchCake> In reply to @Gumbercules "https://nandgame.com/ - is fun": it sucks |
23:07:18 | FromDiscord | <Gumbercules> https://skilldrick.github.io/easy6502/simulator.html |
23:07:20 | FromDiscord | <PunchCake> i perfer turing complete the game |
23:07:31 | FromDiscord | <ShalokShalom> i am usually a high level guy, and I think pure asm has actually a very high levelish aspect ↵↵since everything is so flat, low level and high level is the same level 😅 |
23:07:59 | FromDiscord | <Gumbercules> In reply to @PunchCake "i perfer turing complete": yeah - nandgame is free though 🙂 |
23:08:06 | FromDiscord | <Phil> I too think that you are high, Shalok. |
23:08:19 | FromDiscord | <PunchCake> In reply to @Gumbercules "yeah - nandgame is": ~~piracy~~ sadly i bought it |
23:08:20 | FromDiscord | <ShalokShalom> hihi |
23:08:22 | FromDiscord | <Gumbercules> be back in a few |
23:10:15 | FromDiscord | <PunchCake> you know sometimes i wonder |
23:10:43 | FromDiscord | <PunchCake> how did people back in the day make games in asm while i'm struggling to do it in a language as easy as nim |
23:11:14 | FromDiscord | <ShalokShalom> https://github.com/ConfettiFX/The-Forge |
23:11:19 | FromDiscord | <ShalokShalom> thats the one I meant |
23:11:22 | FromDiscord | <ShalokShalom> I think... |
23:12:48 | FromDiscord | <ShalokShalom> In reply to @PunchCake "how did people back": the magic about asm is, that you are always in direct contact with what you are doing |
23:13:20 | FromDiscord | <ShalokShalom> I guess it can become very overwhelming in a disorganized large project |
23:13:44 | FromDiscord | <ShalokShalom> but I guess it's not that bad, if you set one foot after the other |
23:13:46 | FromDiscord | <PunchCake> In reply to @ShalokShalom "I guess it can": they didnt even have anything remotely like github |
23:14:02 | FromDiscord | <PunchCake> i wonder how would they work on it together |
23:14:06 | FromDiscord | <ShalokShalom> asm has the benefit that there is almost zero magic and that means less overhead to your brain |
23:14:16 | FromDiscord | <PunchCake> yeah |
23:14:23 | FromDiscord | <ShalokShalom> well, they usually worked at the same place |
23:17:57 | FromDiscord | <Phil> In reply to @PunchCake "how did people back": By not having a tenth of the features you have nowadays |
23:18:14 | FromDiscord | <PunchCake> In reply to @Isofruit "By not having a": wdym |
23:20:01 | FromDiscord | <Phil> Prime example: Donkey kong country.↵The game has a banana counter, a life counter and a K-O-N-G visualization, maybe sometimes a secondary coin counter, that's the Interface for the most part.↵In terms of move-mechanics, you got move, jump, ground-pound and sprint.↵Interaction mechanics are "Pull stuff, pick up, throw, jump on enemy" |
23:20:07 | FromDiscord | <Phil> That's all fairly limited, comparatively |
23:20:22 | FromDiscord | <PunchCake> no no |
23:20:31 | FromDiscord | <PunchCake> how did they even draw to the screen to begin with |
23:20:44 | FromDiscord | <Phil> Pain and small teams |
23:20:52 | FromDiscord | <ShalokShalom> A lot of the early games have very interesting mechanics, how they dealt with the limitations |
23:21:08 | FromDiscord | <ShalokShalom> Crash Bandicoot and Zelda: A Link to the past |
23:21:29 | FromDiscord | <ShalokShalom> @PunchCake Memory space was actually one of the most tricky things initially |
23:21:53 | FromDiscord | <PunchCake> i heard that it was typical for a game dev back then to invent something new on accident |
23:22:10 | FromDiscord | <ShalokShalom> And also later was CPU cycles and other stuff that we think about today less of a concern than we could think |
23:22:33 | FromDiscord | <ShalokShalom> In reply to @PunchCake "i heard that it": yeah, something like that. Like a Lisp, that compiled down statically |
23:23:35 | FromDiscord | <ShalokShalom> https://arstechnica.com/gaming/2021/09/war-stories-how-crash-bandicoot-hacked-the-original-playstation/ |
23:24:32 | FromDiscord | <ShalokShalom> https://all-things-andy-gavin.com/2020/02/27/war-stories-crash-bandicoot/ |
23:34:28 | * | advesperacit quit () |
23:39:53 | FromDiscord | <ShalokShalom> There is Kha, too: https://github.com/Kode/Kha↵↵Idk, how usable that from Nim is |
23:43:20 | * | azimut joined #nim |
23:57:54 | FromDiscord | <PunchCake> What do you guys think of c# + avalonia? |
23:58:41 | FromDiscord | <Hourglass [She/Her]> What's Avalonia |
23:59:51 | FromDiscord | <PunchCake> In reply to @Hourglass, When the Hour Strikes "What's Avalonia": Its like .net maui but with wasm and linux support |