6 ms·
To be honest, programming in Zig sounds like a PITA to me. Building proper abstractions is difficult, and especially so if the main goal of the language is to N
by auggierose 4y ago
To be honest, programming in Zig sounds like a PITA to me. Building proper abstractions is difficult, and especially so if the main goal of the language is to NOT let you do this.
- Yoric 4y agoIt is my understanding indeed that Zig doesn't want you to build too many abstractions. I think that there is room in the design space for languages with few abstractions. That's also what the creators of Go intended, if I understand correctly, and that seems to work for many developers.
- auggierose 4y ago> Zig doesn't want you to build too many abstractions I don't want to build too many either. I prefer to build just the right amount of abstractions. Sounds though like Zig makes that difficult, so at least for me, it is a hard pass.
- kristoff_it 4y agoIt's a matter of perspective, I would argue that C++ makes it really hard to write the right amount, especially when you want to use overly-abstracted third party code that forces you into making a deal with the devil sometimes. But then again, it's a matter of perspective.
- auggierose 4y agoI would agree with you. I don't use C++, it is too much of a mess.
- kristoff_it 4y agoThen you can appreciate a language that tries to make sure the ecosystem does not become a mess :^)
- auggierose 4y agoBut Zig certainly isn't that language, because not having the right abstractions always results in a mess. I mean, just read the article.
- AnIdiotOnTheNet 4y agoTrying to solve problems in one language as though it was a completely different language that has a different philosophy is the problem.
- auggierose 4y agoI am not using Zig, there is no problem here.
- hdhrufjdi 4y agoRust seems like a good middle ground. Iirc you can handle allocation failures there now too, which I have often seen being criticized
- pif 4y agoYeah, I get your point. Poor programmers need to be kept on a leash, so off you go with dumbed-down languages.
- quic5 4y agoHonestly most bad abstraction come from authors thinking they're geniuses (in that moment)
- pif 4y agoSure, as well as the right abstractions come from professionals who are not treated like stupid kids.
- kristoff_it 4y agoYep, just like a professional barber's razor is dumbed down because it only has one blade instead of 6, a swiveling head and a battery-powered vibration function. :^)
- pif 4y agoWrong! A barber's razor is the perfect tool for the trade, together with a sharpening stone. The Go equivalent would be a blade with two dull sides.
- intelVISA 4y agoThe Go equivalent also mocks you in an effete tone and claims "everybody shaves with a dull blade these days so why don't you?"
- HopenHeyHi 4y agoMy beard keeps my face warm in winter?
- timeon 4y agoMETA: analogies are double-edged swords.
- vkazanov 4y agoAnd this is what low-level programming is by definition: technical details stand on your way to abstraction building. Memory, error handling, underlying machine details leaking, etc. Zig tries very hard to stay (relatively) simple, make things possible, but not hide all the important details.
- auggierose 4y agoI don't mind technical details. But the best way to tackle technical details is to build the right abstractions. And the best way to build the right abstractions is to be aware of the technical details.
- vkazanov 4y agoNote then that there's an inherent conflict in programming language design space between introducing too many abstraction building tools and low-level details. It is very hard to make things truly orthogonal. E.g. memory and resource management tends to spill all over the code, with the other example being error handling. And once a language designer adds ways (and a programmer culture) to hide things - it becomes very hard to follow the code. Zig attacks this design space from a low abstraction and explicit flow point of view.
- DeathArrow 4y ago> Note then that there's an inherent conflict in programming language design space between introducing too many abstraction building tools and low-level details. Best C++ code that deals with low level details is as least abstracted as possible. One of the reasons C is used for writing operating systems kernels is that it doesn't hide details. Imagine Linux kernel written in OOP way with design patterns and SOLID principles. :)
- staunton 4y ago> Imagine Linux kernel written in OOP way with design patterns and SOLID principles. Doesn't sound that terrible to me. Just out of interest, do you think `*(int*)(0x12345678) = 0;` is the best way to do memory-mapped IO? That's least abstracted.
- DeathArrow 4y ago> Building proper abstractions is difficult, and especially so if the main goal of the language is to NOT let you do this. reply People should try to use Zig more like C and less like Python, Ruby or Java. If you miss abstract factories, builders, observers, visitors, decorators, maybe Zig isn't for you.
- auggierose 4y agoI don't miss those. We seem to have a different understanding of what abstraction is. It certainly isn't reusing some pre-canned concepts in all the wrong places.
- DeathArrow 4y agoCan you give an example of an abstraction you would need in Zig and Zig doesn't allow to build it with ease?
- auggierose 4y agoSeems like proper error handling is one of those abstractions.
- AnIdiotOnTheNet 4y agoWhat's your specific problem tih the error handling? What is 'inproper' about it? The article seems to have accomplished what they needed with Zig's error handling, they just quibbled over the syntax. Personally, I love Zig's error handling.
- auggierose 4y agoI got the impression from the article that they actually didn't achieve what they wanted. They had to use a printf before returning the error, because they could not make that information part of the error.