<< 02-02-2023 >>

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