3 ms·
> the point of the standard library is not to give you a > bunch of abstract containers that "just work", but rather > to give you many highly-optimized implem
by bborud 8y ago
> the point of the standard library is not to give you a
> bunch of abstract containers that "just work", but rather
> to give you many highly-optimized implementations of
> specific data structures to choose from.
Are you talking about C++ or high level languages in general?
Either way you can come at this from multiple directions. For instance I like the way Josh Bloch designed the collection classes of Java, where you have some key types (given as interfaces) and multiple implementations as well as adapters. The focus is on the semantics and not really the implementation. For the most part you try to write code so it can take advantage of as many implementations of the same type as possible.
Rather than focus on implementation detail I think a standard library has two jobs: the first is to serve as an example of idiomatic language use. The second is to make the language useful - meaning that it should be possible to do practical things with only the standard library. Today such a practical thing might be to perform an HTTP request without having to go on an easter egg hunt.
I think one reason Go is becoming so popular is that it isn't obsessed with "purity". Remember Scheme? Remember how useless it was out of the box? It couldn't actually do anything.
- leetcrew 8y ago> Are you talking about C++ or high level languages in general? c++ specifically. if I don't care about the difference between, for example, a list, a vector, and a deque, I am probably going to choose a higher level language to work in. that said, you can write container agnostic code with templates and range-based for and/or iterators if you really want. I agree with your other points. in particular, it's annoying to have to reach for libcurl every time I want to do simple http stuff, and I have fond memories of scheme from cs 101, as beautiful and unpractical as it is.
- bborud 8y ago> that said, you can write container agnostic code with templates and range-based for and/or iterators if you really want. You can, but people don't often do.