Edit | Rename | Upload | Download | Back to Top |
So,
Product | Identifier | |
Dolphin | 'Dolphin v x.x' | |
GemStone/S | 'Gemstone v x.x' | |
GNU Smalltalk | 'GNU Smalltalk v x.x' | |
ObjectStudio | 'ObjectStudio v x.x' | |
SmalltalkAgents | 'SmalltalkAgents v x.x' | |
SmalltalkExpress | 'SmalltalkExpress v x.x' | |
SmalltalkMT | 'SmalltalkMT v x.x' | |
Smalltalk/X | 'Smalltalk/X v x.x' | |
Squeak | 'Squeak v x.x' | |
VisualAge | 'VisualAge v x.x' | |
VisualWorks | 'VisualWorks v x.x' |
This ought to make it very simple, and asking each vendor to add a single class with a single method should be pretty easy.
There is need for a System type of object beyond the three uses mentioned above. I expect this new thing will become used and referenced quite frequently. Dialect seems like a good name for the thing. I can't think of a better name that wouldn't conflict with a name already used for other purposes.
Perhaps the standard would start with just the single class and single method, but is seems useful to get the #productName, #releaseName, and #buildNumber as separate methods without having to do string matching or break-up.
For example, ENVY defines a System global that holds an object that can respond to #vmType that returns 'ES' for VisualAge and 'st80' for VisualWorks.
The tricky part is coming up with code that can be run on any dialect that will uniquely identify only one particular dialect. Once you know the dialect being used, then you know what messages to send to get the other information.
Here is some code to get us started:
Smalltalk at: #AttributeDescriptor ifAbsent: [^false].
^true
Smalltalk at: #AbstractTime ifAbsent: [^false].
Smalltalk at: #TabWidget ifAbsent: [^false].
^true
| sys | sys := Smalltalk at: #System ifAbsent: [^false].
^sys vmType = 'ES'.
| feat | feat := Smalltalk at: #Features ifAbsent: [nil].
^feat isClass not & feat notNil.
| sys | sys := (Smalltalk at: #ENVY ifAbsent: [Smalltalk]) For VW5i
at: #System ifAbsent: [^false].
^sys vmType = 'st80'.
Smalltalk class selectors do: [ :s | (s == #versionName and: [ (Smalltalk versionName copyFrom: 1 to: 11) = 'VisualWorks']) ifTrue: [^true]]. ^false
Another part of this is to determine the symbol or string to return to identify a Smalltalk dialect. Here is a start:
Please improve on this initial start. Once we find code to use, then we can talk about a standard place to get the information from. I hate relying on the existance of things to identify a dialect, but I don't know another way to do this without hard-coding for each image. The idea is to run this code only once and then cache the result so the performance cost of the code isn't significant.
Edit | Rename | Upload | Download | Back to Top |