3 ms·
> 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 o
by masklinn 3y ago
> 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.