2 ms·
> It is a leaky abstraction, all abstractions are. It’s not leaky (and that term is kind of meh). It’s just an abstraction! Such optimizations are supposed t
by keybored 2y ago
> It is a leaky abstraction, all abstractions are.
It’s not leaky (and that term is kind of meh). It’s just an abstraction! Such optimizations are supposed to be abstracted away (point 1).[1] The problem comes when that is inconvenient; when the client does not want it to be abstracted away.
There’s a mismatch there.
[1] EDIT: The point here is that the API is too abstracted compared to what the client wants. Of course the API could choose to not abstract certain things. For example the Vec[2] type in Rust has specified, as part of the documentation, how it is implemented (to a large degree). They could call it something like “List” and say that whatever the concrete implementation is, is an implementation detail. But they chose not to.
[2] https://doc.rust-lang.org/std/vec/struct.Vec.html#capacity-and-reallocation https://doc.rust-lang.org/std/vec/struct.Vec.html#capacity-a...