If I'm not wrong, the fluid class declaration does no more explicitly deal with instance (and class) variables. Instead, it deals now with slots, tags, shared variables, traits,...At a fist look, I was understanding that slots was a dynamic way to declare instance variables.
A Slot is first an object representing an instance variable.
Now by default the programmer should use a symbol
so you go from
���x y��� to {#x . #y}
This syntax let us write more complex class definitions such as
SpPresenter << #SpDialogPresenter
slots: {
#parentWindow => WeakSlot .
#acceptAction .
#cancelAction .
#image };
package: 'Spec2-Dialogs'
here #parentWindow => WeakSlot creates a slot of the class WeakSlot (does not count for garbage collector)
After reading some pieces of paper, and if I'm not wrong , slots are not really instance variables and shared variables are not class variables.
Avoiding the old class declaration, i.e.
Object subclass #SomeClassName instanceVariableNames: 'instaVar1 instVar2 ...' ...
is there a simple way to add an instance (or class) variable?
you use slots: { . };
and
sharedVariables: are for classVarNames:
This is because sharedVariables are shared between the instance and class side
and like that we do not have the confusion of
class variables and metaclass instance variables.
For example TextConstants defines the following sharedVariables:
SharedPool << #TextConstants
slots: {};
sharedVariables: { #Ctrls . #Ctrlh . #CtrlR . #CtrlG . #DefaultMarginTabsArray . #Ctrlx . #Ctrlm . #Ctrlb . #BS . #CtrlL . #CtrlA . #CtrlW . #DefaultRule . #DefaultFontFamilySize . #Ctrlr . #Ctrlg . #CtrlQ . #EndOfRun . #CtrlF . #Italic . #Basal . #Ctrlw . #Ctrll . #Ctrla . #CtrlV . #CtrlK . #Bold . #Justified . #Ctrlf . #Ctrlq . #CtrlP . #CtrlE . #LeftMarginTab . #CtrlOpenBrackets . #DefaultSpace . #Ctrlv . #Ctrlk . #CtrlU . #CtrlJ . #Ctrlp . #Ctrle . #CtrlZ . #CtrlO . #CtrlD . #DefaultBaseline . #CrossedX . #LeftFlush . #Space . #Ctrlj . #CtrlT . #CtrlI . #RightFlush . #DefaultTab . #Ctrlu . #Centered . #Ctrlz . #Ctrlo . #Ctrld . #CtrlY . #CtrlN . #CtrlC . #Enter . #DefaultLineGrid . #ESC . #Ctrlt . #Ctrli . #CtrlS . #CtrlH . #Clear . #CR . #CtrlDigits . #DefaultMask . #Ctrln . #Ctrlc . #RightMarginTab . #CtrlM . #CtrlX . #BS2 . #Tab . #TextSharedInformation . #DefaultTabsArray . #Ctrly . #CtrlB };
tag: 'Base';
package: 'Text-Core'
ArrayedCollection subclass: #Text
instanceVariableNames: 'string runs'
classVariableNames: ''
poolDictionaries: 'TextConstants'
package: 'Text-Core-Base'
is now
ArrayedCollection << #Text
slots: { #string . #runs };
sharedPools: { TextConstants };
tag: 'Base';
package: 'Text-Core'
Because this is years that poolDictionaries do not exist anymore (they have SharedPool e.g. a special class holding sharedVariables)