4 Jul 02:38
[Traits] Subclassing nested container types.
Is there a way to subclass composite types of container traits and keep all the validation intact? That is, right now, I have a trait that I initialize in the class as "List(Tuple(Int,Int))", that is, it must be a list of 2-tuples that contain only integers. I would like to add an extra step of validation, though, that constrains specifically what set of integers are allowed in the tuples, as well as (maybe) the length of the list. My natural thought was to make a subclass of the List trait, but is there any way to subclass it that will retain the checking for 2-tuples of only int type?
RSS Feed