[Newbies] MorphMorph new / Morph newStandAlone Difference ?

John-Reed Maffeo jrmaffeo at gmail.com
Thu Jul 25 16:09:40 UTC 2019


David,
Your answer was very helpful. It enabled me understand Smalltalk better.

#newStandAlone is implemented in #Morph with the expectation that the
method #initializeToStandAlone will be overridden in subClasses. The
comment in the method is long and I did not understand it. I still don't
quite understand why the same behavior cannot be implemented in #initialize.

By reviewing the implementors of #newStandAlone, I see that the behavior is
required(?) to create an object that can be used in a PartsBin(Flap?), but
not all classes assign the method to the category #partsbin; it also
appears in the categories #initialization and #miscellaneous (which should
ideally be changed for consistency, which I would be happy to do if
appropriate).

-jrm

On Thu, Jul 25, 2019 at 8:08 AM David Shaffer <cdshaffer at acm.org> wrote:

> This isn’t much help but….
>
> Just browsing implementors of #newStandAlone and then
> #initializeStandAlone (send from #newStandAlone), it looks like it has to
> do with creating an “example” morph that can “stand alone” in a parts bin.
> Some morphs definitely act differently in the parts bin (like the trash
> morph).  To see the difference in one example, look at StringMorph’s
> #initialize vs #initializeStandAlone and note the differences between:
>
> StringMorph new openInWorld.
> StringMorph newStandAlone openInWorld.
>
> David
>
> On Jul 25, 2019, at 10:59 AM, John-Reed Maffeo <jrmaffeo at gmail.com> wrote:
>
> What is the difference between these new messages? I created objects using
> both and I don't see anything different other (object number ?)
>
> Morph(1309470)  < new
> Morph(364522)  < newStandAlone
>
> -jrm
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20190725/f2120d43/attachment-0001.html>


More information about the Beginners mailing list