4

Is it possible to use instanceVariables when using traits in Pharo Smalltalk?

Trait named: #Personnel
uses:{}
category: 'Test'

and I would like to add some variables that other Classes can use from these traits. Is this possible in Smalltalk?

1 Answer 1

9

No. Traits are stateless composable units, which in plain means: no attributes, just methods.

For a more detailed explanation, you can take a look at: http://scg.unibe.ch/archive/papers/Scha03aTraits.pdf

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.