Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

instanceVariables in traits smalltalk

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?

like image 512
JasperTack Avatar asked Jan 15 '23 14:01

JasperTack


1 Answers

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

like image 143
EstebanLM Avatar answered Jan 29 '23 11:01

EstebanLM