#shutdown vs #shutdown:

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

#shutdown vs #shutdown:

fniephaus
Hi all,

SmalltalkImage>>processShutDownList: sends #shutdown: to all classes in ShutDownList, yet there are classes that don't implement #shutdown: but #shutdown. One example is ExternalSettings class>>shutDown, ExternalSettings is in ShutDownList.
Can someone explain how this is supposed to work or why there is no error when the image is shutting down?

Best,
Fabio


Reply | Threaded
Open this post in threaded view
|

Re: #shutdown vs #shutdown:

Tobias Pape

> On 28.12.2017, at 22:09, Fabio Niephaus <[hidden email]> wrote:
>
> Hi all,
>
> SmalltalkImage>>processShutDownList: sends #shutdown: to all classes in ShutDownList, yet there are classes that don't implement #shutdown: but #shutdown. One example is ExternalSettings class>>shutDown, ExternalSettings is in ShutDownList.
> Can someone explain how this is supposed to work or why there is no error when the image is shutting down?
>

Behavior>>shutDown: quitting
        "This message is sent on system shutdown to registered classes"
        ^self shutDown.

Best
        -Tobi


> Best,
> Fabio
>


Reply | Threaded
Open this post in threaded view
|

Re: #shutdown vs #shutdown:

fniephaus

On Thu, Dec 28, 2017 at 10:20 PM Tobias Pape <[hidden email]> wrote:

> On 28.12.2017, at 22:09, Fabio Niephaus <[hidden email]> wrote:
>
> Hi all,
>
> SmalltalkImage>>processShutDownList: sends #shutdown: to all classes in ShutDownList, yet there are classes that don't implement #shutdown: but #shutdown. One example is ExternalSettings class>>shutDown, ExternalSettings is in ShutDownList.
> Can someone explain how this is supposed to work or why there is no error when the image is shutting down?
>

Behavior>>shutDown: quitting
        "This message is sent on system shutdown to registered classes"
        ^self shutDown.

Whoops, looks like I didn't see that one in the list of implementors. Thanks!
 

Best
        -Tobi


> Best,
> Fabio
>




Reply | Threaded
Open this post in threaded view
|

Re: #shutdown vs #shutdown:

Levente Uzonyi
In reply to this post by fniephaus
On Thu, 28 Dec 2017, Fabio Niephaus wrote:

> Hi all,
> SmalltalkImage>>processShutDownList: sends #shutdown: to all classes in ShutDownList, yet there are classes that don't implement #shutdown: but #shutdown. One example is ExternalSettings
> class>>shutDown, ExternalSettings is in ShutDownList.
> Can someone explain how this is supposed to work or why there is no error when the image is shutting down?

It may be tempting to implement #shutDown when you don't need the
argument, but I suggest you should not use it, ever.
Why? Because if someone implements #shutDown: in a superclass of yours,
your #shutDown method will (probably) not be sent, and tracking down such
bugs is rather time consuming.

Same applies to #startUp.

Also, the argument is useful in almost all cases, it's just that people
probably forgot to use it. That alone gives about a second overhead to
image saving. So, please use the argument.

Actually both #shutDown and #startUp should be deprecated some way.

Levente

>
> Best,
> Fabio
>
>