[squeak-dev] Lessons learned from (Re: Faster fibonacci)
keithy at consultant.com
Mon Apr 29 23:32:30 UTC 2019
On 30 Apr 2019, at 0:15, Keith wrote:
> Years ago I was trying to rationalise all the various functionality of
> Smalltalk/SmalltalkImage across
> forks. I also wanted to support a scheme that would handle being
> bootstrapped from sources.
> i.e. the startup process may load in or unload a number of classes
> from sources at an early stage, and when the time came to think about
> #startUp they may not have been #initialised, (the #startUp might be
> their initialisation).
> So I vaguely recollect that when I had a go at re-doing the
> startuplist I removed this responsibility to a class of its own,
> called StartupManager, and removed the class var that holds the list
> in favour of a voting system.
> I found some code hiding away (somewhat obfuscated)
> Looking through the comments I find
> New simple startUp shutDown protocol
> classes implement #startUpPriority #shutDownPriority to register.
> Note: this code could be hosted on a different class, such as
> The startUp and shutdownLists are compiled by looking at all
> implementors of:'
> #startUpPriority and #shutDownPriority'
> Priorities are: #first #earliest #earlier #early #normal #late #later
> #latest #last'
> As you can imagine this was very much a first attempt at resolving
> these problems.
One of the other goals was to support removable/loadable UI in the
I found this code in there, which indicates that the vote was
essentially on a numeric 0-999 scale.
StartupManager class methodsFor: 'system-startup-shutdown' stamp: 'kph
^ IdentityDictionary new
at: #first put: 0; "reserved for Delay"
at: #earliest put: 10;
at: #earlier put: 100;
at: #early put: 200;
at: #normal put: 500;
at: #late put: 800;
at: #later put: 900;
at: #latest put: 990;
at: #last put: 999; "reserved for Delay"
and some code, sorting on given priority value, followed by class name.
| priorities list |
priorities := self class priorities.
list := SortedCollection sortBlock: [ :a :b |
a value = b value
ifFalse: [ a value <= b value]
ifTrue: [ a key name <= b key name ] ].'
self systemNavigation allClassesRespondingTo: #startUpPriority
do: [ :cl | list add: (cl -> (priorities at: cl startUpPriority
ifAbsent: [ cl startUpPriority ] )) ].
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev