Hi, would it be possible to somehow call a method directly on a trait? e.g. Trait named: #TMyTrait. then add method TMyTrait>>twelve ^ 12 and then I could do `TMyTrait twelve "-> 12"`. Note that I cannot use Class-side of a regular class, because of name clashes with system (Class, ClassDescription, ...) selectors. Thanks, Peter
Hi, No, it's the same as in classes. If methods are on the instance side, you cannot call them unless you instantiate the class. Guille On Wed, Apr 26, 2017 at 2:24 PM, Peter Uhnak <i.uhnak@gmail.com> wrote:
Hi,
would it be possible to somehow call a method directly on a trait?
e.g.
Trait named: #TMyTrait.
then add method
TMyTrait>>twelve ^ 12
and then I could do `TMyTrait twelve "-> 12"`.
Note that I cannot use Class-side of a regular class, because of name clashes with system (Class, ClassDescription, ...) selectors.
Thanks, Peter
But trait is already instance, no? (instance of Trait class) Or is that like an instance of an instance? On Wed, Apr 26, 2017 at 03:03:42PM +0200, Guillermo Polito wrote:
Hi,
No, it's the same as in classes. If methods are on the instance side, you cannot call them unless you instantiate the class.
Guille
On Wed, Apr 26, 2017 at 2:24 PM, Peter Uhnak <i.uhnak@gmail.com> wrote:
Hi,
would it be possible to somehow call a method directly on a trait?
e.g.
Trait named: #TMyTrait.
then add method
TMyTrait>>twelve ^ 12
and then I could do `TMyTrait twelve "-> 12"`.
Note that I cannot use Class-side of a regular class, because of name clashes with system (Class, ClassDescription, ...) selectors.
Thanks, Peter
Traits are instances as classes are instances :) On Wed, Apr 26, 2017 at 3:22 PM, Peter Uhnak <i.uhnak@gmail.com> wrote:
But trait is already instance, no? (instance of Trait class) Or is that like an instance of an instance?
On Wed, Apr 26, 2017 at 03:03:42PM +0200, Guillermo Polito wrote:
Hi,
No, it's the same as in classes. If methods are on the instance side, you cannot call them unless you instantiate the class.
Guille
On Wed, Apr 26, 2017 at 2:24 PM, Peter Uhnak <i.uhnak@gmail.com> wrote:
Hi,
would it be possible to somehow call a method directly on a trait?
e.g.
Trait named: #TMyTrait.
then add method
TMyTrait>>twelve ^ 12
and then I could do `TMyTrait twelve "-> 12"`.
Note that I cannot use Class-side of a regular class, because of name clashes with system (Class, ClassDescription, ...) selectors.
Thanks, Peter
Ah, right. Well, one less dead-end to worry about. :) Thanks, Peter On Wed, Apr 26, 2017 at 04:20:07PM +0200, Guillermo Polito wrote:
Traits are instances as classes are instances :)
On Wed, Apr 26, 2017 at 3:22 PM, Peter Uhnak <i.uhnak@gmail.com> wrote:
But trait is already instance, no? (instance of Trait class) Or is that like an instance of an instance?
On Wed, Apr 26, 2017 at 03:03:42PM +0200, Guillermo Polito wrote:
Hi,
No, it's the same as in classes. If methods are on the instance side, you cannot call them unless you instantiate the class.
Guille
On Wed, Apr 26, 2017 at 2:24 PM, Peter Uhnak <i.uhnak@gmail.com> wrote:
Hi,
would it be possible to somehow call a method directly on a trait?
e.g.
Trait named: #TMyTrait.
then add method
TMyTrait>>twelve ^ 12
and then I could do `TMyTrait twelve "-> 12"`.
Note that I cannot use Class-side of a regular class, because of name clashes with system (Class, ClassDescription, ...) selectors.
Thanks, Peter
participants (2)
-
Guillermo Polito -
Peter Uhnak