Compile time field count of a struct #6405
gxhamster
started this conversation in
Ideas/Requests
Replies: 1 comment
-
intrinsics.type_struct_field_count(T) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The idea is to have a built-in method like
offset_ofthat is able to give number of fields in the struct without having to utilize the reflection system of Odin (which i am a huge fan of). The syntax could be something like what is shown below.The name of the the the procedure is of course debatable. I dont think the idea is in any way introducing extra complexity and does not go against the simplistic nature of Odin.
What would it solve?? Relying on the compiler to change a variable that holds field count of a struct which is likely to change in the future. Extra useful when you are doing serialization (which I am doing at the moment).
Beta Was this translation helpful? Give feedback.
All reactions