Obtaining traits by name

Adrian Lienhard adi at netstyle.ch
Thu Mar 8 09:28:51 UTC 2007


Hi Keith,

Obtaining traits works the same as for classes, i.e., they are also  
stored in the system dictionary. Instead of Smalltalk>>at: you can  
also use Smalltalk>>classOrTraitNamed:.
Of course, if you do not need to obtain the trait dynamically from a  
string, you can just type it in the method source or the doit.

Adrian

On Mar 8, 2007, at 08:04 , Keith Hodges wrote:

> Is there a preferred method for obtaining a Trait by name. I see  
> that Trait goes to the troble of defining #environment.
>
> Trait named: blah etc can be used to define a trait. Is there a  
> method such as Trait named: 'myTrait'  for obtaining a Trait?
>
> Smalltalk at: #TMyTrait works, but I am wondering if there is a  
> better way.
>
> thanks in advance
>
> Keith
>
> 		
> ___________________________________________________________ Try the  
> all-new Yahoo! Mail. "The New Version is radically easier to use" –  
> The Wall Street Journal http://uk.docs.yahoo.com/nowyoucan.html
>




More information about the Squeak-dev mailing list