2 ms·
I'm still not sure what exactly you're asking, but the implementation of print linked above (https://ziglang.org/documentation/0.15.2/#Case-Study-print-in-Zig h
by pron 1y ago
I'm still not sure what exactly you're asking, but the implementation of print linked above (https://ziglang.org/documentation/0.15.2/#Case-Study-print-in-Zig https://ziglang.org/documentation/0.15.2/#Case-Study-print-i...) typically requires some kind of syntactic macros in other lanugages as does something like "innerParse" here (https://ziglang.org/documentation/0.11.0/std/src/std/json/static.zig.html#L64 https://ziglang.org/documentation/0.11.0/std/src/std/json/st...), this (https://ziglang.org/documentation/0.15.2/#Generic-Data-Structures https://ziglang.org/documentation/0.15.2/#Generic-Data-Struc...) would typically require some kind of a separate generics or templates feature in other languages, and to see how comptime replaces interfaces, search for "formatType" here: https://marcelgarus.dev/comptime https://marcelgarus.dev/comptime.
Again, the novel use of partial evaluation in Zig is that it eliminates generics, interfaces, and macros. Any language that has one or more of these features does not have this novel design.
- WalterBright 1y agoprint is a fairly complicated case, as it has to deal with all kinds of different types. I mean a simple example. Just to illustrate the concept. Like the examples I provided here: https://news.ycombinator.com/item?id=45859669 https://news.ycombinator.com/item?id=45859669
- pron 1y agoIf you scroll a bit up on the page from the print example, you'll see more introductory stuff: https://ziglang.org/documentation/0.15.2/#Introducing-the-Compile-Time-Concept https://ziglang.org/documentation/0.15.2/#Introducing-the-Co...