[Pharo-users] Traits for class methods?
Vitor Medina Cruz
vitormcruz at gmail.com
Mon Feb 11 13:52:34 EST 2019
It seems, however, that self points to the trait class, instead of the
target object class. Is that correct? Instance side methods behave as
expected and self points to the target object.
On Mon, Feb 11, 2019 at 2:19 PM Cyril Ferlicot <cyril.ferlicot at gmail.com>
> On Mon, Feb 11, 2019 at 4:50 PM Konrad Hinsen
> <konrad.hinsen at fastmail.net> wrote:
> > Hi everyone,
> > A quick question: is it possible to use traits to define class methods?
> > For example, could the popular singleton pattern consisting of the
> > three class methods #uniqueInstance, #new, and #reset plus the instance
> > variable uniqueInstance be packaged as a trait?
> Yes it is possible.
> > Konrad.
> Cyril Ferlicot
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-users