5 ms·
I think even in the year of our lord 2016 there's room for a language with safe defaults but seamless interoperability with existing unsafe code. It's certainl
by wffurr 1y ago
I think even in the year of our lord 2016 there's room for a language with safe defaults but seamless interoperability with existing unsafe code. It's certainly an improvement on the status quo and provides an alternative to rewriting the world in Rust or a GC language.
- pjmlp 1y agoExcept Zig defaults could be found on the year of our Lord in 1976, 1978, 1983 and 1986. Exercise from other posts of mine which languages those might be.
- wffurr 1y agoSure, but Zig is bringing those to users and making headlines on HN. I think that’s generally a good thing. Bringing the best of prior languages together in a new package
- pjmlp 1y agoExcept in 2025 we know better regarding safer systems programming languages, use after free is no longer something that we should tolerate.
- justinhj 11mo agoIt's way to early to declare Rust and borrow checking as a panacea for systems level languages. Zig has a solid story for memory safety but makes a different set of trade offs than Rust. IMHO there is room for a few different approaches to systems programming.
- smj-edison 1y agoI've been programming in rust for three years, until I picked up zig recently. I was also worried about memory safety when I started using it, but I've been pleasantly surprised how many safety features it has (it's certainly been easier to debug than the C code I've had to work with). Slices are often mentioned for safety, which they are great, but even better has been all of the casting functions. In Debug and ReleaseSafe mode, @intCast will panic if you try to narrow on integer that's too big. @alignCast checks that the alignment is correct. @bitCast ensures that both types have the same bit width. Non-packed unions will panic if you access the wrong field. Integer under and overflow has revealed some of my bad code like four times now. defer/errdefer is much easier to reason about that "goto cleanup" (it also lets me write custom cleanup code, instead of being beholden to the author's drop implementation). So no, it's not as safe as rust in terms of memory, but it's quite close, and in the process lets you do some really cool stuff.
- pjmlp 1y agoYou could have achieved the same with Modula-2, which is the mapping to 1978 from those dates.
- smj-edison 1y agoThat's fair. I was born twenty years after Modula-2 was released, so I definitely have gaps in my language knowledge :D
- pjmlp 1y agoPlenty of material over here, https://www.modula2.org/index.php https://www.modula2.org/index.php As for the other ones I listed, https://en.wikipedia.org/wiki/Mesa_(programming_language) https://en.wikipedia.org/wiki/Mesa_(programming_language) (some PDFs linked from there) https://bitsavers.org/pdf/borland/turbo_pascal https://bitsavers.org/pdf/borland/turbo_pascal https://www.freepascal.org https://www.freepascal.org https://docwiki.embarcadero.com/RADStudio/Sydney/en/Delphi_Developer%27s_Guide https://docwiki.embarcadero.com/RADStudio/Sydney/en/Delphi_D... and https://learn.adacore.com/index.html https://learn.adacore.com/index.html http://www.ada-auth.org/arm.html http://www.ada-auth.org/arm.html
- smj-edison 1y agoThanks!