El dom, 14-03-2010 a las 16:12 +0100, Lukas Renggli escribió:
startupLevel ^ 100
method
err, but you still need to have a method, where this pragma will be located :)
Yes, in the startup method itself.
The #startUp, #shutDown, #cleanUp protocol is quite strange. They are all defined as empty methods in Behavior, but for #startUp and #shutDown a registration is required. This registration is missing in some cases. #cleanUp does not require a registration. In all cases cleanUp just delegates to one or more other methods that do the actual cleanup.
What I propose is to use pragmas for that. This allows to drop all the existing implementors of #startUp, #shutDown, and #cleanUp and give them intention revealing names. Also I envision getting rid of these ugly boolean flags that are never quite clear what they do and what is the default. I imagine the following 6 annotations:
<systemStartup: aPriorityInteger> <systemResumption: aPriorityInteger>
<systemShutdown: aPriorityInteger> <systemSuspension: aPriorityInteger>
<systemCleanup: aPriorityInteger> <systemCleanupAgressive: aPriorityInteger>
This means for example that HandMorph class>>#clearCompositionWindowManager could simply look likes this:
HandMorph class>>clearCompositionWindowManager <systemStartup: 100>
CompositionWindowManager := nil
The #startUp and the code that registers and unregisters from the startup list is no longer necessary.
But isn't this the rationale for using annotations on Java for example, where after a while you don't know what a given annotation does because the logic of working is somewhere else. I prefer a single standardized message, just like "new" and "initialize" that have well stated intentions and not convert smalltalk in a soup of annotations like Java currently is. My 2 cents.
Lukas
-- Miguel Cobá http://miguel.leugim.com.mx