basicIsSqueak test

Nevin Pratt nevin at smalltalkpro.com
Mon Dec 23 04:56:42 UTC 2002


Ned Konz wrote:

>On Sunday 22 December 2002 04:13 pm, Nevin Pratt wrote:
>  
>
>>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.
>>    
>>
>
>I wouldn't count on any class like SqueakPage that might be unloaded 
>in a minimal image.
>
>I would instead test for attributes, abilities, quirks, or components 
>of a minimal kernel, whatever that might be.
>
>Among the lower-level things that you shouldn't count on:
>* the compiler
>* plugin source
>* networking or file support in its current state
>* Morphic or MVC
>
>  
>
I agree.

Got a specific suggestion for a good test?

So far I am leaning towards Benoit St-Jean's suggestion of:

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

Nevin





More information about the Squeak-dev mailing list