Hacker News new | ask | show | jobs
by bjourne 4687 days ago
You're missing the point. If you are appending items to a sequence, you are better of using a linked list type which is why your argument doesn't hold because you wouldn't be using an array type in the first place. But with "strings are character arrays" you can't choose. In the next step you get a proliferation of competing text types all because the default one wasn't defined as an adt.

Furthermore it isn't god given that the right way to iterate a text is character by character. Word by word or line by line is equally common. It's therefore completely arbitrary whether it's a character sequence, a line sequence or something else.

1 comments

No amount of abstraction will save you from finally having to determine how to represent the end result. That is totally orthogonal to the ability to delay the accumulation of something to be represented that way (which is just one strategy to achieve efficiency for this case anyway).