MorphMorph new / Morph newStandAlone Difference ?

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

MorphMorph new / Morph newStandAlone Difference ?

jrm
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: MorphMorph new / Morph newStandAlone Difference ?

cdavidshaffer
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 <[hidden email]> 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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
jrm
Reply | Threaded
Open this post in threaded view
|

Re: MorphMorph new / Morph newStandAlone Difference ?

jrm
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 <[hidden email]> 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 <[hidden email]> 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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners