Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The partial evaluation you mentioned.


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-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/st...), this (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.

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.


print 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


If 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-Co...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: