Hacker News new | ask | show | jobs
by vbezhenar 1987 days ago
> the std library code is very readable

I think that's very important feature to have for some people like me. I love Java standard library, because it's really easy to read. I regularly read its source code when I need to understand something and it's amazing how much time that could save. The only nitpick when it comes to Java is that some low-level stuff implemented in C and it's not as straightforward to jump into C implementation.

And that what turns me off from Scala and from C++. Scala collections library is horrible to read. It's immensely complicated. I get that they're solving hard problem, but I don't like it. And I hate C++ STL code (at least those that I saw), they're using obscure __identifiers__ and so on (may be there are better implementations, I saw GCC and MSVC ones).

Standard library is how language is supposed to be used. Those who learn language can just read its sources to better understand language idioms and replicate those in their code. And there's a huge difference between languages with readable standard library and languages with unreadable standard library (or even without sources at all, Apple sucks).

2 comments

They use those "obscure __identifiers__" because they are reserved by the standard and thus a conforming program will not define macros with those values and break everything.
IMO a better approach would to define some way for compiler to undo all defines before standard header is included and redo those defines afterwards. Or just to stipulate that standard headers must be included before other user code.
With modules, "hiding" code like that will be possible in C++.

If only we could skip forward a decade and get mature implementations of it right now...

> I get that they're solving hard problem, but I don't like it.

this is why the world is such a sad place