leansleft problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

leansleft problem

Roelof
If I understood everything well on page 26 my Cell initialize must look
like this:

initialize
     super initialize.
     self initializeActiveSegments.
     self initializeExitSides.
     self leanleft.

The Blankcell initialize must look like this :

initialize
     super initialize.
     self initializeExitSides.

And the MirrorCell initialize must look like this :

initialize
     super initialize
     self leansLeft: true

Why then I see a message that leanleft is not Understood in Blankcell.
or do I misunderstood that page. I find it a very confusing page.

Roelof

Reply | Threaded
Open this post in threaded view
|

Re: leansleft problem

Nicolai Hess
2014-04-02 16:40 GMT+02:00 Roelof Wobben <[hidden email]>:
If I understood everything well on page 26 my Cell initialize must look like this:

initialize
    super initialize.
    self initializeActiveSegments.
    self initializeExitSides.
    self leanleft.

The Blankcell initialize must look like this :

initialize
    super initialize.
    self initializeExitSides.

And the MirrorCell initialize must look like this :

initialize
    super initialize
    self leansLeft: true

Why then I see a message that leanleft is not Understood in Blankcell.
or do I misunderstood that page. I find it a very confusing page.

Roelof



No,
Cell initialize is
super initialize.
self initializeActiveSegments.

MirrorCell initialize is
super initialize.
self initializeExitSides.
self leanLeft


Reply | Threaded
Open this post in threaded view
|

Re: leansleft problem

Roelof
Nicolai Hess schreef op 2-4-2014 17:05:
2014-04-02 16:40 GMT+02:00 Roelof Wobben <[hidden email]>:
If I understood everything well on page 26 my Cell initialize must look like this:

initialize
    super initialize.
    self initializeActiveSegments.
    self initializeExitSides.
    self leanleft.

The Blankcell initialize must look like this :

initialize
    super initialize.
    self initializeExitSides.

And the MirrorCell initialize must look like this :

initialize
    super initialize
    self leansLeft: true

Why then I see a message that leanleft is not Understood in Blankcell.
or do I misunderstood that page. I find it a very confusing page.

Roelof



No,
Cell initialize is
super initialize.
self initializeActiveSegments.

MirrorCell initialize is
super initialize.
self initializeExitSides.
self leanLeft



Thanks

Roelof

Reply | Threaded
Open this post in threaded view
|

Re: leansleft problem

Ben Coman
In reply to this post by Roelof
Roelof Wobben wrote:

> If I understood everything well on page 26 my initialize methods must
> look like this:
>
> Cell >> initialize
>     super initialize.
>     self initializeActiveSegments.
>     self initializeExitSides.
>     self leanleft.
>
> BlankCell >> initialize
>     super initialize.
>     self initializeExitSides.
>
> MirrorCell >> initialize
>     super initialize
>     self leansLeft: true
>
> Why then I see a message that #leanleft is not Understood in Blankcell.
> or do I misunderstood that page. I find it a very confusing page.
>
> Roelof
>
>
I've updated your example using the # and >> convention to describe
methods and the classes they belong to.

So the MNU (Message Not Understood) indicates that BlankCell doesn't
know how to #leanLeft
Now the first question you should ask yourself is "Does BlankCell or one
of its superclasses define #leftLeft ?"
Or the same question in another form "Which classes is #leanLeft defined
on?"
Note that the #leanleft is distinct from #leanLeft.
------------------------complete above before continuing

Your next question is "what is causing #leanLeft" to be called on a
BlankCell?"
Now to simply things I presume evaluating the following in Workspace
creates the same error...
    BlankCell new  <doIt>

So what you want to do is
    BlankCell new <debugIt>
and trace through until you find where #leanLeft is about to be
executed.  Pay attention in the call stack to when BlankCell>>initialize
transitions to Cell>initialize.
------------------------complete above before continuing

Now when debugging "BlankCell new" traces into Cell >> initialize, note
that "self leanLeft" refers send the message #leanLeft to the BlankCell
object, which then checks to see if BlankCell>>leanLeft is defined, and
then looks in the superclass to see if Cell>>leanLeft is defined, and
the looks in the next superclass to see if Object>>leanLeft is defined -
and if a definition is not found then BlankCell has a MNU.

So... I think your Cell>>initialize is incorrect.  It would be useful to
know in more detail what makes you think it should look like that - to
deconstruct your confusion. Cell was only introduced on page 35, and its
initialize method looked like this
    Cell>>initialize
       super initialize.
       self initializeActiveSegments.
I see nothing else on page 25 or 26 that indicates any further change to
Cell>>initialize.

The only thing I can guess at it that you've confused the bottom right
snapshot as applying to Cell when I guess it applies only to MirrorCell.

cheers -ben