[squeak-dev] Lessons learned from (Re: Faster fibonacci)

Keith 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)
> https://bazaar.launchpad.net/~keithy/cuis/System-Support_StartupManager/revision/1#StartupManager-into-Cuis2/1-System-Support-StartupManager.install/0002/StartupManager-(startup-shutdown)-int.1.st
> Looking through the comments I find
> StatupManager
> New simple startUp shutDown protocol
> classes implement #startUpPriority #shutDownPriority to register.
> Note: this code could be hosted on a different class, such as 
> SmalltalkImage,
> 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.
> Keith

One of the other goals was to support removable/loadable UI in the 
bootstrap process

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 
2/4/2010 16:44'!"


^ 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 ] )) ].

^ list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190430/8337a5b3/attachment.html>

More information about the Squeak-dev mailing list