Hacker News new | ask | show | jobs
by cztomsik 1204 days ago
You could, but it's not idiomatic in C. Zig is basically built around this.
2 comments

Their standard libraries are built around the notion, but I would argue that putting allocation in their respective stdlibs instead of a part of the language makes it possible to be flexible if needed. There are non-trivial and semi-popular C programs that do not use the C stdlib at all.

I agree that the culture is different and that is significant, but I do not see it in the notion of the language itself (without its stdlib).

Also what is idiomatic for Zig does change as it is not a mature language. Though the allocator passing is expected to remain. Odin did an interesting thing and the allocator is put in a 'context' which is an actual part of the language.

It would be hard for a replacement with the purpose of modernizing a way of working to be idiomatic at the same time. It would be an explicit attempt to update what is idiomatic, and of course not be the same as what was before.

It's actually a rather interesting idea, if I had the time for a C-focused side project that sounds really fun! :)