I am having second thoughts about collection wrapper classes – and realizing that maybe some of my earlier comments were wrong. (This is separate from my suggestion for the extension declaration syntax with no instance name.)
Going back to my basic example:
case class Tracks(tracks: Vector[Track]):
I was thinking that I needed extension functions on Vector[Track]
to avoid constant wrapping and unwrapping of the Vector[Track]
class to get things done. However, I am now realizing that just adding
import tracks.*
export tracks.*
at the top of the Tracks class should give me all the Vector functions I need, including head, last, length, take,
++
, :+
, etc. That should allow me to essentially “work through the wrapper” and avoid explicit wrapping and unwrapping (without using any extensions). Am I on the right track here, or am I missing something?