Edit Rename Upload Download Back to Top

How to identify dialects and platforms

We need a portable way to identify:
James A. Robertson Why not just add a class to each dialect called Dialect. Then we add a class method called name. This will return a string. We can do this without regard to namespaces by placing said class in the Smalltalk namespace in VW5, and in an analagous position in any other NS enabled Smalltalk.


 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.

That sounds like a very good solution to me. I didn't suggest that from the start because I wasn't expecting all vendors to agree on anything--even as simple as this. I suppose it is easy enough to add support even if vendors don't cooperate or if using existing product releases.

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.

Paul Baumann

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:

I realize that the VW example would only work in an ENVY image. Please come up with a way that would work uniquely for VW.

We use 'Smalltalk at: #ENVY' to identify VW5i in config expressions Joseph Pelrine

Another part of this is to determine the symbol or string to return to identify a Smalltalk dialect. Here is a start:

  1. Dolphin
  2. 'GemStone/S'
  3. GNUSmalltalk
  4. ObjectStudio
  5. SmalltalkAgents
  6. SmalltalkExpress
  7. SmalltalkMT
  8. 'Smalltalk/X'
  9. Squeak
  10. VisualAge
  11. VisualWorks

VisualWorks (hence 5i) could in some regards be considered another Smalltalk dialect. Should there be a #VisualWorksNS (namespace)?

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.

Paul Baumann

Edit Rename Upload Download Back to Top