The Trunk: Morphic-ar.305.mcz

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

The Trunk: Morphic-ar.305.mcz

commits-2
Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ar.305.mcz

==================== Summary ====================

Name: Morphic-ar.305
Author: ar
Time: 11 January 2010, 8:05:58.998 pm
UUID: 84c8e065-50b4-f94d-b056-90263e496c28
Ancestors: Morphic-ul.304

- Promote isScriptEditorMorph to Object.
- Fix typo in prepareToBeSaved.

=============== Diff against Morphic-ul.304 ===============

Item was changed:
  ----- Method: PasteUpMorph>>prepareToBeSaved (in category 'misc') -----
  prepareToBeSaved
  "Prepare for export via the ReferenceStream mechanism"
 
  | exportDict soundKeyList players |
  super prepareToBeSaved.
  turtlePen := nil.
  self isWorldMorph
  ifTrue:
  [self removeProperty: #scriptsToResume.
  soundKeyList := Set new.
  (players := self presenter allExtantPlayers)
  do: [:aPlayer | aPlayer slotInfo
  associationsDo: [:assoc | assoc value type == #Sound
  ifTrue: [soundKeyList
  add: (aPlayer instVarNamed: assoc key)]]].
  players
  do: [:p | p allScriptEditors
  do: [:e | (e allMorphs
  select: [:m | m isSoundTile])
  do: [:aTile | soundKeyList add: aTile literal]]].
  (self allMorphs
  select: [:m | m isSoundTile])
- isTileMorph
  do: [:aTile | soundKeyList add: aTile literal].
  soundKeyList removeAllFoundIn: SampledSound universalSoundKeys.
  soundKeyList
  removeAllSuchThat: [:aKey | (SampledSound soundLibrary includesKey: aKey) not].
  soundKeyList isEmpty
  ifFalse: [exportDict := Dictionary new.
  soundKeyList
  do: [:aKey | exportDict
  add: (SampledSound soundLibrary associationAt: aKey)].
  self setProperty: #soundAdditions toValue: exportDict]]!

Item was removed:
- ----- Method: Morph>>isScriptEditorMorph (in category 'classification') -----
- isScriptEditorMorph
- ^false!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-ar.305.mcz

Levente Uzonyi-2
On Tue, 12 Jan 2010, [hidden email] wrote:

> Andreas Raab uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-ar.305.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-ar.305
> Author: ar
> Time: 11 January 2010, 8:05:58.998 pm
> UUID: 84c8e065-50b4-f94d-b056-90263e496c28
> Ancestors: Morphic-ul.304
>
> - Promote isScriptEditorMorph to Object.

Looking at current uses of #isScriptEditorMorph, it seems to be better
to keep it at Morph and add #isMorph checks to the two places which seem
to send it to other objects. This method also seems to be EToys related,
so moving is to the EToys package might be a good idea.
Thoughts?


Levente

> - Fix typo in prepareToBeSaved.
>
> =============== Diff against Morphic-ul.304 ===============
>
> Item was changed:
>  ----- Method: PasteUpMorph>>prepareToBeSaved (in category 'misc') -----
>  prepareToBeSaved
>   "Prepare for export via the ReferenceStream mechanism"
>
>   | exportDict soundKeyList players |
>   super prepareToBeSaved.
>   turtlePen := nil.
>   self isWorldMorph
>   ifTrue:
>   [self removeProperty: #scriptsToResume.
>   soundKeyList := Set new.
>   (players := self presenter allExtantPlayers)
>   do: [:aPlayer | aPlayer slotInfo
>   associationsDo: [:assoc | assoc value type == #Sound
>   ifTrue: [soundKeyList
>   add: (aPlayer instVarNamed: assoc key)]]].
>   players
>   do: [:p | p allScriptEditors
>   do: [:e | (e allMorphs
>   select: [:m | m isSoundTile])
>   do: [:aTile | soundKeyList add: aTile literal]]].
>   (self allMorphs
>   select: [:m | m isSoundTile])
> - isTileMorph
>   do: [:aTile | soundKeyList add: aTile literal].
>   soundKeyList removeAllFoundIn: SampledSound universalSoundKeys.
>   soundKeyList
>   removeAllSuchThat: [:aKey | (SampledSound soundLibrary includesKey: aKey) not].
>   soundKeyList isEmpty
>   ifFalse: [exportDict := Dictionary new.
>   soundKeyList
>   do: [:aKey | exportDict
>   add: (SampledSound soundLibrary associationAt: aKey)].
>   self setProperty: #soundAdditions toValue: exportDict]]!
>
> Item was removed:
> - ----- Method: Morph>>isScriptEditorMorph (in category 'classification') -----
> - isScriptEditorMorph
> - ^false!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-ar.305.mcz

Andreas.Raab
Levente Uzonyi wrote:

> On Tue, 12 Jan 2010, [hidden email] wrote:
>
>> Andreas Raab uploaded a new version of Morphic to project The Trunk:
>> http://source.squeak.org/trunk/Morphic-ar.305.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Morphic-ar.305
>> Author: ar
>> Time: 11 January 2010, 8:05:58.998 pm
>> UUID: 84c8e065-50b4-f94d-b056-90263e496c28
>> Ancestors: Morphic-ul.304
>>
>> - Promote isScriptEditorMorph to Object.
>
> Looking at current uses of #isScriptEditorMorph, it seems to be better
> to keep it at Morph and add #isMorph checks to the two places which seem
> to send it to other objects. This method also seems to be EToys related,
> so moving is to the EToys package might be a good idea.
> Thoughts?

Neither. For one thing, this method already says isScriptEditorMORPH so
it obviously implies isMorph == true. (this would be different if it
were isScriptEditor because there might be non-morph script editors).

And it clearly can't be moved to the Etoys package - the whole purpose
of the method is to make it possibly to unload Etoys and get
isScriptEditorMorph == false for all other objects. This would blow up
straight into your face if you'd move it to Etoys. Same goes for
MorphExtension>>actorState, MorphExtension>>player etc. They all need to
stay in the original packages since after unloading Etoys these messages
will still be sent; they will just never return true / non-nil respectively.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Re: The Trunk: Morphic-ar.305.mcz

Levente Uzonyi-2
On Mon, 11 Jan 2010, Andreas Raab wrote:

> Levente Uzonyi wrote:
>> On Tue, 12 Jan 2010, [hidden email] wrote:
>>
>>> Andreas Raab uploaded a new version of Morphic to project The Trunk:
>>> http://source.squeak.org/trunk/Morphic-ar.305.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: Morphic-ar.305
>>> Author: ar
>>> Time: 11 January 2010, 8:05:58.998 pm
>>> UUID: 84c8e065-50b4-f94d-b056-90263e496c28
>>> Ancestors: Morphic-ul.304
>>>
>>> - Promote isScriptEditorMorph to Object.
>>
>> Looking at current uses of #isScriptEditorMorph, it seems to be better to
>> keep it at Morph and add #isMorph checks to the two places which seem to
>> send it to other objects. This method also seems to be EToys related, so
>> moving is to the EToys package might be a good idea.
>> Thoughts?
>
> Neither. For one thing, this method already says isScriptEditorMORPH so it
> obviously implies isMorph == true. (this would be different if it were
> isScriptEditor because there might be non-morph script editors).

In this case all is*Morph methods should be moved to Object from Morph.

>
> And it clearly can't be moved to the Etoys package - the whole purpose of the
> method is to make it possibly to unload Etoys and get isScriptEditorMorph ==
> false for all other objects. This would blow up straight into your face if
> you'd move it to Etoys. Same goes for MorphExtension>>actorState,
> MorphExtension>>player etc. They all need to stay in the original packages
> since after unloading Etoys these messages will still be sent; they will just
> never return true / non-nil respectively.

Of course moving it to EToys would require refactoring of the code.


Levente

>
> Cheers,
>  - Andreas
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-ar.305.mcz

Andreas.Raab
Levente Uzonyi wrote:
> On Mon, 11 Jan 2010, Andreas Raab wrote:
>> Neither. For one thing, this method already says isScriptEditorMORPH
>> so it obviously implies isMorph == true. (this would be different if
>> it were isScriptEditor because there might be non-morph script editors).
>
> In this case all is*Morph methods should be moved to Object from Morph.

Let's not split hairs here. Obviously such tests should be declared on
the smallest reasonable scope. I'll remind you that I promoted that
method only because it was actually sent to non-morphs. But at that
point it's just silly to write, e.g., (obj isMorph and:[obj isBarMorph
and:[obj isFooBarMorph]]) instead of obj isFooBarMorph.

>> And it clearly can't be moved to the Etoys package - the whole purpose
>> of the method is to make it possibly to unload Etoys and get
>> isScriptEditorMorph == false for all other objects. This would blow up
>> straight into your face if you'd move it to Etoys. Same goes for
>> MorphExtension>>actorState, MorphExtension>>player etc. They all need
>> to stay in the original packages since after unloading Etoys these
>> messages will still be sent; they will just never return true /
>> non-nil respectively.
>
> Of course moving it to EToys would require refactoring of the code.

Knock yourself out. I think there's far bigger fish to fry with regards
to unloading code but if that's what you'd like to work on be my guest.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Re: The Trunk: Morphic-ar.305.mcz

Levente Uzonyi-2
On Mon, 11 Jan 2010, Andreas Raab wrote:

> Levente Uzonyi wrote:
>> On Mon, 11 Jan 2010, Andreas Raab wrote:
>>> Neither. For one thing, this method already says isScriptEditorMORPH so it
>>> obviously implies isMorph == true. (this would be different if it were
>>> isScriptEditor because there might be non-morph script editors).
>>
>> In this case all is*Morph methods should be moved to Object from Morph.
>
> Let's not split hairs here. Obviously such tests should be declared on the
> smallest reasonable scope. I'll remind you that I promoted that method only
> because it was actually sent to non-morphs. But at that point it's just silly
> to write, e.g., (obj isMorph and:[obj isBarMorph and:[obj isFooBarMorph]])
> instead of obj isFooBarMorph.
>
>>> And it clearly can't be moved to the Etoys package - the whole purpose of
>>> the method is to make it possibly to unload Etoys and get
>>> isScriptEditorMorph == false for all other objects. This would blow up
>>> straight into your face if you'd move it to Etoys. Same goes for
>>> MorphExtension>>actorState, MorphExtension>>player etc. They all need to
>>> stay in the original packages since after unloading Etoys these messages
>>> will still be sent; they will just never return true / non-nil
>>> respectively.
>>
>> Of course moving it to EToys would require refactoring of the code.
>
> Knock yourself out. I think there's far bigger fish to fry with regards to
> unloading code but if that's what you'd like to work on be my guest.

I'm not about to work on that, my list is already too long and my
knowledge about Morphic and EToys is not enough to do that properly. But
it would be good if
- we could unload packages with all related code
- Object protocol would be smaller


Levente
>
> Cheers,
>  - Andreas
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Re: The Trunk: Morphic-ar.305.mcz

Juan Vuletich-4
Levente Uzonyi wrote:

> On Mon, 11 Jan 2010, Andreas Raab wrote:
>
>> Levente Uzonyi wrote:
>>> On Mon, 11 Jan 2010, Andreas Raab wrote:
>>>> Neither. For one thing, this method already says
>>>> isScriptEditorMORPH so it obviously implies isMorph == true. (this
>>>> would be different if it were isScriptEditor because there might be
>>>> non-morph script editors).
>>>
>>> In this case all is*Morph methods should be moved to Object from Morph.
>>
>> Let's not split hairs here. Obviously such tests should be declared
>> on the smallest reasonable scope. I'll remind you that I promoted
>> that method only because it was actually sent to non-morphs. But at
>> that point it's just silly to write, e.g., (obj isMorph and:[obj
>> isBarMorph and:[obj isFooBarMorph]]) instead of obj isFooBarMorph.
>>
>>>> And it clearly can't be moved to the Etoys package - the whole
>>>> purpose of the method is to make it possibly to unload Etoys and
>>>> get isScriptEditorMorph == false for all other objects. This would
>>>> blow up straight into your face if you'd move it to Etoys. Same
>>>> goes for MorphExtension>>actorState, MorphExtension>>player etc.
>>>> They all need to stay in the original packages since after
>>>> unloading Etoys these messages will still be sent; they will just
>>>> never return true / non-nil respectively.
>>>
>>> Of course moving it to EToys would require refactoring of the code.
>>
>> Knock yourself out. I think there's far bigger fish to fry with
>> regards to unloading code but if that's what you'd like to work on be
>> my guest.
>
> I'm not about to work on that, my list is already too long and my
> knowledge about Morphic and EToys is not enough to do that properly.
> But it would be good if
> - we could unload packages with all related code
> - Object protocol would be smaller

The real solution here is to send 'is: #ScriptEditorMorph' and implement

Object >> is: aSymbol
    "A means for cleanly replacing all isXXX like methods.
    Please use judiciously!
    Suggested by Igor Stasenko at
   
http://lists.squeakfoundation.org/pipermail/squeak-dev/2009-June/136793.html"

    ^false

ScriptEditorMorph >> is: aSymbol
    ^ aSymbol = #ScriptEditorMorph or: [ super is: aSymbol ]

In this way you easily get rid of all #isXXX methods (at least, all that
just answer the true or false constants). Much more interesting: when
you unload EToys there is no knowledge about ScriptEditorMorph in
unrelated classes (such as Morph or Object).

Cheers,
Juan Vuletich

>
>
> Levente
>>
>> Cheers,
>>  - Andreas
>>
>>


Reply | Threaded
Open this post in threaded view
|

Re: Re: The Trunk: Morphic-ar.305.mcz

Miguel Cobá
El mar, 12-01-2010 a las 07:59 -0300, Juan Vuletich escribió:

> Levente Uzonyi wrote:
> > On Mon, 11 Jan 2010, Andreas Raab wrote:
> >
> >> Levente Uzonyi wrote:
> >>> On Mon, 11 Jan 2010, Andreas Raab wrote:
> >>>> Neither. For one thing, this method already says
> >>>> isScriptEditorMORPH so it obviously implies isMorph == true. (this
> >>>> would be different if it were isScriptEditor because there might be
> >>>> non-morph script editors).
> >>>
> >>> In this case all is*Morph methods should be moved to Object from Morph.
> >>
> >> Let's not split hairs here. Obviously such tests should be declared
> >> on the smallest reasonable scope. I'll remind you that I promoted
> >> that method only because it was actually sent to non-morphs. But at
> >> that point it's just silly to write, e.g., (obj isMorph and:[obj
> >> isBarMorph and:[obj isFooBarMorph]]) instead of obj isFooBarMorph.
> >>
> >>>> And it clearly can't be moved to the Etoys package - the whole
> >>>> purpose of the method is to make it possibly to unload Etoys and
> >>>> get isScriptEditorMorph == false for all other objects. This would
> >>>> blow up straight into your face if you'd move it to Etoys. Same
> >>>> goes for MorphExtension>>actorState, MorphExtension>>player etc.
> >>>> They all need to stay in the original packages since after
> >>>> unloading Etoys these messages will still be sent; they will just
> >>>> never return true / non-nil respectively.
> >>>
> >>> Of course moving it to EToys would require refactoring of the code.
> >>
> >> Knock yourself out. I think there's far bigger fish to fry with
> >> regards to unloading code but if that's what you'd like to work on be
> >> my guest.
> >
> > I'm not about to work on that, my list is already too long and my
> > knowledge about Morphic and EToys is not enough to do that properly.
> > But it would be good if
> > - we could unload packages with all related code
> > - Object protocol would be smaller
>
> The real solution here is to send 'is: #ScriptEditorMorph' and implement
>
> Object >> is: aSymbol
>     "A means for cleanly replacing all isXXX like methods.
>     Please use judiciously!
>     Suggested by Igor Stasenko at
>    
> http://lists.squeakfoundation.org/pipermail/squeak-dev/2009-June/136793.html"
>
>     ^false
>
> ScriptEditorMorph >> is: aSymbol
>     ^ aSymbol = #ScriptEditorMorph or: [ super is: aSymbol ]
>
> In this way you easily get rid of all #isXXX methods (at least, all that
> just answer the true or false constants). Much more interesting: when
> you unload EToys there is no knowledge about ScriptEditorMorph in
> unrelated classes (such as Morph or Object).


Cool! Everyday we learn something new. Thanks to Igor.

Cheers

>
> Cheers,
> Juan Vuletich
>
> >
> >
> > Levente
> >>
> >> Cheers,
> >>  - Andreas
> >>
> >>
>
>

--
Miguel Cobá
http://miguel.leugim.com.mx