basicIsSqueak test

Benoit St-Jean bstjean at yahoo.com
Mon Dec 23 00:19:25 UTC 2002


--- Nevin Pratt <nevin at smalltalkpro.com> wrote:
> Hi all,
> 
> I'm currently porting GLORP version 0.2.18 to
> Squeak.  When I did the 
> 0.2.14 port, I created the following method for the
> GLORP Dialect class:
> 
> basicIsSqueak
>     Smalltalk
>         at: #SqueakPage
>         ifAbsent: [^ false].
>     ^ true
> 
> This method must reliable return 'true' if and only
> if the code is 
> called from within a Squeak image.  I couldn't think
> of any particular 
> "reliable" test other than what I have shown above.
> 
> Does anybody have a different suggestion for a
> reliable #basicIsSqueak test?


What about something like:

Object superclass notNil 
and: 
[Object superclass name == #ProtoObject]

or even better:

(Smalltalk respondsTo: #vmVersion) and: [(Smalltalk
vmVersion copyFrom: 1 to: 6) = 'Squeak']

Okay...  There's a zillion ways to do this...  We just
need to pick one that is elegant, simple and clean...

=====
-------------------------
Benoit St-Jean
bstjean at yahoo.com
Yahoo! Messenger: bstjean
http://cactus.swiki.net
-------------------------



More information about the Squeak-dev mailing list