News for hackers. Stuff that matters.
Re:Optimizing Go string operations with practical examples by masklinn on Sunday December 03, 2023 @02:37AM (#38505528)
> it feels like even just having an iterator with a method to collect into a slice and nothing else would be preferable.

Most langages just have constructors or factory functions from iterator (or even iterable) to container. It’s a less generic (especially if constructors and functions are segregated) and / or efficient but otherwise works fine. No need for the iterator whatever (protocol, interface, trait) to have specific knowledge of individual collections.

There are no comments on this comment yet.