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?
Thanks,
Nevin
--- Nevin Pratt nevin@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@yahoo.com Yahoo! Messenger: bstjean http://cactus.swiki.net -------------------------
Benoit St-Jean wrote:
What about something like:
Object superclass notNil and: [Object superclass name == #ProtoObject]
ProtoObject exists in VisualWorks (though not in the base image). GLORP put it there. It isn't currently the superclass of Object, though, but when Cincom proceeds with GLORP, I don't know if that will remain the case.
or even better:
(Smalltalk respondsTo: #vmVersion) and: [(Smalltalk vmVersion copyFrom: 1 to: 6) = 'Squeak']
I like this one. Is it reliable?
Okay... There's a zillion ways to do this... We just need to pick one that is elegant, simple and clean...
Which is why I'm hoping to call on the collective wisdom of the Squeak community for this simplistic-sounding problem.
Nevin
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
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
squeak-dev@lists.squeakfoundation.org