4 ms·
"C++, Rust, and D have a large number of features and it can be distracting from the actual meaning of the application you are working on. One finds themselves
by WalterBright 8y ago
"C++, Rust, and D have a large number of features and it can be distracting from the actual meaning of the application you are working on. One finds themselves debugging their knowledge of the programming language instead of debugging the application itself."
It's an interesting point. My experience with it, though, is that if the language is too simple, the complexity gets pushed off into the application. The result is "boilerplate", a lot of code that gets routinely cut&pasted into applications.
The thing about complexity in the language, on the other hand, is once you do learn the language, that skill follows you with every app you work with. With complexity pushed to the app, you have to re-learn it with every app.
A screwdriver can do a lot of things - chisel, hammer, scraper, prybar, punch, paint stirrer, shim, etc. But I prefer having a set of tools designed to be chisels, hammers, etc. My projects come out a lot nicer.
- nerdponx 8y agoIt's an interesting point. My experience with it, though, is that if the language is too simple, the complexity gets pushed off into the application. The result is "boilerplate", a lot of code that gets routinely cut&pasted into applications. This is a frequent complaint I hear about Go: they made the language too simple in certain places. People also tend to cite Rich Hickey's distinction between "simple" and "easy". So the question about Zig becomes one of what exactly was kept simple, and what was allowed to become complex? I think the world would benefit from a Hyperpolyglot-style comparison here. Rosetta Code is too much of a mess; ideally, I want to see a thoughtful side by side comparison of the same program written in several languages, with commentary.
- weberc2 8y agoI think many Go developers would consider this a feature (I do, anyway). A little boilerplate is better than a complex language. I say this with a background in C++, Java, and Python. I’m a fair bit more productive in Go and my code tends to be of higher quality (less headspace devoted to language complexity and more room for application complexity).
- int_19h 8y agoZig might get away with it by restricting itself to a narrow niche where this kind of simplicity is advantageous. Go tries to eat a much larger piece of the pie, and the deficiency is felt more as a result.
- veebat 8y agoThere's a profound wisdom to knowing the niche you're in, and Zig does seem to have that. The applications part of the stack is saturated with options, all trying to encroach on each other, but when it comes to the genuinely low-level, unsexy stuff...the viable options are all pretty old languages, and languages that patch over those old languages. And with respect to discussion of boilerplate, you can, of course, always have a "Zig++" language that patches over Zig. By cutting out its own metaprogramming functionality, it's much more straightforward to generate useful Zig source. There are a lot of advantages to restraint in the design, and Go does share that, too.
- DubiousPusher 8y agoCase in point, any interface heavy C codebase. Function after function of laying out function pointer vtables.
- the_clarence 8y agoOr not having a good std crypto library: a million of shitty libraries
- simias 8y agoI don't think that's a very good example, there aren't that many "production grade" crypto libraries out there. I think the root of the problem is that C simply lacks the features necessary to write safe code, it sometimes feel like the language is actively trying to trip you up instead of having your back (implicit casts, weird aliasing rules, lack of generics and in particular "safe" containers like C++'s std::vector, completely implicit ownership semantics etc...). This makes is very difficult to interface crypto code nicely and safely using a pure C API. That's not to say that C crypto libraries don't suck for other reasons (I've used OpenSSL, I can't really defend that) but the language itself limits what you can do, in the standard library or otherwise. I mean, look at the many flawed or error-prone interfaces in the C standard library itself, I don't think stdcrypto.h would be the panacea.
- jstimpfle 8y agoOut of curiosity, what would be an example programming domain with a lot of interfaces?
- xfer 8y agogobject library? Gtk uses this, which tries to emulate OOP.
- DubiousPusher 8y agoYou mean programming domain in general or a codebase in C? There's a ton in Java, C++ and C#. One example in C is the proton implementation of AMQP.
- sedatk 8y agoNot only learning the language but also learning any language can equip you with necessary tools as many of the paradigms are interchangeable between different programming languages. That’s why people complain so much about the lack of generics in Go because we are already accustomed with it from other programming languages. Depriving the programmer from “basic luxuries” doesn’t make much sense.
- bachmeier 8y agoYou're obviously familiar with D, but in response to your post defending D's complexity, let me offer a different take. You are free to ignore a lot of that complexity with D. I don't use most "features" of the language, and in a lot of cases, I don't even know how they work. My code is a lot like C code. I don't mess with attributes, templates, CTFE, etc. in most of my programs. You can use a style in D that is even simpler than Go if you want, but it's nice to have the extra features for the times that they're handy. Just because the features are there doesn't mean it's a good idea to use them - and D allows you to program that way.
- ludston 8y agoThis attitude is fine for personal projects, but it does not scale when working with other people. Even in a two person project, one person using a language feature will inadvertently force the other person to learn how that feature works. And they will not even know if the feature was appropriate to use until they have learned it. With this small amount of reasoning we are back to the tired old argument of "Which is better? Ease of expression or ease or learning?"
- bachmeier 8y ago> This attitude is fine for personal projects, but it does not scale when working with other people. Even if true, so what? "Personal projects" don't count? But honestly, this is one of the worst programming language arguments there is. Any feature can be misused. There has to be discipline - full stop. Restricting the language is not the answer because that just leads to worse code, not better. Decades of C code demonstrates that lack of features does not translate into good programming practice.
- dilap 8y agoI dunno. I find myself fiddling a lot with the language in C#, in C++, in elisp. In Go, mostly I just focus on solving my problem. It seems to have strong enough abstractions for me to express solutions succinctly, while being simple enough to not get in the way. I find it extremely pleasant. (I do admit to the less-than-extremely-pleasant chore of copy-pasting various hand-rolled specializations of functions like, e.g., filter.)
- deleted 8y ago[deleted]