World when: #aboutToEnterWorld send:to:

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

World when: #aboutToEnterWorld send:to:

Doug Edmunds
I was trying a tutorial at
http://coweb.cc.gatech.edu/cs2340/2200

I ran doIt on this code in a workspace of a project

   World when: #aboutToEnterWorld send: start to: Demo1.

(after creating the Demo1 class and the class method start.

Basically, all it does is open a Transcript and write
a line or two of text. It works every time I open that project.

My primary question is where is the result of the doIt being stored?
I would like to be able to change it, disable it, remove it, etc.
What tool do I use to find this line of code in the image?

How is it that sending code like this one time can cause it to run every
time the project gets opened?

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

Re: World when: #aboutToEnterWorld send:to:

Nicolas Cellier-3
Best way to find it out is to browse implementors of #when:send:to:
Then follow the messages chain:
- you see the "doIt" is stored as a WeakMessageSend
- which is sent to Object>>#when:evaluate:
- Object>>#setActionSequence:forEvent:
- Morph>>#updateableActionMap
- Morph>>#valueOfProperty:

Then you should be able to
        World inspect.
or:
        World explore.
select extensions, then otherProperties and search therein...

Now that you know where the WeakMessageSend is stored, you still have to
figure out how it is triggered.
You'll have to inquire about actionSequence you saw above...
I wish you a good browsing.

Note this usefull shortcut: you can select name of a message or a class
and hit ALT+b.

Nicolas

Doug Edmunds a écrit :

> I was trying a tutorial at
> http://coweb.cc.gatech.edu/cs2340/2200
>
> I ran doIt on this code in a workspace of a project
>
>    World when: #aboutToEnterWorld send: start to: Demo1.
>
> (after creating the Demo1 class and the class method start.
>
> Basically, all it does is open a Transcript and write
> a line or two of text. It works every time I open that project.
>
> My primary question is where is the result of the doIt being stored?
> I would like to be able to change it, disable it, remove it, etc.
> What tool do I use to find this line of code in the image?
>
> How is it that sending code like this one time can cause it to run every
> time the project gets opened?
>
> - dae

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

Re: World when: #aboutToEnterWorld send:to:

Nicolas Cellier-3
Another clue: do this in a workspace:

        SystemNavigation default browseAllCallsOn: #aboutToEnterWorld



nicolas cellier a écrit :

> Best way to find it out is to browse implementors of #when:send:to:
> Then follow the messages chain:
> - you see the "doIt" is stored as a WeakMessageSend
> - which is sent to Object>>#when:evaluate:
> - Object>>#setActionSequence:forEvent:
> - Morph>>#updateableActionMap
> - Morph>>#valueOfProperty:
>
> Then you should be able to
>     World inspect.
> or:
>     World explore.
> select extensions, then otherProperties and search therein...
>
> Now that you know where the WeakMessageSend is stored, you still have to
> figure out how it is triggered.
> You'll have to inquire about actionSequence you saw above...
> I wish you a good browsing.
>
> Note this usefull shortcut: you can select name of a message or a class
> and hit ALT+b.
>
> Nicolas
>
> Doug Edmunds a écrit :
>> I was trying a tutorial at
>> http://coweb.cc.gatech.edu/cs2340/2200
>>
>> I ran doIt on this code in a workspace of a project
>>
>>    World when: #aboutToEnterWorld send: start to: Demo1.
>>
>> (after creating the Demo1 class and the class method start.
>>
>> Basically, all it does is open a Transcript and write
>> a line or two of text. It works every time I open that project.
>>
>> My primary question is where is the result of the doIt being stored?
>> I would like to be able to change it, disable it, remove it, etc.
>> What tool do I use to find this line of code in the image?
>>
>> How is it that sending code like this one time can cause it to run every
>> time the project gets opened?
>>
>> - dae

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

Re: Re: World when: #aboutToEnterWorld send:to:

Doug Edmunds
In reply to this post by Nicolas Cellier-3
Thanks. Some progress:

I see this structure:
Each project has a unique World (a PasteUpMorph)
PasteUpMorph inherits the instance variable "extension" from Morph
Morph initializes extension as a MorphExtension (method initializeExtension)
  (so World extension is a MorphExtension)

MorphExtension otherProperties is an instance variable of MorphExtension
MorphExtension initializes otherProperties as an IdentityDictionary
(method initializeOtherProperties)

When I evaluated
World when: #aboutToEnterWorld send: start to: Demo1.
it created  this entry in World extension otherProperties :
(actionMap -> an IdentityDictionary
in which it stored this key/value
(#aboutToEnterWorld -> WeakMessageSend(nil -> Demo1) ))

Evaluating a series of MorphExtension methods, I was able to remove the
code.

World extension hasProperty: #actionMap  (true)
World extension valueOfProperty:  #actionMap (shows current value of
#actionMap).
World extension removeProperty: #actionMap
World extension hasProperty: #actionMap  (false)

Now this does not explain why it runs automatically when the project is
opened nor does it explain where /how the actionMap key is created ....

nicolas cellier wrote:
>

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