upvote
I think you're talking about more than just a compiler, though standard libraries are often distributed with the compiler. Take Rust for example, it's not like the compiler has special integration with hash maps, it's just that the standard library has a standard implementation and the compiler lets you refer to that implementation without having to repeat it yourself. In a way you're just including parts of another spec in yours. Specifications do this all the time, for example by using English. You don't have to define all the levels of abstraction, only the ones that matter.

Even so, I'd argue that you still have to define how to use those abstractions rather than only the result you'd like to achieve with them. Sure, maybe the abstraction has a ".achieve_the_result()" method, and calling that method is how you achieve it, but often there's a bunch of stuff you fit together to achieve a solution to your problem and the compiler doesn't necessarily do that for you.

I think there actually may be some compilers that get closer to this, for example some problems can be expressed quite elegantly in Haskell or APL and the compiler will do a lot of black magic behind the scenes to get you a performant executable (somehow). But for most traditional compilers you are still going to have to define how to approach your problem, even if only at a higher level thanks to libraries.

reply