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.
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.