Trait Traversable has methods like toList , toMap , ToSeq . Given that List , Map , Seq are subclasses of Traversable , this creates a circular dependency, which is usually not a desirable design pattern.
I understand that this is limited to the collection library and provides some interesting conversion methods.
Has an alternative design been considered? For example, a utility class or adding conversion methods to Predef ?
Let's say I want to add a new class: class RandomList extends List {...} . It would be nice to have a toRandomList method for all Traversable classes, but for this I would have to βpimp my libraryβ implicitly on Traversable? This seems a little redundant. With the utility class design, I could simply extend this class (or Predef) to add my conversion method. What will be the recommended design here?
source share