00:00:14 | FromDiscord | <Elegantbeef> I really have started loving tuples after writing my ECS using them |
00:00:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wyz |
00:00:47 | FromDiscord | <Elegantbeef> Replace all the logic that makes sense there with your code |
00:01:30 | FromDiscord | <Elegantbeef> UiElements is a simple concept that ensures that it's a tuple and all entries are `UiElement` derived |
00:02:31 | FromDiscord | <Ayy Lmao> Is there a difference between using a concept as a function argument vs using it with a generic like that? |
00:02:49 | FromDiscord | <Elegantbeef> Might have been a concept bug, might have been old code |
00:03:18 | FromDiscord | <Elegantbeef> In my case with all these generics with inheritance trees it was a bit confusing what was going where |
00:03:41 | FromDiscord | <Elegantbeef> It's supposed to be raised the same as a parameter |
00:04:18 | FromDiscord | <Elegantbeef> Ok yea seems like it's a mild concept bug with tuples |
00:04:54 | FromDiscord | <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:19 | FromDiscord | <Elegantbeef> Yea the `[]` doesnt work on the concept |
00:05:42 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> So it might be a concept bug it might be sensible |
00:06:09 | FromDiscord | <Elegantbeef> eitherway turning it to a generic constraint means the type we get is the tuple instead of the concept |
00:06:44 | FromDiscord | <Elegantbeef> Constraining a generic parameter to the concept is almost always what you want |
00:07:01 | FromDiscord | <Elegantbeef> `$typeof(ui)` otherwise prints `UiElements` instead of the underlying type |
00:07:21 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> Probably, one could argue implicit generics are bad(araq does) |
00:08:51 | FromDiscord | <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:06 | FromDiscord | <Elegantbeef> Right and I mostly gave that to you |
00:09:16 | FromDiscord | <Elegantbeef> `ApiPlugin` is the only type they deal with đ |
00:10:11 | FromDiscord | <Elegantbeef> `plug =...` and `plug.process` is simulating the DLL existing |
00:10:15 | FromDiscord | <Elegantbeef> well program existing |
00:10:24 | FromDiscord | <Ayy Lmao> Hmm so I suppose ApiPlugin would be some sort of generic plugin then? |
00:10:48 | FromDiscord | <Elegantbeef> Yea you could make it `UserPluginBase[T] = ref object of X` |
00:10:58 | FromDiscord | <Elegantbeef> Oh god we're falling into the same pattern that my UI uses |
00:11:20 | FromDiscord | <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:20 | FromDiscord | <Ayy Lmao> Well it must be a good pattern then |
00:11:55 | FromDiscord | <Elegantbeef> It's practically using generics as a type of dependency injection, and people love dependency injection |
00:12:26 | FromDiscord | <Ayy Lmao> That definitely sounds like what I want. |
00:13:11 | FromDiscord | <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:29 | FromDiscord | <Elegantbeef> This way backends are explicit on usage and not altogether in one spot |
00:13:49 | FromDiscord | <Ayy Lmao> Yeah I definitely would want different backends in different files. |
00:13:50 | FromDiscord | <Elegantbeef> Without using a generic for a UserPluginBase |
00:14:06 | FromDiscord | <Elegantbeef> If it's always a pointer what I said is a good idea |
00:14:29 | FromDiscord | <Elegantbeef> Otherwise a generic is your best bet, but this means you have a shared`UserPluginType[T]` with exported internal fields |
00:14:58 | FromDiscord | <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:51 | FromDiscord | <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:03 | FromDiscord | <Ayy Lmao> I'll take some time and digest everything you said and see if I can get something working. |
00:17:13 | FromDiscord | <Elegantbeef> Anywho I've given you a lot of information, so best to cement it .... yea you got it đ |
00:20:27 | FromDiscord | <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:21 | FromDiscord | <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:25 | FromDiscord | <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:26 | FromDiscord | <Elegantbeef> They're saying use that module to implement it |
02:10:40 | FromDiscord | <Elegantbeef> Dont think so |
02:10:55 | FromDiscord | <treeform> I should probably PR to add that. |
02:11:02 | FromDiscord | <treeform> It comes up all the time. |
02:15:46 | FromDiscord | <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:44 | FromDiscord | <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:54 | NimEventer | New 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:02 | FromDiscord | <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:58 | FromDiscord | <Arathanis> In reply to @treeform "I have created deleteFirst/delFirst": pretty sure its in https://nim-lang.org/docs/deques.html |
03:48:18 | FromDiscord | <Arathanis> they are optimized for addition/removal on both ends |
03:48:29 | FromDiscord | <Arathanis> in this case its popFirst |
03:49:24 | FromDiscord | <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:42 | FromDiscord | <treeform> Queues have some thing else. |
03:51:33 | * | lucasta quit (Quit: Leaving) |
03:51:49 | FromDiscord | <treeform> I just want python's remove: https://www.programiz.com/python-programming/methods/list/remove |
03:51:52 | FromDiscord | <treeform> but in Nim |
03:53:49 | FromDiscord | <Elegantbeef> @Arathanis\: treeform wants a search and removal of the first instance of avalue |
03:55:17 | FromDiscord | <Arathanis> ohhh got it got git |
03:55:32 | FromDiscord | <Arathanis> i hear delFirst and think its popping off index 0 |
03:55:42 | FromDiscord | <Arathanis> but they want to remove the first instant of an element |
03:55:47 | FromDiscord | <Arathanis> (edit) "instant" => "instance" |
04:16:39 | FromDiscord | <Rika> Isnât this just find + delete |
04:38:47 | * | derpydoo quit (Ping timeout: 240 seconds) |
04:56:03 | FromDiscord | <spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4wz3 |
04:56:23 | FromDiscord | <Elegantbeef> you allocate teh array using `create` or `alloc` |
04:57:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wz5 |
04:57:20 | FromDiscord | <Elegantbeef> Ah this is likely different |
04:58:23 | FromDiscord | <Elegantbeef> We do not need to use manual allocation here |
04:58:46 | FromDiscord | <spotlightkid> Here's C code using this function\: https://github.com/jackaudio/jack-example-tools/blob/main/tools/property.c#L291 |
04:59:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wz6 |
04:59:34 | FromDiscord | <Elegantbeef> Such a cursed API |
05:00:27 | FromDiscord | <Elegantbeef> Oh wait I see how it works |
05:00:27 | FromDiscord | <Elegantbeef> You do not need to allocate got it |
05:04:20 | FromDiscord | <spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4wz8 |
05:05:15 | FromDiscord | <Elegantbeef> It likely should be `var ptr UncheckedArray[T]` |
05:05:18 | FromDiscord | <spotlightkid> (I am fairly new to Nim and I am still learning about its type system and its memeory managemnt) |
05:06:56 | FromDiscord | <Elegantbeef> Is `jack_description` a pointer type? |
05:07:40 | FromDiscord | <Elegantbeef> Ah found the source it's not |
05:08:04 | FromDiscord | <spotlightkid> No, its struct |
05:08:36 | FromDiscord | <Elegantbeef> Oh I see the issue |
05:08:50 | FromDiscord | <Elegantbeef> Yea it should be `var ptr UncheckedArray[ItemT]` |
05:09:16 | FromDiscord | <Elegantbeef> that matches `T` in C |
05:09:18 | FromDiscord | <Elegantbeef> It's a ptr to a ptr |
05:10:05 | * | advesperacit joined #nim |
05:11:59 | FromDiscord | <Elegantbeef> Pascall really should've won the war |
05:12:27 | FromDiscord | <Elegantbeef> `^array of jack_description_t` is so much easier to parse đ |
05:32:48 | FromDiscord | <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:37 | FromDiscord | <Elegantbeef> Like i said `var ptr UncheckedArray[Description]` |
05:38:07 | FromDiscord | <spotlightkid> Oh, in the declaration. Now I get it. |
05:51:26 | FromDiscord | <spotlightkid> Got it working now. Thanks for your help!â”https://github.com/SpotlightKid/jacket/blob/master/examples/jacket_list_all_properties.nim |
05:53:56 | FromDiscord | <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:57 | FromDiscord | <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:37 | FromDiscord | <haxscramper> There is also an but updated version of this https://github.com/haxscramper/hmatching |
07:39:38 | FromDiscord | <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:21 | FromDiscord | <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:08 | FromDiscord | <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:44 | FromDiscord | <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:47 | FromDiscord | <Elegantbeef> I think you use the callback but filter for only the ones with the prfix |
08:09:26 | FromDiscord | <sOkam!> yeah but how is the question. you know i always get gigastuck on the dumbest details of the syntax đ |
08:09:49 | FromDiscord | <sOkam!> are you meant to `startsWith` the inputs? or what exactly? |
08:10:01 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L5-L37 |
08:10:33 | FromDiscord | <sOkam!> oh really useful! tysm âïž |
08:10:45 | PMunch | A rename callback is indeed the way to go, here is a sample taken from my Gtk wrapper: ix.io/4wzF |
08:12:00 | PMunch | I'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:44 | PMunch | For example you have stuff like `gboolean gtk_tree_model_get_iter_first (GtkTreeModel* tree_model, GtkTreeIter* iter)` |
08:13:17 | PMunch | Currently it just strips the `gtk_` part, but I'd really prefer if it also managed to strip the `tree_model` part |
08:14:11 | PMunch | Unfortunately renameCallback doesn't get the full type signature, so I can't go poking around the arguments easily.. |
08:19:29 | FromDiscord | <sOkam!> Is there a way to mark all enums as pure? |
08:22:25 | PMunch | Hmm, not really no |
08:22:36 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wzI |
08:23:29 | FromDiscord | <sOkam!> should be `VariantType.Nil` instead of `GDExtensionVariantType.GDExtensionVariantTypeNil` |
08:23:55 | PMunch | Are you able to rename the fields with a renameCallback? |
08:24:22 | FromDiscord | <sOkam!> it should be doable, but then they conflict with the `type Bool` that are outside |
08:25:41 | PMunch | Ah I see |
08:26:06 | PMunch | Maybe keep the "Type" part? Or just name them "VariantNil" or something |
08:26:43 | FromDiscord | <sOkam!> that second option might work, or some variation like that đ€ |
08:26:51 | PMunch | I will accept a PR to make it possible to somehow mark enums as pure :) |
08:27:31 | FromDiscord | <sOkam!> or maybe just pass a text replace on the `.nim` resulting file, since its just for replacing `.} = enum` with `, pure.} = enum` |
08:28:15 | FromDiscord | <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:35 | PMunch | Haha, I was just putting it out there :) |
08:33:46 | PMunch | It's unfortunate that you find it so hard to use though |
08:34:48 | FromDiscord | <sOkam!> its easy to use, -if- you understand what its doing |
08:34:55 | FromDiscord | <sOkam!> that's what took me a year to grasp |
08:35:18 | PMunch | Still, it could probably have been described better |
08:35:36 | PMunch | You wouldn't happen to have a list of what confused you? |
08:37:09 | FromDiscord | <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:36 | FromDiscord | <sOkam!> its not until I worked with staticglfw buildsystem that saw the difference |
08:40:27 | PMunch | Aah, I think I understand |
08:40:40 | FromDiscord | <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:12 | NimEventer | New 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:48 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wAu |
11:00:15 | FromDiscord | <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:43 | PMunch | Well the numbers can be a bit confusing, not going to lie |
11:01:21 | PMunch | The 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:33 | FromDiscord | <sOkam!> i guess `ptr pointer` is not the same as `pointer` or something? |
11:02:14 | PMunch | But you can use `-d:nodeclguards` to create prettier output |
11:02:34 | PMunch | Your actual error is actually that `ptr T` isn't the same as `pointer` |
11:02:56 | FromDiscord | <sOkam!> but T is a pointer itself đ€ |
11:03:02 | FromDiscord | <sOkam!> shouldn't that resolve to a base pointer? |
11:03:11 | PMunch | Remember Nim is strict when it comes to types, so you need to cast your pointers to the expected type |
11:03:51 | FromDiscord | <sOkam!> i guess i could cast to `GDExtensionTypePtr` đ€ |
11:04:05 | PMunch | that proc takes a `ptr GExtensionType` and a `ptr ptr GDExtensionType` it looks like |
11:04:20 | FromDiscord | <sOkam!> typeptr and consttypeptr |
11:04:21 | PMunch | And you pass in two `pointer` values, which is a type mismatch |
11:04:33 | PMunch | Oh right |
11:04:44 | FromDiscord | <sOkam!> yeah but those two are inheriting from `pointer` at the base anyway |
11:04:50 | FromDiscord | <sOkam!> since they are actually C void |
11:04:56 | PMunch | But the comment still stands, those pointer types are not compatible with `pointer` in Nim |
11:05:25 | FromDiscord | <sOkam!> why not? they are pointer at the very base. or is the resolution stopped at some point? |
11:05:38 | PMunch | Oh wait, GDExtensionTypePtr should actually be compatible with `pointer` |
11:05:51 | FromDiscord | <sOkam!> that's what i was saying yeah |
11:06:08 | FromDiscord | <sOkam!> both are just pointer at the base, but one of them is `ptr pointer` |
11:06:09 | PMunch | Not sure what GDExtensionConstTypePtr is though |
11:06:17 | PMunch | Your snippet doesn't include its definition |
11:06:32 | PMunch | Ah yeah, then you need to pass a `ptr pointer` |
11:06:37 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wAA |
11:06:46 | FromDiscord | <sOkam!> is ptr pointer a thing? i didn't even know |
11:06:57 | PMunch | Sure |
11:07:07 | PMunch | It's either a list of pointers, or a pointer to where a pointer is stored |
11:07:21 | FromDiscord | <sOkam!> well im glad this is nim, at least. this would be giga-confusing in C â°ïž |
11:07:35 | PMunch | If it's a pointer to where a pointer is stored it's analogous to what `var` does for arguments in Nim |
11:07:47 | FromDiscord | <sOkam!> ic, makes senses |
11:08:40 | PMunch | The lists usecase is pretty much why I created the retype thing |
11:09:05 | PMunch | In 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:58 | FromDiscord | <rishav> sent a code paste, see https://play.nim-lang.org/#ix=4wAD |
11:22:26 | FromDiscord | <rishav> (edit) "https://play.nim-lang.org/#ix=4wAF" => "https://play.nim-lang.org/#ix=4wAG" |
11:22:49 | FromDiscord | <rishav> (edit) "https://play.nim-lang.org/#ix=4wAG" => "https://play.nim-lang.org/#ix=4wAH" |
11:24:18 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wAI |
11:25:15 | PMunch | sOkam!, oh you won't be able to tell like that. It's purely a semantic difference. |
11:25:39 | PMunch | The reason that works is because it's now a `ptr pointer` |
11:26:25 | PMunch | It would also work if you had `var myStr = str.addr.toGodot` and then did `api.stringNameFromString(handle.addr.toGodot, myStr.addr)` |
11:26:25 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wAJ |
11:26:43 | PMunch | And judging by the name of that procedure I would assume that's the intension |
11:26:59 | PMunch | Oh, huh |
11:27:04 | PMunch | Guess I'm wrong then |
11:27:11 | FromDiscord | <sOkam!> are you confusing names of variant types with nim types? |
11:27:17 | PMunch | No? |
11:27:18 | FromDiscord | <sOkam!> they have like 4 steps to get a single handle |
11:27:33 | FromDiscord | <sOkam!> String is not `string` and its not `cstring` neither `StringName` |
11:27:50 | PMunch | I wasn't really looking at the types |
11:27:52 | FromDiscord | <sOkam!> string > cstring > String > StringName |
11:28:03 | FromDiscord | <sOkam!> oh, then i don't know what you meant |
11:28:11 | PMunch | I was just saying that both `arg[0].addr` and `myStr.addr` would be the same type `ptr pointer` |
11:28:31 | PMunch | So the compiler won't complain if you do it wrong |
11:28:50 | FromDiscord | <sOkam!> wouldn't the second option just be a pointer to the variable itself? |
11:29:01 | FromDiscord | <sOkam!> like as a unique object of an array |
11:29:13 | PMunch | Yes, but the variable is a `pointer` so a pointer to that would be a `ptr pointer` |
11:29:16 | FromDiscord | <sOkam!> an array that doen't exist |
11:29:43 | FromDiscord | <sOkam!> is that different than passing a pointer to the first object of the box? |
11:29:54 | PMunch | No |
11:31:14 | PMunch | The 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:30 | FromDiscord | <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:37 | PMunch | rishav, did you give up trying to get Futhark to work on Windows (assuming you're the same person as on GitHub)? |
11:32:13 | FromDiscord | <sOkam!> In reply to @PMunch "The thing is that": kk ty âïž |
11:32:21 | PMunch | Or it might be passed along to some underlying thing which expects N elements based on what type you're converting to |
11:32:34 | FromDiscord | <sOkam!> yeah exactly |
11:33:51 | FromDiscord | <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:12 | PMunch | You shouldn't have to copy the files |
11:34:17 | FromDiscord | <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:29 | PMunch | `--passL` should be enough, but I'm not 100% sure that flag passes through Nimble |
11:34:54 | PMunch | Where do you have libclang.dll on your system? |
11:35:58 | FromDiscord | <rishav> `"C:\Users\risharan\scoop\apps\llvm\16.0.4\bin\libclang.dll"` |
11:37:33 | FromDiscord | <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:15 | PMunch | Well many flags will pass through nimble and be passed to the compiler |
11:38:44 | PMunch | nimble install --passL:"-L<path to lib directory containing libclang.dll file>" futhark |
11:38:49 | PMunch | That should be the required command |
11:42:37 | FromDiscord | <rishav> This is what I get https://media.discordapp.net/attachments/371759389889003532/1110895627191205930/message.txt |
11:44:54 | PMunch | Ah, those angle brackets shouldn't be included |
11:45:03 | PMunch | They are just there to denote the part you should replace |
11:45:22 | PMunch | Your command should be: nimble install --passL:"-LC:\Users\risharan\scoop\apps\llvm\16.0.4\bin" futhark |
11:45:39 | PMunch | It also needs the path to be the directory not the file |
11:47:44 | FromDiscord | <rishav> T_T I can't believe i wasted hours because I can't read simple error messages. |
11:48:01 | FromDiscord | <rishav> Thank you @PMunch . Got Futhark to install ` Success: futhark installed successfully.` |
11:50:02 | PMunch | Nice! |
11:50:19 | PMunch | And don't worry about it, happens to the best of us :) |
12:06:52 | FromDiscord | <rishav> sent a code paste, see https://play.nim-lang.org/#ix=4wAV |
12:21:15 | FromDiscord | <jmgomez> @PMunch seems like nimlsp is broken? https://github.com/nim-lang/Nim/actions/runs/5067675021/jobs/9099004355?pr=21897 |
12:25:07 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wAZ |
12:31:40 | PMunch | rishav, 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:55 | PMunch | Basically you need to set `sysPath` |
12:32:54 | PMunch | jmgomez, yes it has been reported and fixed: https://github.com/nim-lang/Nim/pull/21555 |
12:33:08 | PMunch | But there hasn't been any new versions since. So it's still broken on the latest stable.. |
12:33:37 | FromDiscord | <jmgomez> I meant, the Nim CI is not passing due to that from a change made an hour ago |
12:35:31 | PMunch | Ah shit, there was actually an issue with the latest merge PR I believe |
12:39:45 | PMunch | There, pushed a fix |
12:41:25 | PMunch | Hmm, does the Nim CI run the latest version of each package? That PR hadn't been tagged in a release yet |
12:41:37 | FromDiscord | <jmgomez> oh that was fast, thanks! |
12:42:14 | FromDiscord | <jmgomez> I have no idea sorry. I was just hoping I didnt trigger any random issue with my change đ |
12:44:26 | PMunch | Hmm, it would be very strange if your change triggered that bug. But it looks very strange |
12:45:20 | FromDiscord | <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:51 | PMunch | The error points to here: https://github.com/PMunch/nimlsp/blob/bba60b785188592b8d9966e75ff7c9ef6a759b0f/src/nimlsp.nim#L305 |
12:46:02 | PMunch | And as you can see that should be defined in line #298 |
12:46:04 | FromDiscord | <ringabout> In reply to @PMunch "Hmm, does the Nim": yep |
12:46:13 | FromDiscord | <jmgomez> In reply to @jmgomez "Yeah, see the latest": Is this block of code, isnt it |
12:46:18 | PMunch | So if you broke that then you broke something real bad :P |
12:48:05 | PMunch | Anyways, the nimlsp issue should be fixed now |
12:48:23 | PMunch | So 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:53 | FromDiscord | <least antisemitic pole> is there a simple (svelte-like) way to enable/disable classes in karax? |
14:11:11 | FromDiscord | <least antisemitic pole> usecase: tailwind-css instead of actually having a css file |
14:15:43 | NimEventer | New 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:10 | FromDiscord | <Nerve> What's the correct place to discuss the standard library? |
14:57:32 | FromDiscord | <demotomohiro> This place should be correct place if you have any questions about the stdlib. |
15:00:56 | FromDiscord | <Nerve> sent a long message, see http://ix.io/4wBR |
15:02:31 | FromDiscord | <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:39 | NimEventer | New post on r/nim by qtless: CSS In Pure Nim đ, see https://reddit.com/r/nim/comments/13qphpx/css_in_pure_nim/ |
15:58:57 | ntat | Hi. 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:51 | FromDiscord | <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:10 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCf |
16:42:40 | FromDiscord | <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:51 | FromDiscord | <sOkam!> (edit) "data" => "information" |
16:44:42 | FromDiscord | <Rika> https://nim-lang.org/docs/iterators.html#fields.i%2CT |
16:44:56 | FromDiscord | <Rika> https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT |
16:47:02 | FromDiscord | <sOkam!> In reply to @Rika "https://nim-lang.org/docs/iterators.html#fields.i%2": is that for a `typedesc`? |
16:47:23 | FromDiscord | <sOkam!> doesn't seem to be, which is why i didn't just use that |
16:50:02 | FromDiscord | <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:44 | FromDiscord | <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:27 | FromDiscord | <jmgomez> are you on devel? |
16:56:35 | FromDiscord | <sOkam!> i could be if required |
16:56:55 | FromDiscord | <jmgomez> I recently implemented `codegenDecl` for types, that may help you |
16:57:11 | FromDiscord | <sOkam!> which module is it in? |
16:57:23 | FromDiscord | <jmgomez> let me see if I can find the docs |
16:58:07 | FromDiscord | <jmgomez> https://nim-lang.github.io/Nim/manual#implementation-specific-pragmas-codegendecl-pragma |
16:59:16 | FromDiscord | <jmgomez> sent a code paste, see https://paste.rs/1yYBH |
16:59:31 | FromDiscord | <jmgomez> you can change that template at compile time to put in there what you want |
17:00:03 | FromDiscord | <sOkam!> is that not for generating C code? |
17:00:32 | FromDiscord | <jmgomez> that will use the template as generator instead of the default Nim generator |
17:01:10 | FromDiscord | <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:00 | FromDiscord | <jmgomez> Maybe I dont understood what you are trying to do then |
17:02:34 | FromDiscord | <jmgomez> (edit) "dont" => "didnt" |
17:03:03 | FromDiscord | <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:28 | FromDiscord | <sOkam!> `struct` is in C, but its also a keyword in wgsl |
17:03:56 | FromDiscord | <jmgomez> ahh you are looking for a Nim backend for wgsl then |
17:04:46 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCk |
17:04:56 | FromDiscord | <sOkam!> notice that it looks -similar- to C, but its not c |
17:05:15 | FromDiscord | <sOkam!> In reply to @jmgomez "ahh you are looking": i want to make one, because it doesn't exist |
17:05:39 | FromDiscord | <jmgomez> @treeform has shady https://github.com/treeform/shady/tree/master which may be a good starter point for you |
17:05:39 | FromDiscord | <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:01 | FromDiscord | <jmgomez> but yeah, you cant access the cgen |
17:06:05 | FromDiscord | <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:29 | FromDiscord | <sOkam!> i don't want to make a full-blown transpiler. i just need the struct definition, and thats it |
17:06:42 | FromDiscord | <sOkam!> so its a simple type instrospection, but don't know how to access that data |
17:06:43 | FromDiscord | <jmgomez> I mean, that's kinda of trivial if you only have a subset of types |
17:07:09 | FromDiscord | <sOkam!> yeah, its all vecN<f32>, f32, int and uint, and thats it |
17:07:20 | FromDiscord | <sOkam!> but the amount of them, and the names, are variable |
17:07:40 | FromDiscord | <jmgomez> so then create a lookup table and render it to your thing |
17:07:57 | FromDiscord | <sOkam!> i still need to instrospect the fields from a typedesc |
17:08:02 | FromDiscord | <sOkam!> which is what I don't know how to do |
17:08:28 | FromDiscord | <jmgomez> show the code of the type def |
17:08:53 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCm |
17:09:24 | FromDiscord | <sOkam!> currently simplest possible example, but the amount of fields and name of the type, etc, are variable |
17:10:35 | FromDiscord | <jmgomez> but what is your problem exactly? |
17:10:51 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCn |
17:11:11 | FromDiscord | <sOkam!> `T.name` from typetraits gives me `Uniform`... but what about `time` and `float32` |
17:11:31 | FromDiscord | <jmgomez> just do a macro |
17:11:46 | FromDiscord | <sOkam!> if i knew how, wouldn't i just do it? |
17:11:54 | FromDiscord | <sOkam!> im asking for how that could be found |
17:21:37 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCo |
17:27:11 | FromDiscord | <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:57 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCq |
17:34:29 | FromDiscord | <jmgomez> But I would recomend to handle recList and IdentDefs as a whole as you may encounter different cases |
17:34:56 | FromDiscord | <sOkam!> problem is that i don't know how to navigate that tree |
17:35:16 | FromDiscord | <jmgomez> well, I just show you you can access the childs with the index |
17:35:23 | FromDiscord | <sOkam!> i understand you got `Uniform` by saying `n[0].strval`... but thats just the first item |
17:35:31 | FromDiscord | <jmgomez> (edit) "show" => "shown" |
17:38:54 | FromDiscord | <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:23 | FromDiscord | <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:12 | FromDiscord | <jmgomez> yes, they are always like that |
17:40:29 | FromDiscord | <sOkam!> so reclist[0] will be the first field of the object? |
17:40:34 | FromDiscord | <jmgomez> what would change is if it has pragmas or not, if it has "" etc. |
17:40:34 | FromDiscord | <sOkam!> etc? |
17:40:54 | FromDiscord | <jmgomez> yes |
17:41:06 | FromDiscord | <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:48 | FromDiscord | <sOkam!> getting somewhere. ty @jmgomez đ€ https://media.discordapp.net/attachments/371759389889003532/1110988531872043028/image.png |
17:59:00 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCs |
18:01:42 | FromDiscord | <jmgomez> what error do you have |
18:02:59 | FromDiscord | <sOkam!> nothing, just in case there is something obviously wrong in it |
18:03:10 | FromDiscord | <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:23 | FromDiscord | <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:03 | FromDiscord | <sOkam!> can macros contain `int` and `string` inputs? |
18:06:14 | FromDiscord | <sOkam!> i remember having issues with those at some point |
18:06:28 | FromDiscord | <sOkam!> or was it just templates? |
18:08:56 | FromDiscord | <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:28 | Amun-Ra | .at? |
18:10:10 | FromDiscord | <voidwalker> well, I thought I can somehow use the same [] syntax with some suffix or something |
18:10:46 | FromDiscord | <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:26 | FromDiscord | <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:12 | FromDiscord | <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:41 | FromDiscord | <sOkam!> but i remember having issues with passing data into something, maybe it was just templates instead đ |
18:13:46 | FromDiscord | <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:04 | FromDiscord | <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:39 | FromDiscord | <jtv> What does that mean? You want a bignum libray? |
18:17:45 | FromDiscord | <jtv> (edit) "libray?" => "library?" |
18:18:13 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCx |
18:18:21 | FromDiscord | <sOkam!> i cannot return a string, or if I can I don't know how |
18:19:35 | FromDiscord | <jtv> Macros return nimnodes |
18:19:41 | FromDiscord | <sOkam!> Error: type mismatch: got 'string' for 'uniformBlock(typImpl, 0, 0, "u")' but expected 'NimNode = ref NimNodeObj' |
18:19:42 | FromDiscord | <jtv> Not strings |
18:20:01 | FromDiscord | <jtv> macro() takes parse tree as input and produces parse tree as output |
18:20:09 | FromDiscord | <jtv> It's not like template |
18:20:26 | FromDiscord | <jmgomez> You may want to save the string that you already have to a file |
18:20:29 | FromDiscord | <sOkam!> how do i return the resulting string? |
18:20:55 | FromDiscord | <jmgomez> That's your final output |
18:21:01 | FromDiscord | <sOkam!> i don't mind storing it in a const. but it needs to exist in the app |
18:21:03 | FromDiscord | <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:16 | FromDiscord | <jmgomez> You can do that, sure. You can create a const |
18:21:32 | FromDiscord | <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:59 | FromDiscord | <jmgomez> `var shader {.compileTime.} : string` and just assign the value in the macro |
18:22:39 | FromDiscord | <sOkam!> that won't fly. what if I pass 10 types? |
18:23:08 | FromDiscord | <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:23 | FromDiscord | <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:59 | FromDiscord | <sOkam!> im not following what you mean |
18:24:05 | FromDiscord | <jmgomez> or you have a seq[string] instead of string |
18:25:03 | FromDiscord | <jmgomez> sent a code paste, see https://paste.rs/0oKIH |
18:25:07 | FromDiscord | <jtv> sent a code paste, see https://play.nim-lang.org/#ix=4wCA |
18:26:09 | FromDiscord | <jtv> sent a code paste, see https://play.nim-lang.org/#ix=4wCB |
18:26:11 | FromDiscord | <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:27 | FromDiscord | <sOkam!> i think thats what i want actually |
18:26:39 | FromDiscord | <sOkam!> because i really need access to the variables, and I don't know how many they are |
18:26:55 | FromDiscord | <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:55 | FromDiscord | <sOkam!> the output is meant to be concatenated with a runtime string |
18:27:35 | FromDiscord | <jtv> You can definitely sub in blocks from one quote block into another with `` |
18:27:53 | FromDiscord | <sOkam!> I figure what I should use is a seq[string], though, so it always has the same name |
18:28:01 | FromDiscord | <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:10 | FromDiscord | <jtv> Oh, one other thing to note |
18:28:21 | FromDiscord | <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:28 | FromDiscord | <jtv> The types are the RUNTIME type. The input is still a parse tree |
18:28:40 | FromDiscord | <jtv> Saying s is a string means the type will be checked for you |
18:28:45 | FromDiscord | <jtv> To ensure it's actually a string |
18:28:57 | FromDiscord | <sOkam!> i might be missing the points, tbh |
18:29:41 | FromDiscord | <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:05 | FromDiscord | <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:40 | FromDiscord | <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:50 | FromDiscord | <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:10 | FromDiscord | <jtv> If you need to loop, {.compileTime.} isn't going to work for you |
18:31:31 | FromDiscord | <sOkam!> then that's the issue i was mentioning |
18:32:18 | FromDiscord | <jtv> But, if you want to loop based on the input, you will need to get to know the parse tree |
18:33:10 | FromDiscord | <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:32 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/LLBrx |
18:33:51 | FromDiscord | <jmgomez> In reply to @sOkam! "is `var myBlocks {.compileTime.}": yes |
18:33:57 | FromDiscord | <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:00 | FromDiscord | <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:15 | FromDiscord | <jtv> So you need to do validation on the tree that you get. |
18:34:59 | FromDiscord | <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:10 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCD |
18:35:18 | FromDiscord | <sOkam!> the codegen and groupid solving etc is up to the library, but the user needs to register their types |
18:36:18 | FromDiscord | <sOkam!> In reply to @jmgomez "and you may prefer:": oh so the pragma does the macro call or something? |
18:37:03 | FromDiscord | <sOkam!> but you cannot have custom pragmas imported, right? how would that work? |
18:37:55 | FromDiscord | <jmgomez> macro calls can be made through pragmas yes, you can see want to check the render tree because it can vary |
18:38:13 | FromDiscord | <jmgomez> what do you mean? you can just import the macro |
18:38:15 | FromDiscord | <sOkam!> sounds very complex |
18:38:21 | FromDiscord | <jmgomez> save it for later |
18:38:41 | FromDiscord | <jmgomez> it's easy to change, focus on the content of the macro itself to get it doing what you want |
18:38:52 | FromDiscord | <sOkam!> In reply to @jmgomez "what do you mean?": .registerUniform. is a macro used as a pragma ? |
18:39:02 | FromDiscord | <jmgomez> yes |
18:39:13 | FromDiscord | <sOkam!> thats doable? i didn't even know that was a thing |
18:40:00 | FromDiscord | <sOkam!> but yeah, will keep it in mind |
18:42:47 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCH |
18:43:18 | FromDiscord | <sOkam!> openarray could solve the typedesc list, but each input has 2 ints and a string attached on calling |
18:45:37 | FromDiscord | <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:09 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCI |
18:47:41 | FromDiscord | <sOkam!> obviously doesn't work, because macros don't return strings. but that's the goal |
18:47:52 | FromDiscord | <sOkam!> I just need to store those strings somewhere accessible at runtime |
18:49:16 | FromDiscord | <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:07 | FromDiscord | <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:47 | FromDiscord | <jmgomez> Again, you can use a var as I shown before |
18:50:57 | FromDiscord | <demotomohiro> How about to generate a string and return `newLit(mystring)` in a macro? |
18:51:31 | FromDiscord | <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:32 | FromDiscord | <jmgomez> In reply to @jmgomez "`var shader {.compileTime.} :": this |
18:51:39 | FromDiscord | <jmgomez> yeah, it should |
18:52:07 | FromDiscord | <sOkam!> someone said it wont, so i was just trusting that. will try it then |
18:52:07 | FromDiscord | <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:46 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCN |
18:59:08 | FromDiscord | <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:43 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wCP |
19:00:27 | FromDiscord | <sOkam!> how does the user send the type register order, though? |
19:01:09 | FromDiscord | <sOkam!> i can do the group+binding ids, but they need to provide the type and a variable name at least |
19:01:28 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "Do you want 1": The second one |
19:02:01 | FromDiscord | <sOkam!> (edit) "register order," => "register," |
19:05:09 | * | lucasta joined #nim |
19:08:48 | FromDiscord | <acornes> sent a code paste, see https://play.nim-lang.org/#ix=4wCV |
19:09:14 | FromDiscord | <acornes> i dont know if its a name change or something else since the library was last updated 8 years ago |
19:13:39 | FromDiscord | <sOkam!> how do you pass an integer to a macro as an integer, and not as a `NimNode`? |
19:14:08 | FromDiscord | <jtv> Make it a static parameter |
19:14:31 | FromDiscord | <jtv> macro(i: static[int]) = ... |
19:14:41 | FromDiscord | <sOkam!> ty |
19:14:48 | FromDiscord | <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:56 | FromDiscord | <demotomohiro> In reply to @System64 "The second one": https://nim-lang.org/docs/math.html#floorMod%2CT%2CT |
19:15:25 | FromDiscord | <jtv> It's not an issue from the caller's POV, Phil |
19:15:40 | FromDiscord | <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:11 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wCY |
19:17:12 | FromDiscord | <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:15 | FromDiscord | <sOkam!> @jmgomez seems like seq[string] doesnt work in compiletime after all, for whatev reason đ€·ââïž |
19:19:15 | FromDiscord | <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:33 | FromDiscord | <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:50 | FromDiscord | <System64 ~ Flandre Scarlet> Seems not the case here https://media.discordapp.net/attachments/371759389889003532/1111010689545408572/image.png |
19:20:06 | FromDiscord | <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:12 | FromDiscord | <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:15 | FromDiscord | <jmgomez> (edit) removed "static" |
19:20:20 | FromDiscord | <jmgomez> (edit) removed "or" |
19:21:31 | FromDiscord | <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:11 | FromDiscord | <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:28 | FromDiscord | <sOkam!> it can echo just fine, but the information is gone |
19:23:37 | FromDiscord | <jtv> Here's what you might find helpful. Write up an example of code you would like it to generate. |
19:23:46 | FromDiscord | <jtv> With no macros. |
19:23:49 | FromDiscord | <jtv> Then get that working |
19:24:11 | FromDiscord | <jtv> Once you do, write the code you want to be ABLE to write w/ macros that should lead to the result. |
19:24:34 | FromDiscord | <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:13 | FromDiscord | <sOkam!> how do you create code that does what i need, without it being a macro, considering the code requires type introspection? |
19:25:52 | FromDiscord | <sOkam!> that was the original question. how to access fields/types inside a typedesc, given its typedesc and not a variable |
19:26:37 | FromDiscord | <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:17 | FromDiscord | <jtv> Then you figure out how to programmatically make the mapping as people come in with different inputs |
19:27:31 | FromDiscord | <sOkam!> thats already done |
19:27:41 | FromDiscord | <sOkam!> the code is generating, given the input |
19:27:48 | FromDiscord | <sOkam!> what i cannot do is -store- that information |
19:28:50 | FromDiscord | <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:30 | FromDiscord | <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:52 | FromDiscord | <sOkam!> and that brings us back to the original question |
19:30:07 | FromDiscord | <sOkam!> how do you access field information given a typedesc and not a variable |
19:30:19 | FromDiscord | <sOkam!> you can do `$type`... but not `$field` |
19:30:23 | FromDiscord | <jtv> You do not, there is no runtime type information. |
19:30:28 | FromDiscord | <sOkam!> (edit) "`$field`" => "`$type.field`" |
19:30:29 | FromDiscord | <jtv> Not full type info anyway |
19:30:52 | FromDiscord | <sOkam!> then what you are saying either has a logic gap, or im big slow |
19:31:02 | FromDiscord | <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:10 | FromDiscord | <sOkam!> because i need field information to generate the code |
19:31:24 | FromDiscord | <sOkam!> but then we go back to compile time, and the code is gone after code is gen |
19:31:49 | FromDiscord | <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:06 | FromDiscord | <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:35 | FromDiscord | <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:04 | FromDiscord | <sOkam!> i think im currently past that point |
19:34:16 | FromDiscord | <demotomohiro> In reply to @System64 "Will check this Btw,": Then, try `floorMod(x + 1, 2) - 1`. |
19:34:17 | FromDiscord | <sOkam!> I just need the data not lost, that's all. but seq[string] doesn't work |
19:34:41 | FromDiscord | <jtv> Well, your thinking on what's happening when is clearly muddled. |
19:34:51 | * | progranner quit (Client Quit) |
19:35:23 | FromDiscord | <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:41 | FromDiscord | <Graveflo> Are you trying to populate the data at compile time and the read it at run time? |
19:36:02 | FromDiscord | <sOkam!> In reply to @Graveflo "Are you trying to": yeah |
19:36:15 | FromDiscord | <sOkam!> i just need that compile data stored in somewhere I can later on read |
19:36:18 | FromDiscord | <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:58 | FromDiscord | <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:57 | FromDiscord | <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:15 | FromDiscord | <Graveflo> this will re-generate the list a runtime by trapping the contents |
19:39:00 | FromDiscord | <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:37 | FromDiscord | <demotomohiro> In reply to @System64 "The thing is the": `floorMod(x/4 + 1, 2) - 1` if input is -4 to 4. |
19:41:53 | FromDiscord | <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:55 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "`floorMod(x/4 + 1, 2)": I can't predict the input |
19:43:07 | FromDiscord | <jtv> You said it could be anything, so it's between low(int) and high(int), inclusive, no?? |
19:44:05 | FromDiscord | <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:36 | FromDiscord | <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:49 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @jtv "You said it could": Yesâ”But I'd need to do a buffer then, no? |
19:47:24 | FromDiscord | <jtv> Do replace 4 with high(int)? |
19:49:06 | FromDiscord | <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:13 | FromDiscord | <System64 ~ Flandre Scarlet> Or maybe I can scale to like - 32k +32k? |
19:50:52 | FromDiscord | <System64 ~ Flandre Scarlet> And then use an AND? |
19:51:05 | FromDiscord | <jtv> You will never get a one-to-one mapping, because of the way floats work. |
19:52:28 | FromDiscord | <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:32 | FromDiscord | <System64 ~ Flandre Scarlet> So what can I do? |
19:54:39 | FromDiscord | <jtv> Divide by 1/high(int), special case 0, and accept your lack of precision? |
19:55:14 | FromDiscord | <jtv> Or just leave it an int, that's the point where it has not lost any precision đ |
19:56:08 | FromDiscord | <System64 ~ Flandre Scarlet> Isn't float better for trigonometric stuff? |
19:57:02 | FromDiscord | <jtv> If you want to minimize lack of precision, use a bignum library |
19:58:14 | FromDiscord | <System64 ~ Flandre Scarlet> And aren't floats very precise with small numbers? |
19:59:02 | FromDiscord | <jtv> Yes, but very imprecise with large ones. ints have even spacing between numbers đ |
20:00:13 | FromDiscord | <System64 ~ Flandre Scarlet> And ints are faster I think |
20:01:17 | FromDiscord | <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:49 | FromDiscord | <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:56 | FromDiscord | <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:14 | FromDiscord | <JJ> is that right, and then if so does the compiler do it all behind the scenes with `ref`? |
20:03:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @System64 "Seems not the case": And is this overflow accurate to what can happen with integers? |
20:03:54 | FromDiscord | <mratsim> In reply to @apropos "is that right, and": atomic rc is opt-in |
20:04:33 | FromDiscord | <mratsim> you need to import the threading package, or in devel there is an experimental switch to make all your ref atomicRef |
20:04:59 | FromDiscord | <JJ> In reply to @mratsim "atomic rc is opt-in": but necessary for shared threaded data? |
20:05:37 | FromDiscord | <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:08 | FromDiscord | <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:39 | FromDiscord | <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:26 | FromDiscord | <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:27 | FromDiscord | <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:40 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wDa |
20:10:51 | FromDiscord | <Elegantbeef> Jesus we're using astgenrepr i see |
20:11:31 | FromDiscord | <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:44 | FromDiscord | <Elegantbeef> `genast` and `quote` |
20:11:50 | FromDiscord | <Elegantbeef> https://dev.to/beef331/demystification-of-macros-in-nim-13n8 |
20:12:09 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> Quasi quoting is really good for macros |
20:14:47 | FromDiscord | <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:53 | FromDiscord | <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:13 | FromDiscord | <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:34 | FromDiscord | <Elegantbeef> Macros compose fine |
20:20:56 | FromDiscord | <Nerve> I should add that don't have as much experience with Nim macros as with Lisp macros |
20:21:14 | FromDiscord | <Nerve> But I had a showstopper with calling Nimja templates within a templated proc |
20:21:17 | FromDiscord | <Elegantbeef> I should say typed macros compose fine |
20:21:38 | FromDiscord | <Elegantbeef> Untyped macros generally do not cause they do not expand the internal code before running |
20:23:36 | FromDiscord | <Elegantbeef> It also depends what you're doing with a macro, no clue what sokam needs here |
20:26:11 | FromDiscord | <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:49 | FromDiscord | <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:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4wDf |
20:27:33 | FromDiscord | <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:34 | FromDiscord | <Elegantbeef> `in default(t).fields` |
20:27:53 | FromDiscord | <sOkam!> oh neat idea |
20:28:04 | FromDiscord | <Elegantbeef> That doesnt work for variants |
20:28:13 | FromDiscord | <Elegantbeef> But it's not like you're sending variants to the gpu |
20:28:21 | FromDiscord | <sOkam!> types have strict requirements anyway for wgpu sending |
20:28:29 | FromDiscord | <sOkam!> so shoudln't be an issue |
20:28:44 | FromDiscord | <Elegantbeef> A concept would be nice though |
20:29:25 | FromDiscord | <sOkam!> can a concept restrict the alignment of a proc? |
20:29:37 | FromDiscord | <sOkam!> or how would you do the restrictions? |
20:29:43 | FromDiscord | <Elegantbeef> "alignment of a proc"? |
20:29:52 | FromDiscord | <sOkam!> of a type sry |
20:29:55 | FromDiscord | <sOkam!> typo |
20:30:10 | FromDiscord | <Elegantbeef> I was meaning on making a macro handle automatically aligning to std430 for opengl |
20:30:16 | FromDiscord | <Elegantbeef> But yea there is no automatic alignment |
20:30:19 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wDg |
20:30:22 | FromDiscord | <Elegantbeef> You can technically check allignment |
20:30:29 | FromDiscord | <Elegantbeef> SInce you can get the offset of fields |
20:30:50 | FromDiscord | <sOkam!> oh true |
20:31:36 | FromDiscord | <sOkam!> btw, how do you get the name of a field inside a variable of that type? |
20:31:51 | FromDiscord | <Elegantbeef> Hackily |
20:32:49 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wDh |
20:33:11 | FromDiscord | <Elegantbeef> You use a macro to break apart the dotexpr |
20:33:33 | FromDiscord | <sOkam!> arent macros compile-time only? |
20:33:34 | FromDiscord | <Elegantbeef> It's a single line macro and I trust if you read my macro tutorial you can do it |
20:33:43 | FromDiscord | <Elegantbeef> All of this is compile time only? |
20:33:55 | FromDiscord | <Elegantbeef> `typedesc` isnt a runtime value |
20:34:05 | FromDiscord | <sOkam!> but im talking about getting it from a variable |
20:34:19 | FromDiscord | <sOkam!> F typedesc, its too annoying, and not even what i need Im afraid |
20:34:21 | FromDiscord | <Elegantbeef> no you're talking about getting it from a static address |
20:34:35 | FromDiscord | <sOkam!> var thing is static? |
20:34:38 | FromDiscord | <Elegantbeef> `thing` is a variable that points to a type `Thing` |
20:34:48 | FromDiscord | <Elegantbeef> `Thing.someName` is static |
20:35:15 | FromDiscord | <sOkam!> but thing.someName isnt, right? |
20:35:21 | FromDiscord | <Elegantbeef> It still is |
20:35:26 | FromDiscord | <Elegantbeef> `someName` is a field access |
20:35:33 | FromDiscord | <Elegantbeef> It's a static offset and name |
20:35:48 | FromDiscord | <Graveflo> sent a code paste, see https://paste.rs/hxK83 |
20:36:25 | FromDiscord | <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:36 | FromDiscord | <Elegantbeef> Of course not variable names don't exist at runtime |
20:36:58 | FromDiscord | <sOkam!> well, thats a huge issue then |
20:37:07 | FromDiscord | <Elegantbeef> Why is it? |
20:37:22 | FromDiscord | <sOkam!> because back to the conversation of tens of messages back a while ago |
20:37:36 | FromDiscord | <Elegantbeef> You want to pass a user type to code that does stuff |
20:37:45 | FromDiscord | <Elegantbeef> Why do you need to get a variable name at runtime |
20:37:52 | FromDiscord | <Elegantbeef> It's not going to suddenly change |
20:38:01 | FromDiscord | <Elegantbeef> You passed a type to a procedure it's statically typed |
20:38:11 | FromDiscord | <sOkam!> because at runtime is when the pipeline is generated, and thats the part that requires the data |
20:38:12 | FromDiscord | <Elegantbeef> You can get the variable name at compile time and use it at runtime |
20:38:18 | FromDiscord | <sOkam!> but if compiletime is gone, the data is gone |
20:38:40 | FromDiscord | <Elegantbeef> You're funny |
20:38:41 | FromDiscord | <jtv> If you're saying you're dynamically loading modules, those modules were statically created, right? |
20:38:46 | FromDiscord | <Elegantbeef> you can do `echo $int` right? |
20:39:01 | FromDiscord | <sOkam!> In reply to @jtv "If you're saying you're": -part- of the module |
20:39:15 | FromDiscord | <Elegantbeef> `int` is a compile time value that `$` converts to a string and it emits a static string `"int"` in your code |
20:39:16 | FromDiscord | <jtv> You generate a variable with the name in it if you need to |
20:40:08 | FromDiscord | <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:32 | FromDiscord | <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:59 | FromDiscord | <Elegantbeef> So create the unform code at compile time |
20:41:13 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> store it in a variable |
20:41:15 | FromDiscord | <Elegantbeef> Then concatenate it |
20:41:24 | FromDiscord | <sOkam!> yeah, that was the conversation of a while ago |
20:41:36 | FromDiscord | <Elegantbeef> You do not need to get a variable at runtime |
20:41:41 | FromDiscord | <sOkam!> how do you store the data at compiletime, because i have the string of code generated but i cannot store it |
20:41:43 | FromDiscord | <jmgomez> He had it already almost working but suddenly gave up |
20:41:45 | FromDiscord | <Elegantbeef> You have one of the best compile time evaluation languages |
20:42:25 | FromDiscord | <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:51 | FromDiscord | <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:09 | FromDiscord | <mratsim> In reply to @sOkam! "how do you store": you use a `const` |
20:43:15 | FromDiscord | <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:56 | FromDiscord | <jtv> This is hours of going around in circles đ |
20:44:17 | FromDiscord | <sOkam!> thats my dumb brain. literally ignore me if you get annoyed by it |
20:44:28 | FromDiscord | <sOkam!> i fucking struggle, im just doing my best to not fail at things when i learn |
20:44:38 | FromDiscord | <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:49 | FromDiscord | <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:13 | FromDiscord | <jmgomez> In reply to @jtv "Write the code without": Create a NimType that holds the types at runtime |
20:45:24 | FromDiscord | <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:28 | FromDiscord | <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:33 | FromDiscord | <jmgomez> And then it's trivial to convert Nodes into that |
20:46:05 | FromDiscord | <Elegantbeef> Generated data can be accessed at runtime if it's stored at compile time |
20:46:53 | FromDiscord | <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:59 | FromDiscord | <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:04 | FromDiscord | <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:46 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wDm |
20:47:56 | FromDiscord | <jmgomez> In reply to @jtv "Well, you can do": he is just trying to do render basic structs |
20:48:10 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4wDn |
20:48:17 | FromDiscord | <Elegantbeef> There we go |
20:48:41 | FromDiscord | <mratsim> In reply to @sOkam! "the problem is in": static objects can be stored in const, const are available at runtime |
20:49:59 | FromDiscord | <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:25 | FromDiscord | <ElegantBeef> Bridge dieded |
20:51:57 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=4wDo |
20:52:09 | FromDiscord | <ElegantBeef> I mean I showed a procedure that does just what they want đ |
20:52:25 | FromDiscord | <mratsim> (edit) "https://play.nim-lang.org/#ix=4wDo" => "https://play.nim-lang.org/#ix=4wDp" |
20:52:43 | FromDiscord | <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:45 | FromDiscord | <ElegantBeef> Technically it does it at runtime, but it's possible to do `var struct = static: generateGlslStruct(MyType)` |
20:53:14 | FromDiscord | <mratsim> or tag the proc {.compileTime.} or return a static MyType |
20:53:31 | FromDiscord | <ElegantBeef> Yea there are plenty of ways |
20:53:45 | FromDiscord | <mratsim> or const struct = |
20:53:55 | FromDiscord | <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:09 | FromDiscord | <ElegantBeef> As an aside I really need to make a `type Std430 = concept type S` đ |
20:55:27 | * | derpydoo joined #nim |
20:55:49 | FromDiscord | <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:08 | FromDiscord | <Graveflo> sent a long message, see http://ix.io/4wDr |
20:56:35 | FromDiscord | <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:43 | FromDiscord | <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:48 | FromDiscord | <mratsim> In reply to @ElegantBeef "Mratsim do you by": Vec3? is that a glsl specificity? |
20:56:59 | FromDiscord | <sOkam!> but im just getting trigggered by this point, so ill shut up now. thanks for all the help |
20:57:07 | FromDiscord | <sOkam!> and sorry for my hardcore stupidity |
20:57:11 | FromDiscord | <ElegantBeef> Yea I think all primitives are C alignment but vec3 is 16 bytes |
20:57:12 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=4wDs |
20:57:26 | FromDiscord | <jtv> I'm saying you don't have the understanding you think you do. |
20:57:27 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wDt |
20:57:31 | FromDiscord | <mratsim> In reply to @ElegantBeef "Yea I think all": probably for SSE since SSE alignment is 16 bytes |
20:57:57 | FromDiscord | <mratsim> In reply to @sOkam! "the string is gen": `const foo = myMacro(param0, param1)` |
20:58:05 | FromDiscord | <ElegantBeef> Comically it's suggested never use vec3 due to that layout |
20:58:16 | FromDiscord | <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:22 | FromDiscord | <ElegantBeef> A macro is really just a static procedure |
20:58:26 | FromDiscord | <sOkam!> its a useless debate |
20:58:53 | FromDiscord | <sOkam!> In reply to @mratsim "`const foo = myMacro(param0,": how do macros return the valid data? |
20:59:00 | FromDiscord | <ElegantBeef> `newLit yourString` |
20:59:06 | FromDiscord | <sOkam!> that was the showstopper. i tried to return a string but couldnt |
20:59:07 | FromDiscord | <ElegantBeef> The same I do as `name` in that code i shared |
20:59:15 | * | advesperacit quit () |
20:59:34 | FromDiscord | <sOkam!> In reply to @ElegantBeef "`newLit yourString`": that was literally all I was asking about since forever. ty beef đ đ đ đ |
21:01:19 | FromDiscord | <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:21 | FromDiscord | <ElegantBeef> You also likely do not need a macro to do what you want |
21:01:37 | FromDiscord | <ElegantBeef> As shown with my `generateGlslStruct` proc |
21:03:11 | FromDiscord | <sOkam!> yeah will definitely check it out, since its doing all the checks i wanted to do too as extra |
21:03:29 | FromDiscord | <ElegantBeef> Well it's not cause I never implemented the alignment check |
21:03:31 | FromDiscord | <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:55 | FromDiscord | <sOkam!> In reply to @ElegantBeef "`newLit yourString`": would this be valid if assigning to a `const thing = ?` |
21:08:40 | FromDiscord | <sOkam!> im getting that the expression of type string needs to be used or discarded đ€ |
21:09:24 | FromDiscord | <jtv> Print out the code you're generating |
21:09:38 | FromDiscord | <jtv> Try to compile it manually if need be |
21:13:26 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4wDw |
21:13:44 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4wDw" => "https://play.nim-lang.org/#ix=4wDx" |
21:14:53 | FromDiscord | <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:09 | FromDiscord | <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:57 | FromDiscord | <ElegantBeef> Does your macro return `untyped`? |
21:18:24 | FromDiscord | <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:35 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4wDy |
21:18:37 | FromDiscord | <ElegantBeef> `macro name(...): untyped` |
21:19:24 | FromDiscord | <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:31 | ntat | How can I find indexes if a is in b? https://play.nim-lang.org/#ix=4wDB |
21:39:05 | FromDiscord | <jtv> Iterate through a and call find on each element in a |
21:48:44 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4wDF |
21:49:06 | FromDiscord | <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:04 | FromDiscord | <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:48 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> You cannot statically link a dll |
23:40:34 | FromDiscord | <Elegantbeef> You statically link a static library |
23:45:01 | FromDiscord | <Arvinâ> Oh |
23:45:13 | FromDiscord | <Arvinâ> How? |
23:45:34 | FromDiscord | <Arvinâ> -dynlibOverride? |
23:47:21 | FromDiscord | <Elegantbeef> Yea that's one parat |
23:47:23 | FromDiscord | <Elegantbeef> part\ |
23:47:52 | FromDiscord | <Elegantbeef> you override the dll then you use `--passL:"-static -LyourLibPath -lyourLib"` to link the specific static library |
23:48:35 | FromDiscord | <Arvinâ> Thanks |