Re:What Makes the Zig Programming Language Unique?
by pjmlp on Thursday October 06, 2022 @02:04PM
(#33111719)
Just use the Circle compiler and you have the full C++ language at compile time, available today.
Re:What Makes the Zig Programming Language Unique?
by WalterBright on Thursday October 06, 2022 @03:05PM
(#33112570)
It is returning a new type.
Please show me an example where it differs. D's metaprogramming is very good at constructing types. A member of the D community tried very hard to implement type functions, but it turned out to be redundant with D's existing capability.
Edit: So the main difference seems to be that types are first class citizens in Zig, you can write a normal comptime function that returns a type and either use it to do more metaprogramming or everywhere you would declare a type for a function or variable. I am not aware of any static typed languages that lets you do this with normal language syntax.
C++ does it with templates, but in Zig you can do what C++ templates can but with if statements and loops.