3 ms·
Have they said how many breaking changes requiring a rewrite Zig will be going through before it stabilises? Also I thought Zig doesn't have interfaces....how
by slopinthebag 7mo ago
Have they said how many breaking changes requiring a rewrite Zig will be going through before it stabilises?
Also I thought Zig doesn't have interfaces....how does the IO one work?
- pjmlp 7mo agoIt has C style interfaces, meaning structs with function pointers. Which is basically how most device drivers in OSes that happen to be written in C, including UNIX flavours, work.
- metaltyphoon 7mo agoWe all know that OP wasn't asking about THAT kind of interface and more "please create vtables for me" style of interface
- pjmlp 7mo agoThat is too much compiler magic for Zig folks.
- AndyKelley 7mo agoYou know, I used to be annoyed by all your consistently shitty remarks in any zig related HN thread, but these days, it's refreshing to have an unpleasant interaction with a human. Sincerely, thanks for all your hand-written hatred.
- baranul 7mo agoPerhaps it can be a relief to make assessments about a couple of newer C alternative languages[1][2]. Zen C appears to be moving up very quickly, and even has autofree. [1]: https://github.com/c3lang/c3c https://github.com/c3lang/c3c (C3) [2]: https://github.com/zenc-lang/zenc https://github.com/zenc-lang/zenc (Zen C)
- slopinthebag 7mo agoThat's a hack, not an interface lol
- pjmlp 7mo agoAs plenty of other things in an "everything is explicit" language, whose goal is to be a safer C and nothing else. The "module" system is another hack.
- spiffyk 7mo agoHow is it a hack? I mean, you may not like the fact that Zig does not provide syntax sugar for interfaces, but how exactly do you think they are implemented in languages that do?
- lukaslalinsky 7mo agoYou would be terrified if you realized how the whole C-based GNOME/GTK ecosystem works :)
- badtuple 7mo agoInterfaces can still be expressed using vtables. You just have to write the vtable yourself rather than have the language do it for you. Also, Zig's tagged unions (enums with payloads in Rust) are really ergonomic and often what you want instead of interfaces. Alot of languages that use interfaces simply don't expose a good way of doing it so everyone reaches for interfaces by default. But if you don't need an actual interface then this way you don't even have to pay the cost of runtime dynamic dispatch.
- redrobein 7mo agoAre there any plans to add syntax sugar for interacting with vtables?
- metaltyphoon 7mo agoSadly no, as fas as I'm aware. I can't think of creating vtables manually every time I need to create interfaces, I guess Zig is not for me.
- slopinthebag 7mo agoYeah I don't understand why a language cannot automate something that routine and boilerplate-y. Oh well, people like it so I won't judge, I'm happy we have choices for what languages we use. Just wish people would choose safe ones :/
- lenkite 7mo agoWish we could bribe Andrew Kelley to add a built-in for this. There are only a couple of regular ways that everyone creates these vtables. Might as well just standardize it.
- sali0 7mo agoI feel like a std lib module would be sufficient.
- zamadatix 7mo agoIf they knew what all of the 0.x breaking changes were going to be ahead of time they wouldn't need to be trying out different choices to see how well they really pan out!
- geon 7mo agoBreaking changes don't require a rewrite.