On Sep 4, 2013, at 2:13 PM, David T. Lewis <[email protected]> wrote:

> On Tue, Sep 03, 2013 at 10:51:33PM -0400, David T. Lewis wrote:
>> On Tue, Sep 03, 2013 at 01:48:46PM +0200, Goubier Thierry wrote:
>>> 
>>> Le 03/09/2013 13:36, David T. Lewis a ?crit :
>>>> 
>>>> Can you post the method here first? I'd like to check it on some Squeak 
>>>> images
>>>> before it goes into the repository.
>>> 
>>> Here it is (at least an example):
>>> 
>>> in OSProcess class
>>> 
>>> isPharo3AndLater
>>>     "Test if we are on Pharo 3.0"
>>> 
>>>     ^ (Smalltalk classNamed: 'SystemVersion')
>>>             ifNil: [ false ]
>>>             ifNotNil: [ :v | v current type = 'Pharo' and: [ v current 
>>>             major >= 3 ] ]
>> 
>> The idea is right, but the details can be a PITA ;-)
>> 
>> - In Squeak trunk, class SystemVersion exists. But it does not understand 
>> #type, so this fails at runtime. 
>> 
>> - There are no implementors of #major in Squeak (but this can be rewritten 
>> using #perform:).
>> 
>> - In Squeak 3.8, #ifNil:ifNotNil: requires a block with no arguments.
>> 
>> I did not check the other Pharo versions.
>> 
>> Something like this might work:
>> 
>> isPharo3AndLater
>>      Smalltalk
>>              at: #SystemVersion
>>              ifPresent: [:cls | ((cls canUnderstand: #type) and: [ cls 
>> canUnderstand: #major ])
>>                      ifTrue: [^ cls current type = 'Pharo' and: [ cls 
>> current major >= 3 ]]].
>>      ^false
>> 
> 
> 
> I am also checking the platform subtype implementation (OSProcess 
> platformSubtype).
> 
> In Pharo:
> 
> Smalltalk os subtype ==> 'i686'
> 
> This reflects the processor type, not the os subtype (it should be 'x86_64' 
> on my PC).
> 
> Is this intentional?
> 
I don't think so.

        Marcus

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to