traits
traits copied to clipboard
TraitList use-case: enforcing uniqueness
The current TraitList
has per-item validation, but no global list validation. In particular, the min-length and max-length validation that was previously available on List
traits seemed to add more complication that it was worth.
A use-case that turned up in an actual Traits-using project was enforcing uniqueness of the list contents (that is, ensuring that the list contained no duplicates).
It would be interesting to explore what changes we'd need to make to make that validation easily available to users, either via subclassing TraitList
, or via adding a suitable hook within TraitList
itself.