Extending scala.collection.Seq in Scala 3

Hi all,

I want a generic Seq (both immutable and mutable) and subtypes to sport new methods.

For Scala 2.13 I have been introduced to the pattern implemented in the following Scastie, see Scastie - An interactive playground for Scala.

It works just fine.

Which could be the correct equivalent for Scala 3?
I have tried with extension but didn’t quite get there…

By the way the question is connected to my previous post Circular Vector custom collection, but it stands without the need to going back there.

Thank you in advance,


You might be looking for this Allow exports in extension clauses by odersky · Pull Request #14497 · lampepfl/dotty · GitHub. It will be available in the next minor release.

@nicolasstucki Nicolas thank you very much for the pointer, I will test this feature as soon as released.