[Pharo-project] Problem with Traits and #initialize.

Mariano Martinez Peck marianopeck at gmail.com
Sat Jun 4 07:40:06 EDT 2011


On Sat, Jun 4, 2011 at 12:28 PM, Lukas Renggli <renggli at gmail.com> wrote:

> Did you look at TraitBehavior>>#initialize and Behavior>>#initialize?
> They both clear the method dictionary, reset superclass, clear users
> and traits, etc.
>
>
Thanks for the point. I can see now.


> What you observe is what is implemented in these methods. Normally you
> should never call class-side initialize methods manually, the system
> does


yeah, the system *should* do it for me. I cannot reproduce it, but I find
myself several times having to explicitly send class side #initialize
becasue Monticello did not do it.


> this for you if necessary.
>
> Lukas
>
> On 4 June 2011 12:04, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:
> > why would it make sense to send initialize?
> >
> > Stef
> >
> > On Jun 4, 2011, at 11:42 AM, Mariano Martinez Peck wrote:
> >
> >> 1) Browse the example Trait1  and you will see methods like:
> >> Trait1 >> c
> >>
> >>     ^ 'Trait1>>c'
> >>
> >> and:
> >>
> >> Trait1 >> c1
> >>
> >>     ^ 'Trait1>>c1'
> >>
> >>
> >> 2) Now, execute "Trait1 initialize"
> >> 3) BOOM. Trait1 has no longo any method. In the browse they are shown
> like:
> >>
> >> Trait1 >> c
> >>     "This method does not exist."
> >>     self halt.
> >>
> >> Trait2 >> c1
> >>     "This method does not exist."
> >>     self halt.
> >>
> >> ....
> >>
> >> If I see Trait >> initialize
> >>     super initialize.
> >>     classTrait := ClassTrait for: self
> >>
> >>
> >> and then ClassTrait for:
> >>     "This method does not exist."
> >>     self halt.
> >>
> >>
> >> wtf ??   that method is removed? this even happens before doing Trait1
> initialize.
> >>
> >> so...any idea?
> >>
> >>
> >> --
> >> Mariano
> >> http://marianopeck.wordpress.com
> >>
> >
> >
> >
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
>


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20110604/1af3dab1/attachment-0001.html>


More information about the Pharo-dev mailing list