News for hackers. Stuff that matters.
Re:Examples of Incorrect Abstractions in Other Languages by naasking on Wednesday May 20, 2020 @08:02AM (#23245828)
> I don't think this is incorrect at all! There's a very good reason to use join instead of sum for adding strings together: join is a lot more efficient than simply adding strings together, because it will precompute the amount of space needed for the resulting string at once and then put all the strings into the buffer at once, whereas using sum in the naïve way suggested would do a different append for each element.

Differing performance characteristics should not break the semantics of an abstraction. That's an abstraction leak which prevents writing generalized abstractions.

There are no comments on this comment yet.