A Traits question

itsme213 itsme213 at hotmail.com
Thu Feb 14 16:43:02 UTC 2008


I have encountered several places where I would use traits if I could 
parameterize the required methods (in addition to the provided methods, 
which I can currently do).

TraitA>>a
  self x
TraitA>>b
  self y

Object subclass: MyClass
 "should distinguish required from provided, but simplified..."
  uses:  { TraitA @ { #a->#a1. #x->#x1 }.
           TraitA @ { #a->#a2. #x->#x2 } }


Where the intent is roughly equivalent to some intermediate traits:
TraitA>>a
  self x
TraitA>>b
  self y

Trait named: #TraitA1 uses: { TraitA }
TraitA1>>a1
  self x1

Trait named: #TraitA2 uses: { TraitA }
TraitA2>>a2
  self x2

Would something like this be malformed (in trait terms)? Was it considered 
and rejected for some other reasons?

Thanks - Sophie






More information about the Squeak-dev mailing list