Yeah, simply don't use #ifNotNilDo: and friends.
If you follow the coding conventions of Seaside your code will
basically run anywhere <http://www.seaside.st/community/conventions>.
Slime also contains rules to automatically refactor non-portable code,
for example:
ansiCompatibilityConditionals
^ self
rewrite: #(
" kill abnormalities "
('`...@boolean ifNotNilDo: `...@block'
'`...@boolean ifNotNil: `...@block')
('`...@boolean ifNotNilDo: `...@block1 ifNil:
`...@block2'
'`...@boolean ifNotNil: `...@block1 ifNil:
`...@block2')
('`...@boolean ifNil: `...@block1 ifNotNilDo:
`...@block2'
'`...@boolean ifNil: `...@block1 ifNotNil:
`...@block2')
" normalize arguments "
('`...@boolean ifNotNil: [ | `...@temps | `...@body ]'
'`...@boolean ifNotNil: [ :arg | | `...@temps |
`...@body ]')
('`...@boolean ifNotNil: [ | `...@temps | `...@body ]
ifNil: `...@block '
'`...@boolean ifNotNil: [ :arg | | `...@temps |
`...@body ] ifNil: `...@block')
('`...@boolean ifNil: `...@block ifNotNil: [ |
`...@temps | `...@body ]'
'`...@boolean ifNil: `...@block ifNotNil: [ :arg | |
`...@temps | `...@body ]'))
methods: false
name: 'ANSI Compatibility: Conditionals'
Cheers,
Lukas
On Sun, Feb 22, 2009 at 10:22 AM, Marcus Denker <[email protected]> wrote:
>
> On 21.02.2009, at 18:31, Damien Cassou wrote:
>
>> Hi,
>>
>> is there a way to get the #ifNotNilDo: behavior to write compatible
>> Squeak and Pharo code?
>>
>
> -> do not use ifNotNilDo:
> -> use ifNotNil: without the argument.
>
> The real fix of course would be for Squeak adopting the optinal args
> changeset
> (this is from 2007...)
>
> Marcus
>
> --
> Marcus Denker -- [email protected]
> http://www.marcusdenker.de
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project