←back to thread

Things Zig comptime won't do

(matklad.github.io)
458 points JadedBlueEyes | 2 comments | | HN request time: 0.429s | source
1. pyrolistical ◴[] No.43744877[source]
What makes comptime really interesting is how fluid it is as you work.

At some point you realize you need type information, so you just add it to your func params.

That bubbles all the way up and you are done. Or you realize in certain situation it is not possible to provide the type and you need to solve a arch/design issue.

replies(1): >>43745610 #
2. Zambyte ◴[] No.43745610[source]
If the type that you're passing as an argument is the type of another argument, you can keep the API simpler by just using @TypeOf(arg) internally in the function instead.