Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

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

Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Levente Uzonyi
While we are at it, it would be great to finally get rid of all
implementations of #startUp, and use #startUp: instead.

Why?
- implementing #startUp: in a class can interfere with the implementations
of #startUp in its subclasses (yes, it actually has happened)
- #startUp runs on image save, and in most cases, like this one, it
shouldn't

I think the same applies to #shutDown and #shutDown:.

Levente

On Thu, 4 Feb 2016, [hidden email] wrote:

> Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-mt.987.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-mt.987
> Author: mt
> Time: 4 February 2016, 3:06:38.350057 pm
> UUID: acfc6690-1289-41c3-984b-7f781b4a0a3f
> Ancestors: Kernel-eem.986
>
> Fixes regression with a non-working event handling mechanism on Windows machines, which occured due to the recent removal of InputSensor.
>
> Also fixes the double-interrupt problem when pressing CMD+.
>
> =============== Diff against Kernel-eem.986 ===============
>
> Item was changed:
>  ----- Method: EventSensor class>>initialize (in category 'class initialization') -----
>  initialize
>
>   Smalltalk addToStartUpList: self after: Cursor.
> + Smalltalk addToShutDownList: self.
> +
>   self installKeyDecodeTable.
>   self installMouseDecodeTable.
>   self install.
>
>  !
>
> Item was changed:
>  ----- Method: EventSensor>>shutDown (in category 'initialize') -----
>  shutDown
> +
>   InterruptWatcherProcess ifNotNil: [
>   InterruptWatcherProcess terminate.
> + InterruptWatcherProcess := nil ].
> +
> + EventTicklerProcess ifNotNil: [
> + EventTicklerProcess terminate.
> + EventTicklerProcess := nil. ].
> +
> + inputSemaphore ifNotNil:[Smalltalk unregisterExternalObject: inputSemaphore].!
> - InterruptWatcherProcess := nil ].!
>
> Item was changed:
>  ----- Method: EventSensor>>startUp (in category 'initialize') -----
>  startUp
> +
> + self initialize.
> + self primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore).
> +
> + self installInterruptWatcher.
> + self installEventTickler.
> +
> + Smalltalk isMorphic ifTrue: [self flushAllButDandDEvents].
> +
> + "Attempt to discover whether the input semaphore is actually being signaled."
> + hasInputSemaphore := false.
> + inputSemaphore initSignals.!
> - self installInterruptWatcher.!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Eliot Miranda-2


> On Feb 4, 2016, at 10:02 AM, Levente Uzonyi <[hidden email]> wrote:
>
> While we are at it, it would be great to finally get rid of all implementations of #startUp, and use #startUp: instead.
>
> Why?
> - implementing #startUp: in a class can interfere with the implementations of #startUp in its subclasses (yes, it actually has happened)
> - #startUp runs on image save, and in most cases, like this one, it shouldn't
>
> I think the same applies to #shutDown and #shutDown:.

+1.  Use of startUp: allows the method to do things only in system startup rather than in return from snapshot and is consequently more economical.


>
> Levente
>
>> On Thu, 4 Feb 2016, [hidden email] wrote:
>>
>> Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
>> http://source.squeak.org/trunk/Kernel-mt.987.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Kernel-mt.987
>> Author: mt
>> Time: 4 February 2016, 3:06:38.350057 pm
>> UUID: acfc6690-1289-41c3-984b-7f781b4a0a3f
>> Ancestors: Kernel-eem.986
>>
>> Fixes regression with a non-working event handling mechanism on Windows machines, which occured due to the recent removal of InputSensor.
>>
>> Also fixes the double-interrupt problem when pressing CMD+.
>>
>> =============== Diff against Kernel-eem.986 ===============
>>
>> Item was changed:
>> ----- Method: EventSensor class>>initialize (in category 'class initialization') -----
>> initialize
>>
>>    Smalltalk addToStartUpList: self after: Cursor.
>> +    Smalltalk addToShutDownList: self.
>> +
>>    self installKeyDecodeTable.
>>    self installMouseDecodeTable.
>>    self install.
>>
>> !
>>
>> Item was changed:
>> ----- Method: EventSensor>>shutDown (in category 'initialize') -----
>> shutDown
>> +
>>    InterruptWatcherProcess ifNotNil: [
>>        InterruptWatcherProcess terminate.
>> +        InterruptWatcherProcess := nil ].
>> +
>> +    EventTicklerProcess ifNotNil: [
>> +        EventTicklerProcess terminate.
>> +        EventTicklerProcess := nil. ].
>> +
>> +    inputSemaphore ifNotNil:[Smalltalk unregisterExternalObject: inputSemaphore].!
>> -        InterruptWatcherProcess := nil ].!
>>
>> Item was changed:
>> ----- Method: EventSensor>>startUp (in category 'initialize') -----
>> startUp
>> +
>> +    self initialize.
>> +    self primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore).
>> +
>> +    self installInterruptWatcher.
>> +    self installEventTickler.
>> +
>> +    Smalltalk isMorphic ifTrue: [self flushAllButDandDEvents].
>> +
>> +    "Attempt to discover whether the input semaphore is actually being signaled."
>> +    hasInputSemaphore := false.
>> +    inputSemaphore initSignals.!
>> -    self installInterruptWatcher.!
>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Chris Muller-3
Every time I want to do something in start up or shutdown, I find I
keep having to find examples and study these two methods; which calls
which?  What's the default arg?  And does the "resuming" boolean mean
the user pressed "Save" on the World Menu and resuming use of the
image, or does it mean just launched from the OS..?

Anything that would make these more lucid would be welcome.

On Thu, Feb 4, 2016 at 5:41 PM, Eliot Miranda <[hidden email]> wrote:

>
>
>> On Feb 4, 2016, at 10:02 AM, Levente Uzonyi <[hidden email]> wrote:
>>
>> While we are at it, it would be great to finally get rid of all implementations of #startUp, and use #startUp: instead.
>>
>> Why?
>> - implementing #startUp: in a class can interfere with the implementations of #startUp in its subclasses (yes, it actually has happened)
>> - #startUp runs on image save, and in most cases, like this one, it shouldn't
>>
>> I think the same applies to #shutDown and #shutDown:.
>
> +1.  Use of startUp: allows the method to do things only in system startup rather than in return from snapshot and is consequently more economical.
>
>
>>
>> Levente
>>
>>> On Thu, 4 Feb 2016, [hidden email] wrote:
>>>
>>> Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
>>> http://source.squeak.org/trunk/Kernel-mt.987.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: Kernel-mt.987
>>> Author: mt
>>> Time: 4 February 2016, 3:06:38.350057 pm
>>> UUID: acfc6690-1289-41c3-984b-7f781b4a0a3f
>>> Ancestors: Kernel-eem.986
>>>
>>> Fixes regression with a non-working event handling mechanism on Windows machines, which occured due to the recent removal of InputSensor.
>>>
>>> Also fixes the double-interrupt problem when pressing CMD+.
>>>
>>> =============== Diff against Kernel-eem.986 ===============
>>>
>>> Item was changed:
>>> ----- Method: EventSensor class>>initialize (in category 'class initialization') -----
>>> initialize
>>>
>>>    Smalltalk addToStartUpList: self after: Cursor.
>>> +    Smalltalk addToShutDownList: self.
>>> +
>>>    self installKeyDecodeTable.
>>>    self installMouseDecodeTable.
>>>    self install.
>>>
>>> !
>>>
>>> Item was changed:
>>> ----- Method: EventSensor>>shutDown (in category 'initialize') -----
>>> shutDown
>>> +
>>>    InterruptWatcherProcess ifNotNil: [
>>>        InterruptWatcherProcess terminate.
>>> +        InterruptWatcherProcess := nil ].
>>> +
>>> +    EventTicklerProcess ifNotNil: [
>>> +        EventTicklerProcess terminate.
>>> +        EventTicklerProcess := nil. ].
>>> +
>>> +    inputSemaphore ifNotNil:[Smalltalk unregisterExternalObject: inputSemaphore].!
>>> -        InterruptWatcherProcess := nil ].!
>>>
>>> Item was changed:
>>> ----- Method: EventSensor>>startUp (in category 'initialize') -----
>>> startUp
>>> +
>>> +    self initialize.
>>> +    self primSetInputSemaphore: (Smalltalk registerExternalObject: inputSemaphore).
>>> +
>>> +    self installInterruptWatcher.
>>> +    self installEventTickler.
>>> +
>>> +    Smalltalk isMorphic ifTrue: [self flushAllButDandDEvents].
>>> +
>>> +    "Attempt to discover whether the input semaphore is actually being signaled."
>>> +    hasInputSemaphore := false.
>>> +    inputSemaphore initSignals.!
>>> -    self installInterruptWatcher.!
>>>
>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Bert Freudenberg
+1 for startUp: over startUp.

IMHO we should still keep Behavior>>startUp for the benefit of third-party packages.

On 05.02.2016, at 01:55, Chris Muller <[hidden email]> wrote:
>
> Every time I want to do something in start up or shutdown, I find I
> keep having to find examples and study these two methods; which calls
> which?  What's the default arg?  And does the "resuming" boolean mean
> the user pressed "Save" on the World Menu and resuming use of the
> image, or does it mean just launched from the OS..?

How about we rename the “resuming” variable to “starting” everywhere?

I just tried various names in snapshot:andQuit:withExitCode:embedded:, processStartUpList:, and startUp: and this seems to do the job pretty well.

> Anything that would make these more lucid would be welcome.

Yep.

- Bert -




smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Bert Freudenberg
In reply to this post by Chris Muller-3
+1 for startUp: over startUp.

IMHO we should still keep Behavior>>startUp for the benefit of third-party packages.

On 05.02.2016, at 01:55, Chris Muller <[hidden email]> wrote:
>
> Every time I want to do something in start up or shutdown, I find I
> keep having to find examples and study these two methods; which calls
> which?  What's the default arg?  And does the "resuming" boolean mean
> the user pressed "Save" on the World Menu and resuming use of the
> image, or does it mean just launched from the OS..?

How about we rename the “resuming” variable to “starting” everywhere?

I just tried various names in snapshot:andQuit:withExitCode:embedded:, processStartUpList:, and startUp: and this seems to do the job pretty well.

> Anything that would make these more lucid would be welcome.

Yep.

- Bert -






smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

marcel.taeumel
In reply to this post by Bert Freudenberg
Hmm... I think we are also "resuming" after a snapshot. I find "(not) snapshotting" or "restarting" better somehow...

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Bert Freudenberg
On 05.02.2016, at 15:12, marcel.taeumel <[hidden email]> wrote:
>
> Hmm... I think we are also "resuming" after a snapshot.

That’s what Chris said, yes.

> I find "(not) snapshotting" or "restarting" better somehow…

That’s why I suggested “starting”.

- Bert -




smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

marcel.taeumel
...to be more precise: +1 :)

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Eliot Miranda-2
In reply to this post by Bert Freudenberg


On Fri, Feb 5, 2016 at 6:41 AM, Bert Freudenberg <[hidden email]> wrote:
On 05.02.2016, at 15:12, marcel.taeumel <[hidden email]> wrote:
>
> Hmm... I think we are also "resuming" after a snapshot.

That’s what Chris said, yes.

> I find "(not) snapshotting" or "restarting" better somehow…

That’s why I suggested “starting”.

How about adding some whimsey and using "startingAfresh"?  I'm seriously suggesting this because (at least for me) this is really evocative of launching a snapshot.

_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

RE: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Ron Teitelbaum

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Eliot Miranda

 

On Fri, Feb 5, 2016 at 6:41 AM, Bert Freudenberg <[hidden email]> wrote:

On 05.02.2016, at 15:12, marcel.taeumel <[hidden email]> wrote:
>
> Hmm... I think we are also "resuming" after a snapshot.

That’s what Chris said, yes.

> I find "(not) snapshotting" or "restarting" better somehow…

That’s why I suggested “starting”.

 

How about adding some whimsey and using "startingAfresh"?  I'm seriously suggesting this because (at least for me) this is really evocative of launching a snapshot.

 

[Ron Teitelbaum] how about just say what it is.  #startingAfterSave #startingAfterQuit

 

_,,,^..^,,,_

best, Eliot



Reply | Threaded
Open this post in threaded view
|

Re: Replace startUp with startUp: (was: Re: [squeak-dev] The Trunk: Kernel-mt.987.mcz)

Eliot Miranda-2


On Fri, Feb 5, 2016 at 9:03 AM, Ron Teitelbaum <[hidden email]> wrote:

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Eliot Miranda

 

On Fri, Feb 5, 2016 at 6:41 AM, Bert Freudenberg <[hidden email]> wrote:

On 05.02.2016, at 15:12, marcel.taeumel <[hidden email]> wrote:
>
> Hmm... I think we are also "resuming" after a snapshot.

That’s what Chris said, yes.

> I find "(not) snapshotting" or "restarting" better somehow…

That’s why I suggested “starting”.

 

How about adding some whimsey and using "startingAfresh"?  I'm seriously suggesting this because (at least for me) this is really evocative of launching a snapshot.

 

[Ron Teitelbaum] how about just say what it is.  #startingAfterSave #startingAfterQuit


Because that's ambiguous.  startingAfterSave could mean "we've just written a snapshot, haven't quit, and are restarting".  startingAfterQuit is ambiguous.  Could it mean "we're starting a snapshot that was saved and quitted", and hence be trying to distinguish between "we're starting a snapshot that was saved and quitted" and "we're starting a snapshot that was saved but not quitted"?  That's the problem here.  For the OCD amongst us we can see lots of potential nonsensical meanings and it all gets really confusing and we end up having to browse the sender of startUp: to really understand what's going on.  So (at least for me) startingAfresh is /much/ better than resuming, startingAfterSave, startingAfterQuit etc.  starting is pretty good, but startingAfresh is better.  startingAfterSave sucks ;-).

 

 

_,,,^..^,,,_

best, Eliot







--
_,,,^..^,,,_
best, Eliot