<< 24-05-2023 >>

00:00:14FromDiscord<Elegantbeef> I really have started loving tuples after writing my ECS using them
00:00:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wyz
00:00:47FromDiscord<Elegantbeef> Replace all the logic that makes sense there with your code
00:01:30FromDiscord<Elegantbeef> UiElements is a simple concept that ensures that it's a tuple and all entries are `UiElement` derived
00:02:31FromDiscord<Ayy Lmao> Is there a difference between using a concept as a function argument vs using it with a generic like that?
00:02:49FromDiscord<Elegantbeef> Might have been a concept bug, might have been old code
00:03:18FromDiscord<Elegantbeef> In my case with all these generics with inheritance trees it was a bit confusing what was going where
00:03:41FromDiscord<Elegantbeef> It's supposed to be raised the same as a parameter
00:04:18FromDiscord<Elegantbeef> Ok yea seems like it's a mild concept bug with tuples
00:04:54FromDiscord<Ayy Lmao> Now that you mention it I think when I was messing around with concepts I was specifically having problems with tuples.
00:05:19FromDiscord<Elegantbeef> Yea the `[]` doesnt work on the concept
00:05:42FromDiscord<Elegantbeef> `for field in ui.fields` is magic that applies `[]` to `ui` but since it's a `concept` type it doesnt get to field access
00:05:51FromDiscord<Elegantbeef> So it might be a concept bug it might be sensible
00:06:09FromDiscord<Elegantbeef> eitherway turning it to a generic constraint means the type we get is the tuple instead of the concept
00:06:44FromDiscord<Elegantbeef> Constraining a generic parameter to the concept is almost always what you want
00:07:01FromDiscord<Elegantbeef> `$typeof(ui)` otherwise prints `UiElements` instead of the underlying type
00:07:21FromDiscord<Ayy Lmao> I'll stick with that then, seems like a more sane way of doing it. Maybe that's why I was having so much trouble before.
00:07:56FromDiscord<Elegantbeef> Probably, one could argue implicit generics are bad(araq does)
00:08:51FromDiscord<Ayy Lmao> A minor detail I left out in my example is that I'd like the user to not have to deal with any underlying API types, since multiple APIs could potentially be used as a backend.
00:09:06FromDiscord<Elegantbeef> Right and I mostly gave that to you
00:09:16FromDiscord<Elegantbeef> `ApiPlugin` is the only type they deal with 😄
00:10:11FromDiscord<Elegantbeef> `plug =...` and `plug.process` is simulating the DLL existing
00:10:15FromDiscord<Elegantbeef> well program existing
00:10:24FromDiscord<Ayy Lmao> Hmm so I suppose ApiPlugin would be some sort of generic plugin then?
00:10:48FromDiscord<Elegantbeef> Yea you could make it `UserPluginBase[T] = ref object of X`
00:10:58FromDiscord<Elegantbeef> Oh god we're falling into the same pattern that my UI uses
00:11:20FromDiscord<Elegantbeef> Shortly you'll be using `type A[T, X] = ref object of T` and hitting a compiler error that I fixed in devel
00:11:20FromDiscord<Ayy Lmao> Well it must be a good pattern then
00:11:55FromDiscord<Elegantbeef> It's practically using generics as a type of dependency injection, and people love dependency injection
00:12:26FromDiscord<Ayy Lmao> That definitely sounds like what I want.
00:13:11FromDiscord<Elegantbeef> Though arguably `apiPlugin` will always be a pointer so you could just have it be a `pointer` and then have different modules implement different backends
00:13:29FromDiscord<Elegantbeef> This way backends are explicit on usage and not altogether in one spot
00:13:49FromDiscord<Ayy Lmao> Yeah I definitely would want different backends in different files.
00:13:50FromDiscord<Elegantbeef> Without using a generic for a UserPluginBase
00:14:06FromDiscord<Elegantbeef> If it's always a pointer what I said is a good idea
00:14:29FromDiscord<Elegantbeef> Otherwise a generic is your best bet, but this means you have a shared`UserPluginType[T]` with exported internal fields
00:14:58FromDiscord<Ayy Lmao> I think it's usually a pointer to a backend specific struct but at this point I only know one backend so I'm not positive.
00:15:51FromDiscord<Ayy Lmao> I think it's usually a pointer you make, inject user data via pointer, and the clean up when the host tells you to.
00:17:03FromDiscord<Ayy Lmao> I'll take some time and digest everything you said and see if I can get something working.
00:17:13FromDiscord<Elegantbeef> Anywho I've given you a lot of information, so best to cement it .... yea you got it 😛
00:20:27FromDiscord<Ayy Lmao> Thanks for the help!
00:38:18*tiorock joined #nim
00:38:19*tiorock quit (Changing host)
00:38:19*tiorock joined #nim
00:38:19*rockcavera is now known as Guest4076
00:38:19*tiorock is now known as rockcavera
00:39:45*Guest4076 quit (Ping timeout: 240 seconds)
01:09:14*jmdaemon quit (Ping timeout: 268 seconds)
01:36:40*krux02_ quit (Remote host closed the connection)
02:04:08*pharonix71 quit (Ping timeout: 240 seconds)
02:05:39*pharonix71 joined #nim
02:09:21FromDiscord<treeform> In reply to @mratsim "Maybe find in std/algorithm": I don't see what you are taking about? There is no delete by index? https://nim-lang.org/docs/algorithm.html
02:09:23*derpydoo joined #nim
02:10:25FromDiscord<treeform> In reply to @Elegantbeef "there is a find": I have created deleteFirst/delFirst many times. But Nim std lib does not have one, nowhere?
02:10:26FromDiscord<Elegantbeef> They're saying use that module to implement it
02:10:40FromDiscord<Elegantbeef> Dont think so
02:10:55FromDiscord<treeform> I should probably PR to add that.
02:11:02FromDiscord<treeform> It comes up all the time.
02:15:46FromDiscord<Vincent Kadar> Would you like to discover how to profit from Polymath market if YES I’m willing to help anyone earn $100k in just 72hours Dm me to know HOWhttps://t.me/VincentKadar
02:28:44FromDiscord<Elegantbeef> Not to say it shouldnt be in the stdlib, but funnily enough I don't think I've ever deleted first element
02:44:54NimEventerNew thread by alexeypetrushin: Any fuzzy or trigram substring search library, with index, so it's instant?, see https://forum.nim-lang.org/t/10221
02:49:49*rockcavera quit (Remote host closed the connection)
02:58:02FromDiscord<demotomohiro> There are https://nim-lang.org/docs/system.html#delete,seq[T],Natural↔and https://nim-lang.org/docs/system.html#del,seq[T],Natural↔But `myseq.delete(0)` is inefficient.↔If you want to delete first element frequently and need to preserve the order, https://nim-lang.org/docs/deques.html
03:47:58FromDiscord<Arathanis> In reply to @treeform "I have created deleteFirst/delFirst": pretty sure its in https://nim-lang.org/docs/deques.html
03:48:18FromDiscord<Arathanis> they are optimized for addition/removal on both ends
03:48:29FromDiscord<Arathanis> in this case its popFirst
03:49:24FromDiscord<Arathanis> it says it uses a seq under the hood so it might not be any different but traditionally they use an implementation optimized for both push/pop on the front and end
03:49:42FromDiscord<treeform> Queues have some thing else.
03:51:33*lucasta quit (Quit: Leaving)
03:51:49FromDiscord<treeform> I just want python's remove: https://www.programiz.com/python-programming/methods/list/remove
03:51:52FromDiscord<treeform> but in Nim
03:53:49FromDiscord<Elegantbeef> @Arathanis\: treeform wants a search and removal of the first instance of avalue
03:55:17FromDiscord<Arathanis> ohhh got it got git
03:55:32FromDiscord<Arathanis> i hear delFirst and think its popping off index 0
03:55:42FromDiscord<Arathanis> but they want to remove the first instant of an element
03:55:47FromDiscord<Arathanis> (edit) "instant" => "instance"
04:16:39FromDiscord<Rika> Isn’t this just find + delete
04:38:47*derpydoo quit (Ping timeout: 240 seconds)
04:56:03FromDiscord<spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4wz3
04:56:23FromDiscord<Elegantbeef> you allocate teh array using `create` or `alloc`
04:57:02FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wz5
04:57:20FromDiscord<Elegantbeef> Ah this is likely different
04:58:23FromDiscord<Elegantbeef> We do not need to use manual allocation here
04:58:46FromDiscord<spotlightkid> Here's C code using this function\: https://github.com/jackaudio/jack-example-tools/blob/main/tools/property.c#L291
04:59:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wz6
04:59:34FromDiscord<Elegantbeef> Such a cursed API
05:00:27FromDiscord<Elegantbeef> Oh wait I see how it works
05:00:27FromDiscord<Elegantbeef> You do not need to allocate got it
05:04:20FromDiscord<spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4wz8
05:05:15FromDiscord<Elegantbeef> It likely should be `var ptr UncheckedArray[T]`
05:05:18FromDiscord<spotlightkid> (I am fairly new to Nim and I am still learning about its type system and its memeory managemnt)
05:06:56FromDiscord<Elegantbeef> Is `jack_description` a pointer type?
05:07:40FromDiscord<Elegantbeef> Ah found the source it's not
05:08:04FromDiscord<spotlightkid> No, its struct
05:08:36FromDiscord<Elegantbeef> Oh I see the issue
05:08:50FromDiscord<Elegantbeef> Yea it should be `var ptr UncheckedArray[ItemT]`
05:09:16FromDiscord<Elegantbeef> that matches `T` in C
05:09:18FromDiscord<Elegantbeef> It's a ptr to a ptr
05:10:05*advesperacit joined #nim
05:11:59FromDiscord<Elegantbeef> Pascall really should've won the war
05:12:27FromDiscord<Elegantbeef> `^array of jack_description_t` is so much easier to parse 😛
05:32:48FromDiscord<spotlightkid> Still can't get it to work. Here's the most minimal, self-contained example I can come up with, without errorc checking and leaking memory\:↔https://cpaste.org/?f17a9facbfa6541b#8YkwetqxkQt7uZYn35frfjLpREoCJfDwa3qiArkmdRK6↔Requires Linux and a running JACK server, though.↔I still get thesame SIGSEGV error.
05:33:37FromDiscord<Elegantbeef> Like i said `var ptr UncheckedArray[Description]`
05:38:07FromDiscord<spotlightkid> Oh, in the declaration. Now I get it.
05:51:26FromDiscord<spotlightkid> Got it working now. Thanks for your help!↔https://github.com/SpotlightKid/jacket/blob/master/examples/jacket_list_all_properties.nim
05:53:56FromDiscord<Elegantbeef> No problem
06:30:23*merhab joined #nim
06:31:02*merhab quit (Client Quit)
06:47:07*PMunch joined #nim
06:59:08*derpydoo joined #nim
07:09:44*xet7 quit (Remote host closed the connection)
07:15:50*xet7 joined #nim
07:36:57FromDiscord<haxscramper> @JJ just wanted to say that if you want to write comparison on hmatching I'm here and would be happy to answer the questions to the best of my ability - why/where/how, why not etc.
07:37:37FromDiscord<haxscramper> There is also an but updated version of this https://github.com/haxscramper/hmatching
07:39:38FromDiscord<haxscramper> In reply to @haxscramper "<@572634810917322773> just wanted to": Just not instantly, it's 1140 here and I'm likely to be working until 2100, so might not respond in this time
07:40:21FromDiscord<JJ> i may take you up on that tomorrow! i have to wake up in six hours unfortunately
07:51:39*Notxor joined #nim
08:07:08FromDiscord<sOkam!> @PMunch is it possible to do this with a prefix?↔seems like this feature is for individual fields, but I want to remove a prefix from the whole header đŸ€” https://media.discordapp.net/attachments/371759389889003532/1110841399345160222/image.png
08:08:44FromDiscord<sOkam!> if the renameCallback function is the way to do it, im not quite grasping how to do it exactly. so any pointers would really help
08:08:47FromDiscord<Elegantbeef> I think you use the callback but filter for only the ones with the prfix
08:09:26FromDiscord<sOkam!> yeah but how is the question. you know i always get gigastuck on the dumbest details of the syntax 😔
08:09:49FromDiscord<sOkam!> are you meant to `startsWith` the inputs? or what exactly?
08:10:01FromDiscord<Elegantbeef> https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L5-L37
08:10:33FromDiscord<sOkam!> oh really useful! tysm ✍
08:10:45PMunchA rename callback is indeed the way to go, here is a sample taken from my Gtk wrapper: ix.io/4wzF
08:12:00PMunchI'm thinking of writing a better rename callback for this project though, because every procedure in Gtk is prefixed with the type it works on..
08:12:44PMunchFor example you have stuff like `gboolean gtk_tree_model_get_iter_first (GtkTreeModel* tree_model, GtkTreeIter* iter)`
08:13:17PMunchCurrently it just strips the `gtk_` part, but I'd really prefer if it also managed to strip the `tree_model` part
08:14:11PMunchUnfortunately renameCallback doesn't get the full type signature, so I can't go poking around the arguments easily..
08:19:29FromDiscord<sOkam!> Is there a way to mark all enums as pure?
08:22:25PMunchHmm, not really no
08:22:36FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wzI
08:23:29FromDiscord<sOkam!> should be `VariantType.Nil` instead of `GDExtensionVariantType.GDExtensionVariantTypeNil`
08:23:55PMunchAre you able to rename the fields with a renameCallback?
08:24:22FromDiscord<sOkam!> it should be doable, but then they conflict with the `type Bool` that are outside
08:25:41PMunchAh I see
08:26:06PMunchMaybe keep the "Type" part? Or just name them "VariantNil" or something
08:26:43FromDiscord<sOkam!> that second option might work, or some variation like that đŸ€”
08:26:51PMunchI will accept a PR to make it possible to somehow mark enums as pure :)
08:27:31FromDiscord<sOkam!> or maybe just pass a text replace on the `.nim` resulting file, since its just for replacing `.} = enum` with `, pure.} = enum`
08:28:15FromDiscord<sOkam!> In reply to @PMunch "I will accept a": i mean, i can barely understand how to -use- futhark now, after a year of attempting it. i don't foresee me making a pr for that like anytime soon in this century 🙈
08:33:35PMunchHaha, I was just putting it out there :)
08:33:46PMunchIt's unfortunate that you find it so hard to use though
08:34:48FromDiscord<sOkam!> its easy to use, -if- you understand what its doing
08:34:55FromDiscord<sOkam!> that's what took me a year to grasp
08:35:18PMunchStill, it could probably have been described better
08:35:36PMunchYou wouldn't happen to have a list of what confused you?
08:37:09FromDiscord<sOkam!> key problem i had is that futhark is not a C compiler from nim. its a header generator↔the difference is huge, because i was attempting to run a C project with it, but what i needed to do that is to create a buildsystem using nim compile pragmas, and nothing to do with futhark↔then futhark could be helpful for porting code over to nim, but its not for that usecase i was trying to use it for
08:37:36FromDiscord<sOkam!> its not until I worked with staticglfw buildsystem that saw the difference
08:40:27PMunchAah, I think I understand
08:40:40FromDiscord<sOkam!> after doing that, and then writing a wrapper for wgpu, i understood what futhark is actually doing
09:04:19*derpydoo quit (Ping timeout: 256 seconds)
09:26:12NimEventerNew Nimble package! malebolgia - Malebolgia creates new spawns. Experiments with thread pools and related APIs., see https://github.com/Araq/malebolgia
09:33:03*marcus quit (Remote host closed the connection)
09:35:06*marcus joined #nim
10:21:16*derpydoo joined #nim
10:58:48FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wAu
11:00:15FromDiscord<sOkam!> the numbers are probably incorrect. i spent 20mins just collecting that data, getting lost in numbers with the same names. but the base types for my inputs are all `pointer`, which is the base type of those two inputs
11:00:43PMunchWell the numbers can be a bit confusing, not going to lie
11:01:21PMunchThe idea is basically that you shouldn't even have to look at them, just using the identifier without the numbers should give you exactly what you need.
11:01:33FromDiscord<sOkam!> i guess `ptr pointer` is not the same as `pointer` or something?
11:02:14PMunchBut you can use `-d:nodeclguards` to create prettier output
11:02:34PMunchYour actual error is actually that `ptr T` isn't the same as `pointer`
11:02:56FromDiscord<sOkam!> but T is a pointer itself đŸ€”
11:03:02FromDiscord<sOkam!> shouldn't that resolve to a base pointer?
11:03:11PMunchRemember Nim is strict when it comes to types, so you need to cast your pointers to the expected type
11:03:51FromDiscord<sOkam!> i guess i could cast to `GDExtensionTypePtr` đŸ€”
11:04:05PMunchthat proc takes a `ptr GExtensionType` and a `ptr ptr GDExtensionType` it looks like
11:04:20FromDiscord<sOkam!> typeptr and consttypeptr
11:04:21PMunchAnd you pass in two `pointer` values, which is a type mismatch
11:04:33PMunchOh right
11:04:44FromDiscord<sOkam!> yeah but those two are inheriting from `pointer` at the base anyway
11:04:50FromDiscord<sOkam!> since they are actually C void
11:04:56PMunchBut the comment still stands, those pointer types are not compatible with `pointer` in Nim
11:05:25FromDiscord<sOkam!> why not? they are pointer at the very base. or is the resolution stopped at some point?
11:05:38PMunchOh wait, GDExtensionTypePtr should actually be compatible with `pointer`
11:05:51FromDiscord<sOkam!> that's what i was saying yeah
11:06:08FromDiscord<sOkam!> both are just pointer at the base, but one of them is `ptr pointer`
11:06:09PMunchNot sure what GDExtensionConstTypePtr is though
11:06:17PMunchYour snippet doesn't include its definition
11:06:32PMunchAh yeah, then you need to pass a `ptr pointer`
11:06:37FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wAA
11:06:46FromDiscord<sOkam!> is ptr pointer a thing? i didn't even know
11:06:57PMunchSure
11:07:07PMunchIt's either a list of pointers, or a pointer to where a pointer is stored
11:07:21FromDiscord<sOkam!> well im glad this is nim, at least. this would be giga-confusing in C ⚰
11:07:35PMunchIf it's a pointer to where a pointer is stored it's analogous to what `var` does for arguments in Nim
11:07:47FromDiscord<sOkam!> ic, makes senses
11:08:40PMunchThe lists usecase is pretty much why I created the retype thing
11:09:05PMunchIn order to actually tell Futhark that it should use an `UncheckedArray` instead for nicer syntax
11:14:36*derpydoo quit (Read error: Connection reset by peer)
11:21:58FromDiscord<rishav> sent a code paste, see https://play.nim-lang.org/#ix=4wAD
11:22:26FromDiscord<rishav> (edit) "https://play.nim-lang.org/#ix=4wAF" => "https://play.nim-lang.org/#ix=4wAG"
11:22:49FromDiscord<rishav> (edit) "https://play.nim-lang.org/#ix=4wAG" => "https://play.nim-lang.org/#ix=4wAH"
11:24:18FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wAI
11:25:15PMunchsOkam!, oh you won't be able to tell like that. It's purely a semantic difference.
11:25:39PMunchThe reason that works is because it's now a `ptr pointer`
11:26:25PMunchIt would also work if you had `var myStr = str.addr.toGodot` and then did `api.stringNameFromString(handle.addr.toGodot, myStr.addr)`
11:26:25FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wAJ
11:26:43PMunchAnd judging by the name of that procedure I would assume that's the intension
11:26:59PMunchOh, huh
11:27:04PMunchGuess I'm wrong then
11:27:11FromDiscord<sOkam!> are you confusing names of variant types with nim types?
11:27:17PMunchNo?
11:27:18FromDiscord<sOkam!> they have like 4 steps to get a single handle
11:27:33FromDiscord<sOkam!> String is not `string` and its not `cstring` neither `StringName`
11:27:50PMunchI wasn't really looking at the types
11:27:52FromDiscord<sOkam!> string > cstring > String > StringName
11:28:03FromDiscord<sOkam!> oh, then i don't know what you meant
11:28:11PMunchI was just saying that both `arg[0].addr` and `myStr.addr` would be the same type `ptr pointer`
11:28:31PMunchSo the compiler won't complain if you do it wrong
11:28:50FromDiscord<sOkam!> wouldn't the second option just be a pointer to the variable itself?
11:29:01FromDiscord<sOkam!> like as a unique object of an array
11:29:13PMunchYes, but the variable is a `pointer` so a pointer to that would be a `ptr pointer`
11:29:16FromDiscord<sOkam!> an array that doen't exist
11:29:43FromDiscord<sOkam!> is that different than passing a pointer to the first object of the box?
11:29:54PMunchNo
11:31:14PMunchThe thing is that if it expected a null terminated array of pointers then you would have to create an array of pointers with the last element being a null, if it expected what in Nim would be a `var pointer` then you should pass it a pointer to a variable as the result will be stored there. But it looks like you're doing it right
11:31:30FromDiscord<sOkam!> you bring a fair point, though. this case only has a single argument to the function. but future cases might have more, so I assume they will expect that array to contain more than just one variable đŸ€”
11:31:37PMunchrishav, did you give up trying to get Futhark to work on Windows (assuming you're the same person as on GitHub)?
11:32:13FromDiscord<sOkam!> In reply to @PMunch "The thing is that": kk ty ✍
11:32:21PMunchOr it might be passed along to some underlying thing which expects N elements based on what type you're converting to
11:32:34FromDiscord<sOkam!> yeah exactly
11:33:51FromDiscord<rishav> In reply to @PMunch "<@787006367508201502>, did you give": yep 😩 Couldn't solve the issue. liblang is installed on my system. I even copied the dlls to the project folder and used the `--passL` flag as you suggested
11:34:12PMunchYou shouldn't have to copy the files
11:34:17FromDiscord<rishav> (edit) "In reply to @PMunch "<@787006367508201502>, did you give": yep 😩 Couldn't solve the issue. liblang is installed on my system. I even copied the ... dlls" added "libclang"
11:34:29PMunch`--passL` should be enough, but I'm not 100% sure that flag passes through Nimble
11:34:54PMunchWhere do you have libclang.dll on your system?
11:35:58FromDiscord<rishav> `"C:\Users\risharan\scoop\apps\llvm\16.0.4\bin\libclang.dll"`
11:37:33FromDiscord<rishav> I also don't think passL flag works for nimble. Instead it works directly on the nim compiler. But that means I am not sure how to install futhark to even start off with
11:38:15PMunchWell many flags will pass through nimble and be passed to the compiler
11:38:44PMunchnimble install --passL:"-L<path to lib directory containing libclang.dll file>" futhark
11:38:49PMunchThat should be the required command
11:42:37FromDiscord<rishav> This is what I get https://media.discordapp.net/attachments/371759389889003532/1110895627191205930/message.txt
11:44:54PMunchAh, those angle brackets shouldn't be included
11:45:03PMunchThey are just there to denote the part you should replace
11:45:22PMunchYour command should be: nimble install --passL:"-LC:\Users\risharan\scoop\apps\llvm\16.0.4\bin" futhark
11:45:39PMunchIt also needs the path to be the directory not the file
11:47:44FromDiscord<rishav> T_T I can't believe i wasted hours because I can't read simple error messages.
11:48:01FromDiscord<rishav> Thank you @PMunch . Got Futhark to install ` Success: futhark installed successfully.`
11:50:02PMunchNice!
11:50:19PMunchAnd don't worry about it, happens to the best of us :)
12:06:52FromDiscord<rishav> sent a code paste, see https://play.nim-lang.org/#ix=4wAV
12:21:15FromDiscord<jmgomez> @PMunch seems like nimlsp is broken? https://github.com/nim-lang/Nim/actions/runs/5067675021/jobs/9099004355?pr=21897
12:25:07FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wAZ
12:31:40PMunchrishav, ah yes another issue caused by your non-standard install path. It's outlined in the "Basic usage" chapter of the readme: https://github.com/PMunch/futhark#basic-usage
12:31:55PMunchBasically you need to set `sysPath`
12:32:54PMunchjmgomez, yes it has been reported and fixed: https://github.com/nim-lang/Nim/pull/21555
12:33:08PMunchBut there hasn't been any new versions since. So it's still broken on the latest stable..
12:33:37FromDiscord<jmgomez> I meant, the Nim CI is not passing due to that from a change made an hour ago
12:35:31PMunchAh shit, there was actually an issue with the latest merge PR I believe
12:39:45PMunchThere, pushed a fix
12:41:25PMunchHmm, does the Nim CI run the latest version of each package? That PR hadn't been tagged in a release yet
12:41:37FromDiscord<jmgomez> oh that was fast, thanks!
12:42:14FromDiscord<jmgomez> I have no idea sorry. I was just hoping I didnt trigger any random issue with my change 😛
12:44:26PMunchHmm, it would be very strange if your change triggered that bug. But it looks very strange
12:45:20FromDiscord<jmgomez> Yeah, since it was something undefined but I did triggered something odd with a prev push https://discord.com/channels/371759389889003530/768367394547957761/1110729527212122182
12:45:51PMunchThe error points to here: https://github.com/PMunch/nimlsp/blob/bba60b785188592b8d9966e75ff7c9ef6a759b0f/src/nimlsp.nim#L305
12:46:02PMunchAnd as you can see that should be defined in line #298
12:46:04FromDiscord<ringabout> In reply to @PMunch "Hmm, does the Nim": yep
12:46:13FromDiscord<jmgomez> In reply to @jmgomez "Yeah, see the latest": Is this block of code, isnt it
12:46:18PMunchSo if you broke that then you broke something real bad :P
12:48:05PMunchAnyways, the nimlsp issue should be fixed now
12:48:23PMunchSo if it's still broken it's your fault :P
13:29:02*rockcavera joined #nim
13:29:25*Notxor quit (Remote host closed the connection)
13:57:30*progranner joined #nim
14:06:25*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
14:10:39*progranner joined #nim
14:10:53FromDiscord<least antisemitic pole> is there a simple (svelte-like) way to enable/disable classes in karax?
14:11:11FromDiscord<least antisemitic pole> usecase: tailwind-css instead of actually having a css file
14:15:43NimEventerNew post on r/nim by Toma400: A newbie question with JSON/strict return typing, see https://reddit.com/r/nim/comments/13qmy3k/a_newbie_question_with_jsonstrict_return_typing/
14:17:40*PMunch quit (Quit: Leaving)
14:36:33*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
14:38:44*progranner joined #nim
14:43:23*Notxor joined #nim
14:56:10FromDiscord<Nerve> What's the correct place to discuss the standard library?
14:57:32FromDiscord<demotomohiro> This place should be correct place if you have any questions about the stdlib.
15:00:56FromDiscord<Nerve> sent a long message, see http://ix.io/4wBR
15:02:31FromDiscord<Nerve> And style issues aside, please. I realize I style my code like Python, I can change that and it's not the most pressing concern.
15:03:17*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
15:09:08*Notxor quit (Ping timeout: 268 seconds)
15:15:20*azimut quit (Ping timeout: 240 seconds)
15:41:02*ntat joined #nim
15:44:00*xet7 quit (Ping timeout: 264 seconds)
15:56:26*xet7 joined #nim
15:56:39NimEventerNew post on r/nim by qtless: CSS In Pure Nim 👑, see https://reddit.com/r/nim/comments/13qphpx/css_in_pure_nim/
15:58:57ntatHi. Ho to convert img = execProcess("import -window root png:-") to Image? I need to get screenshot to Image object in Nim. Or is there any other way to get a screenshot? To manipulate images I use Piexie module.
16:01:27*progranner joined #nim
16:04:00*progranner quit (Client Quit)
16:10:10*progranner joined #nim
16:16:22*Notxor joined #nim
16:34:51FromDiscord<auxym> not super familiar with pixie, or that import command, but if it gives you a bunch of bytes that are a PNG file, I assume you should use some proc in pixie to read png images
16:41:01*arkurious joined #nim
16:42:10FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCf
16:42:40FromDiscord<sOkam!> I was able to get the name with $type... but, don't know how to access the fields data from the type
16:42:51FromDiscord<sOkam!> (edit) "data" => "information"
16:44:42FromDiscord<Rika> https://nim-lang.org/docs/iterators.html#fields.i%2CT
16:44:56FromDiscord<Rika> https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT
16:47:02FromDiscord<sOkam!> In reply to @Rika "https://nim-lang.org/docs/iterators.html#fields.i%2": is that for a `typedesc`?
16:47:23FromDiscord<sOkam!> doesn't seem to be, which is why i didn't just use that
16:50:02FromDiscord<jmgomez> Why do you want to do that?
16:53:18*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
16:54:17*progranner joined #nim
16:55:44FromDiscord<sOkam!> In reply to @jmgomez "Why do you want": to create wgsl code from a Nim type, which is given by the user on compile time
16:56:27FromDiscord<jmgomez> are you on devel?
16:56:35FromDiscord<sOkam!> i could be if required
16:56:55FromDiscord<jmgomez> I recently implemented `codegenDecl` for types, that may help you
16:57:11FromDiscord<sOkam!> which module is it in?
16:57:23FromDiscord<jmgomez> let me see if I can find the docs
16:58:07FromDiscord<jmgomez> https://nim-lang.github.io/Nim/manual#implementation-specific-pragmas-codegendecl-pragma
16:59:16FromDiscord<jmgomez> sent a code paste, see https://paste.rs/1yYBH
16:59:31FromDiscord<jmgomez> you can change that template at compile time to put in there what you want
17:00:03FromDiscord<sOkam!> is that not for generating C code?
17:00:32FromDiscord<jmgomez> that will use the template as generator instead of the default Nim generator
17:01:10FromDiscord<sOkam!> if this can be used for generating strings usable within nim to pass as wgsl code, im super lost in how that would work
17:02:00FromDiscord<jmgomez> Maybe I dont understood what you are trying to do then
17:02:34FromDiscord<jmgomez> (edit) "dont" => "didnt"
17:03:03FromDiscord<sOkam!> `wgsl` is a shader lang. i just want to give it the `typedesc[Uniform]` and the proc in question should give me back a string of wgsl code that I can then concatenate into the shader code of the user
17:03:28FromDiscord<sOkam!> `struct` is in C, but its also a keyword in wgsl
17:03:56FromDiscord<jmgomez> ahh you are looking for a Nim backend for wgsl then
17:04:46FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCk
17:04:56FromDiscord<sOkam!> notice that it looks -similar- to C, but its not c
17:05:15FromDiscord<sOkam!> In reply to @jmgomez "ahh you are looking": i want to make one, because it doesn't exist
17:05:39FromDiscord<jmgomez> @treeform has shady https://github.com/treeform/shady/tree/master which may be a good starter point for you
17:05:39FromDiscord<sOkam!> hence why i was looking for a way to get full instrospection on types and fields as strings, to generate the wgsl code
17:06:01FromDiscord<jmgomez> but yeah, you cant access the cgen
17:06:05FromDiscord<sOkam!> yes, but that's overly complex for what I want. i don't want to dissect the entire thing just to make a struct
17:06:29FromDiscord<sOkam!> i don't want to make a full-blown transpiler. i just need the struct definition, and thats it
17:06:42FromDiscord<sOkam!> so its a simple type instrospection, but don't know how to access that data
17:06:43FromDiscord<jmgomez> I mean, that's kinda of trivial if you only have a subset of types
17:07:09FromDiscord<sOkam!> yeah, its all vecN<f32>, f32, int and uint, and thats it
17:07:20FromDiscord<sOkam!> but the amount of them, and the names, are variable
17:07:40FromDiscord<jmgomez> so then create a lookup table and render it to your thing
17:07:57FromDiscord<sOkam!> i still need to instrospect the fields from a typedesc
17:08:02FromDiscord<sOkam!> which is what I don't know how to do
17:08:28FromDiscord<jmgomez> show the code of the type def
17:08:53FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCm
17:09:24FromDiscord<sOkam!> currently simplest possible example, but the amount of fields and name of the type, etc, are variable
17:10:35FromDiscord<jmgomez> but what is your problem exactly?
17:10:51FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCn
17:11:11FromDiscord<sOkam!> `T.name` from typetraits gives me `Uniform`... but what about `time` and `float32`
17:11:31FromDiscord<jmgomez> just do a macro
17:11:46FromDiscord<sOkam!> if i knew how, wouldn't i just do it?
17:11:54FromDiscord<sOkam!> im asking for how that could be found
17:21:37FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCo
17:27:11FromDiscord<sOkam!> can you give an example of how i would access this? đŸ€” https://media.discordapp.net/attachments/371759389889003532/1110982339066089632/image.png
17:33:11*Notxor quit (Remote host closed the connection)
17:33:57FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCq
17:34:29FromDiscord<jmgomez> But I would recomend to handle recList and IdentDefs as a whole as you may encounter different cases
17:34:56FromDiscord<sOkam!> problem is that i don't know how to navigate that tree
17:35:16FromDiscord<jmgomez> well, I just show you you can access the childs with the index
17:35:23FromDiscord<sOkam!> i understand you got `Uniform` by saying `n[0].strval`... but thats just the first item
17:35:31FromDiscord<jmgomez> (edit) "show" => "shown"
17:38:54FromDiscord<jmgomez> again, it's a tree. You can access the childs with their index. You need to play around with them to get familiar but you usually want to check for the kind of node (as I shown above i.e. nnkTypeDef) and some nodes also have str value, of course yo could just do `repr` n and parse it yourself but I wouldnt recommend taking that route
17:39:23FromDiscord<sOkam!> seems like new fields will just be contained in identDefs for this specific case, right? https://media.discordapp.net/attachments/371759389889003532/1110985410001244190/image.png
17:40:12FromDiscord<jmgomez> yes, they are always like that
17:40:29FromDiscord<sOkam!> so reclist[0] will be the first field of the object?
17:40:34FromDiscord<jmgomez> what would change is if it has pragmas or not, if it has "" etc.
17:40:34FromDiscord<sOkam!> etc?
17:40:54FromDiscord<jmgomez> yes
17:41:06FromDiscord<Rika> Like doc comments
17:44:40*krux02_ joined #nim
17:50:47*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
17:51:24*progranner joined #nim
17:51:48FromDiscord<sOkam!> getting somewhere. ty @jmgomez đŸ€˜ https://media.discordapp.net/attachments/371759389889003532/1110988531872043028/image.png
17:59:00FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCs
18:01:42FromDiscord<jmgomez> what error do you have
18:02:59FromDiscord<sOkam!> nothing, just in case there is something obviously wrong in it
18:03:10FromDiscord<jmgomez> if you mean like future problems, what I said before, if you change the way you define your types by removing/adding pragmas or you may run into problems
18:03:23FromDiscord<sOkam!> to me it all looks like mostly `$%@(!($%(!(%`... so I might be missing something crucial
18:05:29*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
18:06:03FromDiscord<sOkam!> can macros contain `int` and `string` inputs?
18:06:14FromDiscord<sOkam!> i remember having issues with those at some point
18:06:28FromDiscord<sOkam!> or was it just templates?
18:08:56FromDiscord<voidwalker> How would I name and call a custom [] or []= proc on an array ? I can't overload it, so it has to have another name
18:09:28Amun-Ra.at?
18:10:10FromDiscord<voidwalker> well, I thought I can somehow use the same [] syntax with some suffix or something
18:10:46FromDiscord<jmgomez> @sOkam! I dont follow what you are saying. NimNodes holds all the information that you need for a small backend. If you mean literals, yes, they can
18:11:26FromDiscord<sOkam!> 👀 very much what i was hoping for achieving https://media.discordapp.net/attachments/371759389889003532/1110993476763529216/image.png
18:12:06*progranner joined #nim
18:12:12FromDiscord<sOkam!> In reply to @jmgomez "<@186489007247589376> I dont follow": yeah, i mean I will need to pass the `groupId` that goes into `@group(id)`... and the variable name chosen
18:12:41FromDiscord<sOkam!> but i remember having issues with passing data into something, maybe it was just templates instead 🐠
18:13:46FromDiscord<jmgomez> think of what you are trying to do as a webserver that renders html, can you put that arbitrary string in the html for the user to see? Then yes, you just need to render it in your "output"
18:14:04FromDiscord<System64 ~ Flandre Scarlet> Does someone knows how I can simulate a proper overflow with float64 please? https://media.discordapp.net/attachments/371759389889003532/1110994137282523167/image.png
18:17:39FromDiscord<jtv> What does that mean? You want a bignum libray?
18:17:45FromDiscord<jtv> (edit) "libray?" => "library?"
18:18:13FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCx
18:18:21FromDiscord<sOkam!> i cannot return a string, or if I can I don't know how
18:19:35FromDiscord<jtv> Macros return nimnodes
18:19:41FromDiscord<sOkam!> Error: type mismatch: got 'string' for 'uniformBlock(typImpl, 0, 0, "u")' but expected 'NimNode = ref NimNodeObj'
18:19:42FromDiscord<jtv> Not strings
18:20:01FromDiscord<jtv> macro() takes parse tree as input and produces parse tree as output
18:20:09FromDiscord<jtv> It's not like template
18:20:26FromDiscord<jmgomez> You may want to save the string that you already have to a file
18:20:29FromDiscord<sOkam!> how do i return the resulting string?
18:20:55FromDiscord<jmgomez> That's your final output
18:21:01FromDiscord<sOkam!> i don't mind storing it in a const. but it needs to exist in the app
18:21:03FromDiscord<jtv> I guess I don't know enough about what you're trying to do. You're trying to have a macro generate code to compute a string at runtime?
18:21:16FromDiscord<jmgomez> You can do that, sure. You can create a const
18:21:32FromDiscord<sOkam!> @jtv doesn't need to be runtime, can be compile time. but the string needs to live in the app in some way
18:21:59FromDiscord<jmgomez> `var shader {.compileTime.} : string` and just assign the value in the macro
18:22:39FromDiscord<sOkam!> that won't fly. what if I pass 10 types?
18:23:08FromDiscord<jtv> So given you're new to macros, the easiest way to get the hang of it is w/ a UI the designers don't love
18:23:23FromDiscord<jmgomez> you make your macro to accept an array of types or you use an intermediate type that holds then and you render them separately
18:23:57*azimut joined #nim
18:23:59FromDiscord<sOkam!> im not following what you mean
18:24:05FromDiscord<jmgomez> or you have a seq[string] instead of string
18:25:03FromDiscord<jmgomez> sent a code paste, see https://paste.rs/0oKIH
18:25:07FromDiscord<jtv> sent a code paste, see https://play.nim-lang.org/#ix=4wCA
18:26:09FromDiscord<jtv> sent a code paste, see https://play.nim-lang.org/#ix=4wCB
18:26:11FromDiscord<jmgomez> I dont think that's too useful to him @jtv as he is just getting started and what he is trying to do is to render the tree not to manipulate. For storage what he is doing is fine
18:26:27FromDiscord<sOkam!> i think thats what i want actually
18:26:39FromDiscord<sOkam!> because i really need access to the variables, and I don't know how many they are
18:26:55FromDiscord<jtv> I just think if you can't get your head wrapped around the fact that you're dealing w/ ASTs, it's closer to the natural comfort level of the average programmer
18:26:55FromDiscord<sOkam!> the output is meant to be concatenated with a runtime string
18:27:35FromDiscord<jtv> You can definitely sub in blocks from one quote block into another with ``
18:27:53FromDiscord<sOkam!> I figure what I should use is a seq[string], though, so it always has the same name
18:28:01FromDiscord<jtv> The issue is all your subs have to be params or local variables or you might end up w/ strange crashes / errors
18:28:10FromDiscord<jtv> Oh, one other thing to note
18:28:21FromDiscord<jmgomez> I mean, I told you it a few lines above but you that IMO is harder to visualise. Also I personally prefer `genAst`
18:28:28FromDiscord<jtv> The types are the RUNTIME type. The input is still a parse tree
18:28:40FromDiscord<jtv> Saying s is a string means the type will be checked for you
18:28:45FromDiscord<jtv> To ensure it's actually a string
18:28:57FromDiscord<sOkam!> i might be missing the points, tbh
18:29:41FromDiscord<jmgomez> I think at this point you have a enough info, the best way to assimilate it is to attempt to do the thing
18:30:05FromDiscord<jtv> macro() basically allows you to rewrite function calls. The input is a tree describing the code at the call site, and the output is a tree describing the code that replaces it.
18:30:40FromDiscord<sOkam!> is `var myBlocks {.compileTime.} :seq[string]` legal code, and then just call for the macro as many times as required at compile time to do `myBlocks.add "someGeneratedCode"`?
18:30:50FromDiscord<jtv> So focusing on the code you want to output and letting the API convert it into nodes is the easiest place to start if you have to use macro()
18:31:10FromDiscord<jtv> If you need to loop, {.compileTime.} isn't going to work for you
18:31:31FromDiscord<sOkam!> then that's the issue i was mentioning
18:32:18FromDiscord<jtv> But, if you want to loop based on the input, you will need to get to know the parse tree
18:33:10FromDiscord<jtv> quote and genAst help make the output nodes more like normal coding, but you'll need to actually look at the parse tree in your code to figure out what to generate
18:33:32FromDiscord<sOkam!> sent a code paste, see https://paste.rs/LLBrx
18:33:51FromDiscord<jmgomez> In reply to @sOkam! "is `var myBlocks {.compileTime.}": yes
18:33:57FromDiscord<jtv> For instance, if you want people to call `my_macro("a", "b", "c"), do you want to enforce that the parameters are string literals? Because it might be a complicated parse tree for a computed string
18:34:00FromDiscord<sOkam!> I guess offloading to the user the requirement to create an array of their types is an option.... but if possible i would prefer to avoid it
18:34:15FromDiscord<jtv> So you need to do validation on the tree that you get.
18:34:59FromDiscord<sOkam!> In reply to @jtv "For instance, if you": not really. the user will just pass the type to the code. then im free to do whatever with the type given
18:35:10FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCD
18:35:18FromDiscord<sOkam!> the codegen and groupid solving etc is up to the library, but the user needs to register their types
18:36:18FromDiscord<sOkam!> In reply to @jmgomez "and you may prefer:": oh so the pragma does the macro call or something?
18:37:03FromDiscord<sOkam!> but you cannot have custom pragmas imported, right? how would that work?
18:37:55FromDiscord<jmgomez> macro calls can be made through pragmas yes, you can see want to check the render tree because it can vary
18:38:13FromDiscord<jmgomez> what do you mean? you can just import the macro
18:38:15FromDiscord<sOkam!> sounds very complex
18:38:21FromDiscord<jmgomez> save it for later
18:38:41FromDiscord<jmgomez> it's easy to change, focus on the content of the macro itself to get it doing what you want
18:38:52FromDiscord<sOkam!> In reply to @jmgomez "what do you mean?": .registerUniform. is a macro used as a pragma ?
18:39:02FromDiscord<jmgomez> yes
18:39:13FromDiscord<sOkam!> thats doable? i didn't even know that was a thing
18:40:00FromDiscord<sOkam!> but yeah, will keep it in mind
18:42:47FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCH
18:43:18FromDiscord<sOkam!> openarray could solve the typedesc list, but each input has 2 ints and a string attached on calling
18:45:37FromDiscord<jmgomez> not sure what you are trying to do, but just in case you can pass your own types. Just make sure to add `static` so you dont get a Nim node
18:47:09FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCI
18:47:41FromDiscord<sOkam!> obviously doesn't work, because macros don't return strings. but that's the goal
18:47:52FromDiscord<sOkam!> I just need to store those strings somewhere accessible at runtime
18:49:16FromDiscord<sOkam!> at runtime, the user will give their shader code (minus the uniforms) and the code generated will be concatenated with the code given by the user at runtime
18:50:07FromDiscord<sOkam!> but really struggling to know how to store the code generated, since you guys said that {.compileTime.} wont work for this
18:50:32*azimut quit (Ping timeout: 240 seconds)
18:50:47FromDiscord<jmgomez> Again, you can use a var as I shown before
18:50:57FromDiscord<demotomohiro> How about to generate a string and return `newLit(mystring)` in a macro?
18:51:31FromDiscord<sOkam!> In reply to @jmgomez "Again, you can use": does that work for seq[string]? i thought you guys said it doesn't\
18:51:32FromDiscord<jmgomez> In reply to @jmgomez "`var shader {.compileTime.} :": this
18:51:39FromDiscord<jmgomez> yeah, it should
18:52:07FromDiscord<sOkam!> someone said it wont, so i was just trusting that. will try it then
18:52:07FromDiscord<System64 ~ Flandre Scarlet> In reply to @jtv "What does that mean?": No no↔I want to simulate overflow wrapping but between -1 and 1
18:55:46FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCN
18:59:08FromDiscord<demotomohiro> In reply to @System64 "No no I want": Do you want 1 + 0.5 -> 1 or 1 + 0.5 -> -0.5 ?
18:59:35*Notxor joined #nim
18:59:43FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCP
19:00:27FromDiscord<sOkam!> how does the user send the type register order, though?
19:01:09FromDiscord<sOkam!> i can do the group+binding ids, but they need to provide the type and a variable name at least
19:01:28FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Do you want 1": The second one
19:02:01FromDiscord<sOkam!> (edit) "register order," => "register,"
19:05:09*lucasta joined #nim
19:08:48FromDiscord<acornes> sent a code paste, see https://play.nim-lang.org/#ix=4wCV
19:09:14FromDiscord<acornes> i dont know if its a name change or something else since the library was last updated 8 years ago
19:13:39FromDiscord<sOkam!> how do you pass an integer to a macro as an integer, and not as a `NimNode`?
19:14:08FromDiscord<jtv> Make it a static parameter
19:14:31FromDiscord<jtv> macro(i: static[int]) = ...
19:14:41FromDiscord<sOkam!> ty
19:14:48FromDiscord<Phil> Cheers everybody, quick question because I'm sick as fuck and currently can't think straight but would like to merge this one PR↔Are there any significant implications of changing seq in a proc param to openArray?↔Like, it should still accept seqs that are filled at runtime with all kinds of lengths, right?
19:14:56FromDiscord<demotomohiro> In reply to @System64 "The second one": https://nim-lang.org/docs/math.html#floorMod%2CT%2CT
19:15:25FromDiscord<jtv> It's not an issue from the caller's POV, Phil
19:15:40FromDiscord<demotomohiro> In reply to @acornes "does anyone know what": If it is a module provides windows API, use winlean module in stdlib or winim.
19:16:11FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCY
19:17:12FromDiscord<acornes> In reply to @demotomohiro "If it is a": oh alright thanks, the library no longer works so ill have to figure out how to make one myself
19:17:15FromDiscord<sOkam!> @jmgomez seems like seq[string] doesnt work in compiletime after all, for whatev reason đŸ€·â€â™‚ïž
19:19:15FromDiscord<jtv> Well, you can use seqs of strings at compile time. You can't assign to a seq[string] that becomes available at runtime though if that's what you're trying to do. You can have your code generate code that uses seq[string]...
19:19:33FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "https://nim-lang.org/docs/math.html#floorMod%2CT%2C": Will check this↔Btw, I want it to be able to pass through 0 too
19:19:50FromDiscord<System64 ~ Flandre Scarlet> Seems not the case here https://media.discordapp.net/attachments/371759389889003532/1111010689545408572/image.png
19:20:06FromDiscord<jmgomez> In reply to @sOkam! "<@726017160115126333> seems like seq[string]": again, you add things to it and then you reduce it as last thing from static or another macro call
19:20:12FromDiscord<sOkam!> In reply to @jtv "Well, you can use": i would honestly just return the string and store it in a const or whatev. but i don't know how. so im trying to navigate around it with my noob knowledge
19:20:15FromDiscord<jmgomez> (edit) removed "static"
19:20:20FromDiscord<jmgomez> (edit) removed "or"
19:21:31FromDiscord<jtv> macros are mind bending, because you're writing code that has a run time, but is considered "static" because that runtime is when compiling other code. Your macro generates some of that code, and then that runs. It's confusing for most people to keep track of when the code their writing runs, when it is being generated, and when it isn't
19:23:11FromDiscord<sOkam!> i get that. but i cannot get the macro to generate something that I store in some way so that I can access it
19:23:28FromDiscord<sOkam!> it can echo just fine, but the information is gone
19:23:37FromDiscord<jtv> Here's what you might find helpful. Write up an example of code you would like it to generate.
19:23:46FromDiscord<jtv> With no macros.
19:23:49FromDiscord<jtv> Then get that working
19:24:11FromDiscord<jtv> Once you do, write the code you want to be ABLE to write w/ macros that should lead to the result.
19:24:34FromDiscord<jtv> If you have those two anchor points, the rest will be easy, and if not, it'll be much easier for people to give you specific and accurate help
19:25:13FromDiscord<sOkam!> how do you create code that does what i need, without it being a macro, considering the code requires type introspection?
19:25:52FromDiscord<sOkam!> that was the original question. how to access fields/types inside a typedesc, given its typedesc and not a variable
19:26:37FromDiscord<jtv> Just come up with ONE instance of what you want someone to be able to input, then write the code that should actually run when the macros are evaluated
19:27:17FromDiscord<jtv> Then you figure out how to programmatically make the mapping as people come in with different inputs
19:27:31FromDiscord<sOkam!> thats already done
19:27:41FromDiscord<sOkam!> the code is generating, given the input
19:27:48FromDiscord<sOkam!> what i cannot do is -store- that information
19:28:50FromDiscord<jtv> "store"?? The executable has machine code resulting from the compilation process. The parse nodes get transformed into the stored output in the object code.
19:29:30FromDiscord<jtv> If you're trying to do something more dynamic, you will need to generate code that gives you that information at run time.
19:29:52FromDiscord<sOkam!> and that brings us back to the original question
19:30:07FromDiscord<sOkam!> how do you access field information given a typedesc and not a variable
19:30:19FromDiscord<sOkam!> you can do `$type`... but not `$field`
19:30:23FromDiscord<jtv> You do not, there is no runtime type information.
19:30:28FromDiscord<sOkam!> (edit) "`$field`" => "`$type.field`"
19:30:29FromDiscord<jtv> Not full type info anyway
19:30:52FromDiscord<sOkam!> then what you are saying either has a logic gap, or im big slow
19:31:02FromDiscord<jtv> You can keep a string version of it that you stash at compile time, but it won't always be what you want
19:31:10FromDiscord<sOkam!> because i need field information to generate the code
19:31:24FromDiscord<sOkam!> but then we go back to compile time, and the code is gone after code is gen
19:31:49FromDiscord<jtv> No, the code generation has access to type information, but the output of the macro, the code that it produces, will not.
19:32:06FromDiscord<jtv> Right, the code generation code isn't kept around for the runtime
19:33:07*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
19:33:35FromDiscord<jtv> The problems people have getting their heads wrapped around macros here is changing my mind on macros being a good addition to a language. I think Nim's got a great implementation and any compiler writer would love it, but it's really alien to most people .
19:33:38*progranner joined #nim
19:34:04FromDiscord<sOkam!> i think im currently past that point
19:34:16FromDiscord<demotomohiro> In reply to @System64 "Will check this Btw,": Then, try `floorMod(x + 1, 2) - 1`.
19:34:17FromDiscord<sOkam!> I just need the data not lost, that's all. but seq[string] doesn't work
19:34:41FromDiscord<jtv> Well, your thinking on what's happening when is clearly muddled.
19:34:51*progranner quit (Client Quit)
19:35:23FromDiscord<jtv> If you need access to some string at run-time, you generate a declaration for a seq[string] at compile time that's available at runtime. shrug
19:35:41FromDiscord<Graveflo> Are you trying to populate the data at compile time and the read it at run time?
19:36:02FromDiscord<sOkam!> In reply to @Graveflo "Are you trying to": yeah
19:36:15FromDiscord<sOkam!> i just need that compile data stored in somewhere I can later on read
19:36:18FromDiscord<Graveflo> because if so you need some code at compile time that will in effect "trap" the data as it is generated at compile time and serve it statically to the code at run time
19:36:25*progranner joined #nim
19:36:58FromDiscord<Graveflo> the list starts empty at both compile time and run time. They are not the same. You must generate a proc (or something) that is generated at compile time that spits out the state of the list as it is populated at compile time in order to access it at run time
19:37:57FromDiscord<Graveflo> no make a macro that will create a list and make the nim nodes that will add static content to the list based on the data contained in the compile time list
19:38:15FromDiscord<Graveflo> this will re-generate the list a runtime by trapping the contents
19:39:00FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Then, try `floorMod(x +": The thing is the input can be something like - 4 to 4↔Or -1000 to 1000
19:40:37FromDiscord<demotomohiro> In reply to @System64 "The thing is the": `floorMod(x/4 + 1, 2) - 1` if input is -4 to 4.
19:41:53FromDiscord<jtv> "re-generate a list at runtime by trapping the contents?" That doesn't compile for me. At compile time, you can generate a static seq[string] declaration, you can generate code to compute at runtime, you can do whatever you want. The two macro invocation has a totally separate runtime context (global vars, in particular) from the runtime being generated, and that's the big point of confusion for him I think
19:41:55FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "`floorMod(x/4 + 1, 2)": I can't predict the input
19:43:07FromDiscord<jtv> You said it could be anything, so it's between low(int) and high(int), inclusive, no??
19:44:05FromDiscord<Graveflo> by this I'm saying that the seq will be populated at the end of compile time but that does not mean that it magically exists at run time. The computer needs to rebuild the seq as it were at compile time each time the program runs, thus you need to create logic that reconstructs the seq at runtime
19:45:36FromDiscord<jtv> This is why the clear-headed way to approach macros until you get the hang of it is to write some example code WITHOUT macros, and then write the code that generates all the code you might possibly want.
19:46:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @jtv "You said it could": Yes↔But I'd need to do a buffer then, no?
19:47:24FromDiscord<jtv> Do replace 4 with high(int)?
19:49:06FromDiscord<jtv> I mean, scaling an integer to a float is straightforward thing. It's important to note that not every possible integer will map to a unique floating point value in that world.
19:50:13FromDiscord<System64 ~ Flandre Scarlet> Or maybe I can scale to like - 32k +32k?
19:50:52FromDiscord<System64 ~ Flandre Scarlet> And then use an AND?
19:51:05FromDiscord<jtv> You will never get a one-to-one mapping, because of the way floats work.
19:52:28FromDiscord<jtv> They generally aren't meant to have full precision. They can handle numbers much larger than high(int), but they don't represent every number. You're expected not to need that much precision (which is something we have to deal with for irrational numbers anyway)
19:53:32FromDiscord<System64 ~ Flandre Scarlet> So what can I do?
19:54:39FromDiscord<jtv> Divide by 1/high(int), special case 0, and accept your lack of precision?
19:55:14FromDiscord<jtv> Or just leave it an int, that's the point where it has not lost any precision 🙂
19:56:08FromDiscord<System64 ~ Flandre Scarlet> Isn't float better for trigonometric stuff?
19:57:02FromDiscord<jtv> If you want to minimize lack of precision, use a bignum library
19:58:14FromDiscord<System64 ~ Flandre Scarlet> And aren't floats very precise with small numbers?
19:59:02FromDiscord<jtv> Yes, but very imprecise with large ones. ints have even spacing between numbers 🙂
20:00:13FromDiscord<System64 ~ Flandre Scarlet> And ints are faster I think
20:01:17FromDiscord<jtv> Well that's just not meaningfully true enough to make a difference in the real world, and can be wrong in some cases. Use whichever representation is more appropriate.
20:02:49FromDiscord<JJ> so curious about arc/orc - i'm trying to understand how it avoids atomic rc. as i understand it it can determine "isolated" data to move across threads? but then has to fall back on atomic rc for shared data?
20:02:56FromDiscord<jtv> FPUs definitely take up more dye space, and on an idle machine will be a bit slower per op, but there are other considerations that are more likely to impact performance depending on the chipset and code
20:03:14FromDiscord<JJ> is that right, and then if so does the compiler do it all behind the scenes with `ref`?
20:03:17FromDiscord<System64 ~ Flandre Scarlet> In reply to @System64 "Seems not the case": And is this overflow accurate to what can happen with integers?
20:03:54FromDiscord<mratsim> In reply to @apropos "is that right, and": atomic rc is opt-in
20:04:33FromDiscord<mratsim> you need to import the threading package, or in devel there is an experimental switch to make all your ref atomicRef
20:04:59FromDiscord<JJ> In reply to @mratsim "atomic rc is opt-in": but necessary for shared threaded data?
20:05:37FromDiscord<Elegantbeef> Not technically if you use cursor annotations and ensure only a single thread owns the data, but that's too silly to do practically
20:06:08FromDiscord<mratsim> In reply to @System64 "And ints are faster": it really depends. some stuff are slow for integer, like you can only do 1 multiplication per cycle while you can do at least to for floats.
20:06:39FromDiscord<mratsim> In reply to @apropos "but necessary for shared": no, there are domains where data access is embarassingly parallel, like most matrix operations
20:09:26FromDiscord<JJ> would a cursor annotation not make it unsafe, even with a single thread owning the data? i don't see how that avoids race conditions
20:09:27FromDiscord<jtv> Yeah, modern GPUs are going to do certain kinds of FPU ops way faster than a general purpose CPU does int ops. Sure, if you only isolate any one op... floats are more complicated. But that's not how the real world works.
20:09:40FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wDa
20:10:51FromDiscord<Elegantbeef> Jesus we're using astgenrepr i see
20:11:31FromDiscord<Graveflo> yea i haven't got my macro building skills in order yet. This is the only way i know how to make them LOL. links appreciated if there are good guides.
20:11:44FromDiscord<Elegantbeef> `genast` and `quote`
20:11:50FromDiscord<Elegantbeef> https://dev.to/beef331/demystification-of-macros-in-nim-13n8
20:12:09FromDiscord<jtv> Yeah, I really don't like code that's not meant to be comprehensible to the average reader. You might as well be writing Rust.
20:13:40*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
20:13:48FromDiscord<Elegantbeef> Quasi quoting is really good for macros
20:14:47FromDiscord<sOkam!> i think i might move to runtime variables and getting the data from those instead. because this macro thing is not really working, when we get the user of the lib into account
20:16:53FromDiscord<sOkam!> type required to be correct, then assert for type size, then get each of the field names of the variable and their types, the type of the variable itself, and create a seq of the data so the runtime can do something appropriate with it↔sounds like a variable job, more than a typedesc job
20:20:13FromDiscord<Nerve> When you get the urge to use macros, just stop and ask yourself: Do I really need to? (Also macros seem not to compose well, every show-stopping issue I've had with compilation has been templates or macros being called within each other, leading to generated code operating on generated code and hellish debugging, where the solution was always to just back away and use normal runtime code.)
20:20:34FromDiscord<Elegantbeef> Macros compose fine
20:20:56FromDiscord<Nerve> I should add that don't have as much experience with Nim macros as with Lisp macros
20:21:14FromDiscord<Nerve> But I had a showstopper with calling Nimja templates within a templated proc
20:21:17FromDiscord<Elegantbeef> I should say typed macros compose fine
20:21:38FromDiscord<Elegantbeef> Untyped macros generally do not cause they do not expand the internal code before running
20:23:36FromDiscord<Elegantbeef> It also depends what you're doing with a macro, no clue what sokam needs here
20:26:11FromDiscord<sOkam!> In reply to @Elegantbeef "It also depends what": bindgroups need to be specified into the pipeline at runtime↔so the user needs to be able to add uniforms to the code, but if I hardcode the accesible uniforms then thats out of question↔i was thinking of a way to not hardcode that, by allowing the user to pass a type (or a variable) to register it as a uniform block, and generate the code for it because otherwise I need to parse the w
20:26:23*progranner joined #nim
20:26:49FromDiscord<sOkam!> so the idea was to generate the wgls myself instead, so that i can just parametrically add those to the shader based on what the pipeline setup required
20:27:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wDf
20:27:33FromDiscord<sOkam!> otherwise, the pipeline creation setup becomes a mess, and the responsability needs to be sent to the user, and that's not gud
20:27:34FromDiscord<Elegantbeef> `in default(t).fields`
20:27:53FromDiscord<sOkam!> oh neat idea
20:28:04FromDiscord<Elegantbeef> That doesnt work for variants
20:28:13FromDiscord<Elegantbeef> But it's not like you're sending variants to the gpu
20:28:21FromDiscord<sOkam!> types have strict requirements anyway for wgpu sending
20:28:29FromDiscord<sOkam!> so shoudln't be an issue
20:28:44FromDiscord<Elegantbeef> A concept would be nice though
20:29:25FromDiscord<sOkam!> can a concept restrict the alignment of a proc?
20:29:37FromDiscord<sOkam!> or how would you do the restrictions?
20:29:43FromDiscord<Elegantbeef> "alignment of a proc"?
20:29:52FromDiscord<sOkam!> of a type sry
20:29:55FromDiscord<sOkam!> typo
20:30:10FromDiscord<Elegantbeef> I was meaning on making a macro handle automatically aligning to std430 for opengl
20:30:16FromDiscord<Elegantbeef> But yea there is no automatic alignment
20:30:19FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wDg
20:30:22FromDiscord<Elegantbeef> You can technically check allignment
20:30:29FromDiscord<Elegantbeef> SInce you can get the offset of fields
20:30:50FromDiscord<sOkam!> oh true
20:31:36FromDiscord<sOkam!> btw, how do you get the name of a field inside a variable of that type?
20:31:51FromDiscord<Elegantbeef> Hackily
20:32:49FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wDh
20:33:11FromDiscord<Elegantbeef> You use a macro to break apart the dotexpr
20:33:33FromDiscord<sOkam!> arent macros compile-time only?
20:33:34FromDiscord<Elegantbeef> It's a single line macro and I trust if you read my macro tutorial you can do it
20:33:43FromDiscord<Elegantbeef> All of this is compile time only?
20:33:55FromDiscord<Elegantbeef> `typedesc` isnt a runtime value
20:34:05FromDiscord<sOkam!> but im talking about getting it from a variable
20:34:19FromDiscord<sOkam!> F typedesc, its too annoying, and not even what i need Im afraid
20:34:21FromDiscord<Elegantbeef> no you're talking about getting it from a static address
20:34:35FromDiscord<sOkam!> var thing is static?
20:34:38FromDiscord<Elegantbeef> `thing` is a variable that points to a type `Thing`
20:34:48FromDiscord<Elegantbeef> `Thing.someName` is static
20:35:15FromDiscord<sOkam!> but thing.someName isnt, right?
20:35:21FromDiscord<Elegantbeef> It still is
20:35:26FromDiscord<Elegantbeef> `someName` is a field access
20:35:33FromDiscord<Elegantbeef> It's a static offset and name
20:35:48FromDiscord<Graveflo> sent a code paste, see https://paste.rs/hxK83
20:36:25FromDiscord<sOkam!> In reply to @Elegantbeef "It's a static offset": so you are saying its not possible to get the name of a variable at runtime?
20:36:36FromDiscord<Elegantbeef> Of course not variable names don't exist at runtime
20:36:58FromDiscord<sOkam!> well, thats a huge issue then
20:37:07FromDiscord<Elegantbeef> Why is it?
20:37:22FromDiscord<sOkam!> because back to the conversation of tens of messages back a while ago
20:37:36FromDiscord<Elegantbeef> You want to pass a user type to code that does stuff
20:37:45FromDiscord<Elegantbeef> Why do you need to get a variable name at runtime
20:37:52FromDiscord<Elegantbeef> It's not going to suddenly change
20:38:01FromDiscord<Elegantbeef> You passed a type to a procedure it's statically typed
20:38:11FromDiscord<sOkam!> because at runtime is when the pipeline is generated, and thats the part that requires the data
20:38:12FromDiscord<Elegantbeef> You can get the variable name at compile time and use it at runtime
20:38:18FromDiscord<sOkam!> but if compiletime is gone, the data is gone
20:38:40FromDiscord<Elegantbeef> You're funny
20:38:41FromDiscord<jtv> If you're saying you're dynamically loading modules, those modules were statically created, right?
20:38:46FromDiscord<Elegantbeef> you can do `echo $int` right?
20:39:01FromDiscord<sOkam!> In reply to @jtv "If you're saying you're": -part- of the module
20:39:15FromDiscord<Elegantbeef> `int` is a compile time value that `$` converts to a string and it emits a static string `"int"` in your code
20:39:16FromDiscord<jtv> You generate a variable with the name in it if you need to
20:40:08FromDiscord<jtv> So "part" of the module doesn't make sense in a compiled language, that's not how dynamic loading generally is done on the major OSes
20:40:32FromDiscord<sOkam!> `var pipeline = createPipeline( uniformcode & shaderCode )`↔that uniform code needs to exist, and it doesn't matter where it comes from (compiletime is fine) but... runtime code can change, and its meant to be passed at runtime and concatenated. and pipeline -cannot- be compiletime at all
20:40:59FromDiscord<Elegantbeef> So create the unform code at compile time
20:41:13FromDiscord<jtv> I really recommend you stay away from macros, I think the amount of work you'd have to do to really understand the computation model under the hood is very high, and it's unclear you will be better off
20:41:14FromDiscord<Elegantbeef> store it in a variable
20:41:15FromDiscord<Elegantbeef> Then concatenate it
20:41:24FromDiscord<sOkam!> yeah, that was the conversation of a while ago
20:41:36FromDiscord<Elegantbeef> You do not need to get a variable at runtime
20:41:41FromDiscord<sOkam!> how do you store the data at compiletime, because i have the string of code generated but i cannot store it
20:41:43FromDiscord<jmgomez> He had it already almost working but suddenly gave up
20:41:45FromDiscord<Elegantbeef> You have one of the best compile time evaluation languages
20:42:25FromDiscord<Graveflo> In reply to @sOkam! "how do you store": I'm not saying this is the way to go. But I did demonstrate how to capture compile time data and access it at run time if that is really what you want to do
20:42:51FromDiscord<mratsim> In reply to @apropos "would a cursor annotation": one thread may own the data, but multiple thread can mutate it as long as the algorithm (say a parallel for) guarantees that there is no data race.
20:43:09FromDiscord<mratsim> In reply to @sOkam! "how do you store": you use a `const`
20:43:15FromDiscord<sOkam!> the user passes two variables, for example. both are the same type, and have different names but same type↔the code is obviously compiletime, since its nim and its compiled↔but how do i get that generated data and use it in the pipeline generation?
20:43:56FromDiscord<jtv> This is hours of going around in circles 🙂
20:44:17FromDiscord<sOkam!> thats my dumb brain. literally ignore me if you get annoyed by it
20:44:28FromDiscord<sOkam!> i fucking struggle, im just doing my best to not fail at things when i learn
20:44:38FromDiscord<jtv> Write the code without macros. You'll end up with cleaner code. Then when you're happy with it, maybe consider asking for help lifting things into macros.
20:44:49FromDiscord<mratsim> In reply to @sOkam! "the user passes two": I don't get what the problem is?↔↔you pass the data as input to createPipeline, does it disappear? there were bugs with const variants
20:45:13FromDiscord<jmgomez> In reply to @jtv "Write the code without": Create a NimType that holds the types at runtime
20:45:24FromDiscord<sOkam!> In reply to @jtv "Write the code without": can you stop with that please? static data cannot be accessed at runtime, like it was proven and also beef already confirmed
20:45:28FromDiscord<jtv> Once you have the working system, using macros to make it more compact and expressive will be much easier to grok because it will already work
20:45:33FromDiscord<jmgomez> And then it's trivial to convert Nodes into that
20:46:05FromDiscord<Elegantbeef> Generated data can be accessed at runtime if it's stored at compile time
20:46:53FromDiscord<jmgomez> Yeah, we told him multiple ways to go about it but I think jtv is right, it's better to just do what he wants at runtime. Having an intermediate type will be easier to understand anyways
20:46:59FromDiscord<jtv> Well, you can do that, if you want to recreate all the bits of Nim's type system you need, for sure. I think there's an "Any" type that might be good enough for some needs there
20:47:04FromDiscord<sOkam!> In reply to @mratsim "I don't get what": the problem is in the stupid dumb details of -how- to store the data that is created at runtime↔I will technically have something like a seq[(string, string)], and that needs to be accessed at runtime↔what im struggling hard is with passing the data from compiletime to runtime
20:47:46FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wDm
20:47:56FromDiscord<jmgomez> In reply to @jtv "Well, you can do": he is just trying to do render basic structs
20:48:10FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4wDn
20:48:17FromDiscord<Elegantbeef> There we go
20:48:41FromDiscord<mratsim> In reply to @sOkam! "the problem is in": static objects can be stored in const, const are available at runtime
20:49:59FromDiscord<jtv> If he's having such a hard time understanding that you make things available at runtime by generating the code to declare / calculate things at runtime, despite several people explaining it as clearly as you could imagine, I think he's better off skipping macros. They're not intuitive or easy if you're not in the right headspace for them.
20:51:25FromDiscord<ElegantBeef> Bridge dieded
20:51:57FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=4wDo
20:52:09FromDiscord<ElegantBeef> I mean I showed a procedure that does just what they want 😄
20:52:25FromDiscord<mratsim> (edit) "https://play.nim-lang.org/#ix=4wDo" => "https://play.nim-lang.org/#ix=4wDp"
20:52:43FromDiscord<jtv> Yeah and it's good code, the problem is he's not going to understand it easily, and working with it is going to be pain for him, and lead to bad code
20:52:45FromDiscord<ElegantBeef> Technically it does it at runtime, but it's possible to do `var struct = static: generateGlslStruct(MyType)`
20:53:14FromDiscord<mratsim> or tag the proc {.compileTime.} or return a static MyType
20:53:31FromDiscord<ElegantBeef> Yea there are plenty of ways
20:53:45FromDiscord<mratsim> or const struct =
20:53:55FromDiscord<ElegantBeef> Point is with Nim's great compile time evaluation you can evaluate code statically and return it and just use it at runtime
20:55:09FromDiscord<ElegantBeef> As an aside I really need to make a `type Std430 = concept type S` 😄
20:55:27*derpydoo joined #nim
20:55:49FromDiscord<ElegantBeef> Mratsim do you by any chance understanding the alignment there? I think it's "All primitives are aligned/padded as they are in C, except Vec3"
20:56:08FromDiscord<Graveflo> sent a long message, see http://ix.io/4wDr
20:56:35FromDiscord<ElegantBeef> > This layout works like std140, except with a few optimizations in the alignment and strides for arrays and structs of scalars and vector elements (except for vec3 elements, which remain unchanged from std140). Specifically, they are no longer rounded up to a multiple of 16 bytes. So an array of `float`s will match with a C++ array of `float`s. ↔Atleast it sounds that way
20:56:43FromDiscord<sOkam!> In reply to @mratsim "static objects can be": that has been repeated like ten times. and like i said, i struggle with the -how- not with the -what-↔i understood the issue like the first time. that doens't mean i can execute the soltuion like @jtv is implying i magically should
20:56:48FromDiscord<mratsim> In reply to @ElegantBeef "Mratsim do you by": Vec3? is that a glsl specificity?
20:56:59FromDiscord<sOkam!> but im just getting trigggered by this point, so ill shut up now. thanks for all the help
20:57:07FromDiscord<sOkam!> and sorry for my hardcore stupidity
20:57:11FromDiscord<ElegantBeef> Yea I think all primitives are C alignment but vec3 is 16 bytes
20:57:12FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=4wDs
20:57:26FromDiscord<jtv> I'm saying you don't have the understanding you think you do.
20:57:27FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wDt
20:57:31FromDiscord<mratsim> In reply to @ElegantBeef "Yea I think all": probably for SSE since SSE alignment is 16 bytes
20:57:57FromDiscord<mratsim> In reply to @sOkam! "the string is gen": `const foo = myMacro(param0, param1)`
20:58:05FromDiscord<ElegantBeef> Comically it's suggested never use vec3 due to that layout
20:58:16FromDiscord<sOkam!> In reply to @jtv "I'm saying you don't": and im continuosly saying i understand nothing, and you keep implying that im not understanding when im not saying i do. but end of the discussion, for real
20:58:22FromDiscord<ElegantBeef> A macro is really just a static procedure
20:58:26FromDiscord<sOkam!> its a useless debate
20:58:53FromDiscord<sOkam!> In reply to @mratsim "`const foo = myMacro(param0,": how do macros return the valid data?
20:59:00FromDiscord<ElegantBeef> `newLit yourString`
20:59:06FromDiscord<sOkam!> that was the showstopper. i tried to return a string but couldnt
20:59:07FromDiscord<ElegantBeef> The same I do as `name` in that code i shared
20:59:15*advesperacit quit ()
20:59:34FromDiscord<sOkam!> In reply to @ElegantBeef "`newLit yourString`": that was literally all I was asking about since forever. ty beef 🙏 🙏 🙏 🙏
21:01:19FromDiscord<jtv> Well, that's not really "returning data", that's turning a value into a parse node, which we did try to help on
21:01:21FromDiscord<ElegantBeef> You also likely do not need a macro to do what you want
21:01:37FromDiscord<ElegantBeef> As shown with my `generateGlslStruct` proc
21:03:11FromDiscord<sOkam!> yeah will definitely check it out, since its doing all the checks i wanted to do too as extra
21:03:29FromDiscord<ElegantBeef> Well it's not cause I never implemented the alignment check
21:03:31FromDiscord<Graveflo> the thing is that he had code that was accessing the "name" just fine. It's just his macro didn't generate the AST that spit out the data he wanted. I think he is just missing how macros kinda "inject" ast into where they are called from
21:07:55FromDiscord<sOkam!> In reply to @ElegantBeef "`newLit yourString`": would this be valid if assigning to a `const thing = ?`
21:08:40FromDiscord<sOkam!> im getting that the expression of type string needs to be used or discarded đŸ€”
21:09:24FromDiscord<jtv> Print out the code you're generating
21:09:38FromDiscord<jtv> Try to compile it manually if need be
21:13:26FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wDw
21:13:44FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4wDw" => "https://play.nim-lang.org/#ix=4wDx"
21:14:53FromDiscord<jtv> You definitely need to print out the generate code. From that, your macro is generating code that is simply a literal consisting of the parameter you passed, and nothing else.
21:17:09FromDiscord<jtv> So that might be what you're looking for, but if you ever compute a string and don't use the result you'll get that error
21:17:57FromDiscord<ElegantBeef> Does your macro return `untyped`?
21:18:24FromDiscord<sOkam!> In reply to @ElegantBeef "Does your macro return": implied return, because i don't know what to change it to and thats what the previous help wrote
21:18:35FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wDy
21:18:37FromDiscord<ElegantBeef> `macro name(...): untyped`
21:19:24FromDiscord<sOkam!> In reply to @ElegantBeef "`macro name(...): untyped`": that was it, yep. ty
21:26:26*disso-peach joined #nim
21:28:26*arkurious quit (Quit: Leaving)
21:38:31ntatHow can I find indexes if a is in b? https://play.nim-lang.org/#ix=4wDB
21:39:05FromDiscord<jtv> Iterate through a and call find on each element in a
21:48:44FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wDF
21:49:06FromDiscord<jmgomez> ah, and default constructor if not specified
21:51:36*ntat quit (Quit: Leaving)
22:13:38*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
22:20:40*Notxor quit (Remote host closed the connection)
22:56:04FromDiscord<JJ> In reply to @mratsim "one thread may own": hmm that sounds fancy. i'd be interested to see how the compiler can decide which algorithms are safe and which are unsafe
23:38:48FromDiscord<Arvin❓> How the g can i statically link a dll to an exe in Nim?
23:40:09*disso-peach quit (Quit: Leaving)
23:40:28FromDiscord<Elegantbeef> You cannot statically link a dll
23:40:34FromDiscord<Elegantbeef> You statically link a static library
23:45:01FromDiscord<Arvin❓> Oh
23:45:13FromDiscord<Arvin❓> How?
23:45:34FromDiscord<Arvin❓> -dynlibOverride?
23:47:21FromDiscord<Elegantbeef> Yea that's one parat
23:47:23FromDiscord<Elegantbeef> part\
23:47:52FromDiscord<Elegantbeef> you override the dll then you use `--passL:"-static -LyourLibPath -lyourLib"` to link the specific static library
23:48:35FromDiscord<Arvin❓> Thanks