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

"In which people who have never used a language with compile-time expressions try Zig and think it's novel"

Not knocking Zig, I think it's swell, but it wasn't near the first language with this feature. D comes to mind, and C++ has it now with "constexpr" and "consteval".



The purpose was to pick interesting features to talk about and select one language for each feature which is a good exponent for that features. For instance I used Smalltalk to cover image based development: https://erikexplores.substack.com/p/what-makes-smalltalk-uni...

Yet Smalltalk was not the first language supporting image based development. I would pick Julia to talk about multiple dispatch. Likewise Zig is picked not because it is the first doing comptime but because that is a central feature of Zig and it is a language which really puts emphasis on it.


I've ported a small Zig program to C++ and spent a long time and a lot of lines of code on the stuff that comptime can do which C++ cannot.


I'd be curious for examples. In a weird spot where I'm decently familiar with C++, D, and Zig and it would make for good blogpost material to compare comptime implementations for the same thing across languages IMO.


I've posted some examples here for D.




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

Search: