Hacker News new | ask | show | jobs
by brandmeyer 1698 days ago
> It’s not for average users. It’s for library writers

Justifying the complexity of an interface by appeal to caste system is pretty poor, IMO.

A very common methodology for solving big problems is to break them down into smaller problems, solve each one in turn, and compose them together. In other words, we use library-oriented programming. A productive feature in a programming language makes it easy to both create the library elements of the solution and to compose them together.

3 comments

There are tons of facilities in the language intended for library authors and abstractions that are absolutely intended to be used out of the box. This is just how things are, features are provided at various levels of abstractions. I know HN loves to collectively hate on C++ but “caste system?” Lol
I think "caste system" is the perfect word for it. I don't think it is a bad thing though, I am fine with having such castes in c++. First time I saw coroutines of c++ I was definitely like "yep, this is for library writers". I am not excited about it, but I am excited about libraries that will use it.

It is similar how templated code that basically becomes "magic" for an average programmer like me. I can't wrap my head around such complex templated libraries either but the simplicity of using such libraries are sure welcomed by me. I think it is perfectly have some language features for more advanced users.

Hey, at least they are adding concepts. Maybe I will move up to another caste and will be able to write more complex templated code now.

Yeah, it's part of the charm of C++. The is almost horrifyingly modifiable. As a library author, that gives a lot of control over the functionalities of the abstractions you expose.

For a day to day programmer, that sort of concern is (usually) overkill.

The difference is in the capabilities of what a library can do. C++ goes through a lot of effort to ensure any library has all the same building blocks as the standard library. Almost no other language does this. Instead, they just grant the standard library magic powers that they don't trust you with or just refuse to provide.

The "caste system" as a result exists in all languages. Just the vast majority prevent you from ever being a duke much less a king. C++ doesn't stop you. Whether or not this is valuable to you is then personal preference, but it's not complexity for the fun of it, either.

> Justifying the complexity of an interface by appeal to caste system is pretty poor, IMO.

Ahhh, I mean, isn't that a decent-sized chunk of template-based code as well? I would hazard a guess that even for a "simple" one like std::vector<foo>, there are way more C++ developers who can use std::vector than who could implement a templated vector from scratch.

I, myself, fall kind of in the zone between. I'm not a template guru, but I work on the foundational/library-type code on my team and have to do my absolute best to make sure that the stuff I build for everyone is usable without needing to know the minutia about how all that stuff works.

Yes, and that's why templates are also often criticised as a poor design.
I think many C++ devs haven't read Stroustrup's book. The intro to C++ chapter covers most of what they need to know and then the rest of the book goes into beautiful detail with examples.

Most of the C++ developers I worked with were C++ developers in name only and wrote appalling code. I was one of these developers until reading Stroustrup's book and doing my own side projects to improve skills.