On Sat, 20 Jul 2002, Andreas Raab wrote:
type annotations. For the remaining 10% you _might_ want to use type annotations but I would hope that some better syntax can be found than is currently in both StrongTalk and SmallScript.
Why not use message syntax? We already have it, everyone understands it and it can be made backward compatible with old images/Compilers that don't have type annotations (that either ignore it, or implement the annotations as runtime type checks -- useful for debugging, then turn off the checks before deploying).
cheesy*displacement.activity: on
How could I possibly resist? ;)
Here's a stupid dumb example. File it in, then execute each of the expressions below in a workspace.
Of course, in a real system you'd send #type: to an identifier and then expect some kind of consistent implicit constraining of its content. (In the stupid example Object>>type: could easily check for a global TypeCheck set to false and immediately return self. Wouldn't cost any more than the current #flag: hack.)
cheesy*displacement.activity: off
Ian
42 type: SmallInteger. 42 type: String. #(1 2 3) type: (Array of: SmallInteger). #(1 2 3) type: (ArrayedCollection of: Magnitude). #(1 2 3) type: (ArrayedCollection of: Point). (1 to: 10) type: SequenceableCollection. (1 to: 10) type: (SequenceableCollection of: Integer). 'boo!' type: (SequenceableCollection of: Character). 'boo!' type: (SequenceableCollection of: Magnitude). 'boo!' type: (SequenceableCollection of: Integer). 'boo!' asByteArray type: (SequenceableCollection of: Character). Smalltalk type: IdentityDictionary. Smalltalk type: (Collection of: Object). Smalltalk type: (Collection of: Behavior). Date today type: Magnitude. #((1) ($b) (3)) type: (SequenceableCollection of: (Array of: Object)). #((1) ($b) (3)) type: (SequenceableCollection of: Collection). #((1) ($b) (3)) type: (SequenceableCollection of: (Collection of: Object)). #((1) $b (3)) type: (SequenceableCollection of: (Collection of: Object)). #((1) ($b) (3)) type: (Array of: (Array of: Magnitude)). #((1) ($b) (3)) type: (Array of: (Array of: Number)). TextConstants type: (Dictionary of: { Form. Character. Array. Color. TextStyle. String. PopUpMenu. SmallInteger. }). TextConstants type: (Dictionary of: { Form. Character. Array. Color. TextStyle. String. PopUpMenu. }). TextConstants type: (Dictionary of: { Form. Magnitude. ArrayedCollection. Color. TextStyle. PopUpMenu. }).
Smalltalk type: (Dictionary of: { Behavior. Morph. Stream. ProcessorScheduler. ControlManager. EventSensor. Dictionary. KeyboardEvent. StandardScriptingSystem. SystemOrganizer. StandardSourceFileArray. DisplayMedium}).