[squeak-dev] "local" vs. "persistent" preferences
keith_hodges at yahoo.co.uk
Thu Mar 11 11:50:54 UTC 2010
Keep it simple, this would be my preferred scheme.
preferences are constants, constants are implemented using a method
#giveMeBigStuff ^ true
Load a MyPreferences class (at start-up if you wish) as a subclass of
PreferencesDefault with your settings in and point
Smalltalk preferences ^ MyPreferences current
If you want domain specific preferences simply add a method
PreferencesDefault seaside ^ WAPreferences current
So usage becomes something like "Smalltalk preferences seaside port."
You can override seaside preferences by implementing MyPreferences
seaside ^ WAPreferencesForMySite
For project locals, the project can use a local preferences accessor
(Project current preferences) which can be pointed at a chosen
As a final nuance, I would extend this by implementing "Preferences
current" as a thread local variable, giving you per process control.
As a result of this email I have added a new type to InstallSeries
This works the same as an update stream, except it always loads the
last item in a *.prefs update series. Running an update at startup
will then re-load the preferences.
More information about the Squeak-dev