143 points · by DyslexicAtheist · 5y ago · 113 comments
I hope it stays this way. And maybe it can given the way the foundation has been bootstrapped, and that the project is driven largely by a single creator. Having the funding be driven largely by small donations of actual developers is a healthy incentive structure.
Zig, next to Rust, is one of the more interesting language projects going on these days. Since Rust became orphaned from Mozilla, I am a bit ambivalent about the amount of investment in the project which is being driven by tech giants currently.
It's only recently after it became very popular all tech giants started investing in it.
Similar are many other languages like Ruby, Haskell etc.
Rust is developed within a corporate world of Mozilla, like Go language in google, so its natural it will embrace corporate world and companies like Microsoft, Amazon which will in time decide it's future directions.
Guido also worked always for quite well known companies after he left academia.
Programming languages getting a bunch of investment from its users is open source working possibly at its best.
And to be honest, I don't care that much about who is behind a tech, as long as they are making the right choices. (except if it is Apple)
But I like to see the emergence of a few sane proposals to replace C/C++, I've been extremely impressed so far by the work done by the team behind Zig.
The best feature, from my perspective, is that Zig does not intend to be a better C++ but a better C.
i have nothing against having strong opinions, i am the biggest offender but completely disallowing some features, some of the best features static typing can offer is just nonsense.
every language designer should study common-lisp and start with the operators : and :: these two operators alone tell you that the language designed for practical use.
for me overloading the operator + and function 'add' is exactly same. you should then forbid function overloading as well now. you can argue about the weakness of operator overloading but disabling completely, not even a workaround?
why not just enable oo and have safe alternatives instead? . safe(a + b) . a s+ b
"It's really easy to make fun of C++, but everyone has that one feature of C++ that they like. And they want to put it in Zig. If everyone had their favorite feature from C++ in Zig, Zig would just be C++. But I'm not going to let that happen."
a language with first class cross-compilation alone is enough for me to respect you as a language designer and zig have so many features like this. i am a huge fan.
i have only one favourite feature in c++ and it is templates/ctfe. without the function/operator-overloading templates are incomplete, i would then use c instead. i am still using c++ with all its failures, with all its complexity, with all its uglyness|ineleganceonly because c++ got one thing right. you can at least somehow modify the language.
edit: i have to point out that i have never worked in a big team (more than 10) and you can (probably should) safely ignore my ideas/opinions.
Meta-programming can be super powerful and practical, and the current trend of reusing the language itself is clearly better than previous attempt.
But meta-programming in itself is not a novel idea, C macros and C++ templates are past well studied examples, and both produced awful results.
I am not sure they can prevent a new cycle of this nightmare.
I have no doubt about how powerful metaprogramming is, but it makes me feel that understanding and contributing to libraries that use it is out of my reach.
What's wrong with templates ? They give you a compile-time functional language that operates on types, isn't that great ?
With something like that:
var x = a [+] b;
There is no possible mistake.
When trying to understand a codebase, it is much easier to not worry about hidden indirections.
being able to misuse a PL i believe is not a bug but a feature. we really suck at predicting the future.
In a marketing interview with biased questions, anything is possible.
TBH, I have a positive impression of zig, but this kind of interviewing doesn't help it.
(note: "we" excludes me personally but I mean it as "us who work and study comptuing at large")
"Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to--they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980, language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law."
C.A.R Hoare on his Turing award speech in 1981.
Authors just chose to ignore what was already out there and do their own thing instead.
UNIX's success in the universities made the rest.
Even if Zig doesn't bring safety by default to the language, however, I think you could get it in practice by making the standard library enforce safety. Then, unless someone goes out of their way to write their own libraries from scratch and eschew all of the safety mechanisms, they would likely live in this safety bubble.
the documentation is still scattered. The official website [1] is a good starting point. and I wish I'd seen this [2] earlier (I hope this gets incoporated into the official resources)
[1] https://ziglang.org/learn/
[2] https://www.lagerdata.com/articles/an-intro-to-zigs-integer-...
This is probably the most comprehensive resource: https://ziglang.org/documentation/master/
You can find documentation on the language website, also there is an active community and you can ask questions direction on Discord.
- That an out-of-memory condition is elegantly handled or not.
- That an out-of-memory condition is properly reported to the caller.
- That is simplifies WebAssembly support; whatver you put in the allocator your could put into malloc.
- That it easily allows arena allocators; you can only use an arena allocator if you intimately know every single uses of the passed in allocator, allo the implementation details of the libraries you call and of *all* its dependencies. If a dependency, for example, implements a cache, the arena allocator will corrupt it when deallocated.Zig’s clearly about a more homogeneous approach where I am happy to have multiple pieces of syntax to cover different usecases.