several uses of #ifNotNil: in PierSecurity (Pier2)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

several uses of #ifNotNil: in PierSecurity (Pier2)

Dale Henrichs
I'm porting to Pier2  to GemStone and ran into several places where
#ifNotNil: is being used ... what is the accepted replacement for
#ifNotNil: ... I can clean these up as part of my port.

Dale
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: several uses of #ifNotNil: in PierSecurity (Pier2)

Lukas Renggli
I don't see any senders in my image.

Actually #ifNotNil: is accepted by Slime, the rewrite rules we follow are these:

        self rewriteRule
                replace: '``@boolean ifNotNilDo: ``@block'
                        with: '``@boolean ifNotNil: ``@block';
                replace: '``@boolean ifNotNilDo: ``@block1 ifNil: ``@block2'
                        with: '``@boolean ifNotNil: ``@block1 ifNil: ``@block2';
                replace: '``@boolean ifNil: ``@block1 ifNotNilDo: ``@block2'
                        with: '``@boolean ifNil: ``@block1 ifNotNil: ``@block2';
                replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
                        with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ]';
                replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ] ifNil: ``@block '
                        with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ] ifNil: ``@block';
                replace: '``@boolean ifNil: ``@block ifNotNil: [ | `@temps | ``@.body ]'
                        with: '``@boolean ifNil: ``@block ifNotNil: [ :arg | | `@temps | ``@.body ]'

Personally I only use #ifNil: for lazy accessors, otherwise I don't
like these constructs.

Lukas

On 16 June 2010 21:37, Dale Henrichs <[hidden email]> wrote:
> I'm porting to Pier2  to GemStone and ran into several places where
> #ifNotNil: is being used ... what is the accepted replacement for #ifNotNil:
> ... I can clean these up as part of my port.
>
> Dale
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: several uses of #ifNotNil: in PierSecurity (Pier2)

Dale Henrichs
Lukas,

The senders (using the non-portable variant with unary block arg) are
all in Pier-Security-lr.165.

Dale

Lukas Renggli wrote:

> I don't see any senders in my image.
>
> Actually #ifNotNil: is accepted by Slime, the rewrite rules we follow are these:
>
> self rewriteRule
> replace: '``@boolean ifNotNilDo: ``@block'
> with: '``@boolean ifNotNil: ``@block';
> replace: '``@boolean ifNotNilDo: ``@block1 ifNil: ``@block2'
> with: '``@boolean ifNotNil: ``@block1 ifNil: ``@block2';
> replace: '``@boolean ifNil: ``@block1 ifNotNilDo: ``@block2'
> with: '``@boolean ifNil: ``@block1 ifNotNil: ``@block2';
> replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
> with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ]';
> replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ] ifNil: ``@block '
> with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ] ifNil: ``@block';
> replace: '``@boolean ifNil: ``@block ifNotNil: [ | `@temps | ``@.body ]'
> with: '``@boolean ifNil: ``@block ifNotNil: [ :arg | | `@temps | ``@.body ]'
>
> Personally I only use #ifNil: for lazy accessors, otherwise I don't
> like these constructs.
>
> Lukas
>
> On 16 June 2010 21:37, Dale Henrichs <[hidden email]> wrote:
>> I'm porting to Pier2  to GemStone and ran into several places where
>> #ifNotNil: is being used ... what is the accepted replacement for #ifNotNil:
>> ... I can clean these up as part of my port.
>>
>> Dale
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>
>
>
>

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: several uses of #ifNotNil: in PierSecurity (Pier2)

Dale Henrichs
I did a #senders in Pharo 1.0 with Pier installed  and the offenders
don't show up, but if you look at the following methods you'll see them:

   PRStructure>>group:
   PRStructure>>owner:
   PUSecurity class>>onStructureAdded:

other senders (using the zero arg form) are:

   MAComponentRenderer>>hasError:
   MAFileUploadComponent>>remove
   PRCase>>document:

Seems that there is a bug in senders...

Dale

Dale Henrichs wrote:

> Lukas,
>
> The senders (using the non-portable variant with unary block arg) are
> all in Pier-Security-lr.165.
>
> Dale
>
> Lukas Renggli wrote:
>> I don't see any senders in my image.
>>
>> Actually #ifNotNil: is accepted by Slime, the rewrite rules we follow are these:
>>
>> self rewriteRule
>> replace: '``@boolean ifNotNilDo: ``@block'
>> with: '``@boolean ifNotNil: ``@block';
>> replace: '``@boolean ifNotNilDo: ``@block1 ifNil: ``@block2'
>> with: '``@boolean ifNotNil: ``@block1 ifNil: ``@block2';
>> replace: '``@boolean ifNil: ``@block1 ifNotNilDo: ``@block2'
>> with: '``@boolean ifNil: ``@block1 ifNotNil: ``@block2';
>> replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
>> with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ]';
>> replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ] ifNil: ``@block '
>> with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ] ifNil: ``@block';
>> replace: '``@boolean ifNil: ``@block ifNotNil: [ | `@temps | ``@.body ]'
>> with: '``@boolean ifNil: ``@block ifNotNil: [ :arg | | `@temps | ``@.body ]'
>>
>> Personally I only use #ifNil: for lazy accessors, otherwise I don't
>> like these constructs.
>>
>> Lukas
>>
>> On 16 June 2010 21:37, Dale Henrichs <[hidden email]> wrote:
>>> I'm porting to Pier2  to GemStone and ran into several places where
>>> #ifNotNil: is being used ... what is the accepted replacement for #ifNotNil:
>>> ... I can clean these up as part of my port.
>>>
>>> Dale
>>> _______________________________________________
>>> Magritte, Pier and Related Tools ...
>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>>
>>
>>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: several uses of #ifNotNil: in PierSecurity (Pier2)

Dale Henrichs
In reply to this post by Lukas Renggli
Lukas,

Unless I misunderstand the rewrite rules, doesn't the following rule end
up as a noop (ifNotNil: isn't really converted):

   replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
      with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ]';

and worse yet the `ifNotNil: [:arg|]` form isn't supported by GemStone...

Dale


Lukas Renggli wrote:

> I don't see any senders in my image.
>
> Actually #ifNotNil: is accepted by Slime, the rewrite rules we follow are these:
>
> self rewriteRule
> replace: '``@boolean ifNotNilDo: ``@block'
> with: '``@boolean ifNotNil: ``@block';
> replace: '``@boolean ifNotNilDo: ``@block1 ifNil: ``@block2'
> with: '``@boolean ifNotNil: ``@block1 ifNil: ``@block2';
> replace: '``@boolean ifNil: ``@block1 ifNotNilDo: ``@block2'
> with: '``@boolean ifNil: ``@block1 ifNotNil: ``@block2';
> replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
> with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ]';
> replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ] ifNil: ``@block '
> with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ] ifNil: ``@block';
> replace: '``@boolean ifNil: ``@block ifNotNil: [ | `@temps | ``@.body ]'
> with: '``@boolean ifNil: ``@block ifNotNil: [ :arg | | `@temps | ``@.body ]'
>
> Personally I only use #ifNil: for lazy accessors, otherwise I don't
> like these constructs.
>
> Lukas
>
> On 16 June 2010 21:37, Dale Henrichs <[hidden email]> wrote:
>> I'm porting to Pier2  to GemStone and ran into several places where
>> #ifNotNil: is being used ... what is the accepted replacement for #ifNotNil:
>> ... I can clean these up as part of my port.
>>
>> Dale
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>
>
>
>

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: several uses of #ifNotNil: in PierSecurity (Pier2)

Lukas Renggli
Ahh, we weren't aware of that. We have to check the code-base.

The rewrite was ment to make the code work in Squeak 3.9 and earlier.

Lukas

On 16 June 2010 23:31, Dale Henrichs <[hidden email]> wrote:

> Lukas,
>
> Unless I misunderstand the rewrite rules, doesn't the following rule end up
> as a noop (ifNotNil: isn't really converted):
>
>  replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
>     with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ]';
>
> and worse yet the `ifNotNil: [:arg|]` form isn't supported by GemStone...
>
> Dale
>
>
> Lukas Renggli wrote:
>>
>> I don't see any senders in my image.
>>
>> Actually #ifNotNil: is accepted by Slime, the rewrite rules we follow are
>> these:
>>
>>        self rewriteRule
>>                replace: '``@boolean ifNotNilDo: ``@block'
>>                        with: '``@boolean ifNotNil: ``@block';
>>                replace: '``@boolean ifNotNilDo: ``@block1 ifNil:
>> ``@block2'
>>                        with: '``@boolean ifNotNil: ``@block1 ifNil:
>> ``@block2';
>>                replace: '``@boolean ifNil: ``@block1 ifNotNilDo:
>> ``@block2'
>>                        with: '``@boolean ifNil: ``@block1 ifNotNil:
>> ``@block2';
>>                replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
>>                        with: '``@boolean ifNotNil: [ :arg | | `@temps |
>> ``@.body ]';
>>                replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]
>> ifNil: ``@block '
>>                        with: '``@boolean ifNotNil: [ :arg | | `@temps |
>> ``@.body ] ifNil: ``@block';
>>                replace: '``@boolean ifNil: ``@block ifNotNil: [ | `@temps
>> | ``@.body ]'
>>                        with: '``@boolean ifNil: ``@block ifNotNil: [ :arg
>> | | `@temps | ``@.body ]'
>>
>> Personally I only use #ifNil: for lazy accessors, otherwise I don't
>> like these constructs.
>>
>> Lukas
>>
>> On 16 June 2010 21:37, Dale Henrichs <[hidden email]> wrote:
>>>
>>> I'm porting to Pier2  to GemStone and ran into several places where
>>> #ifNotNil: is being used ... what is the accepted replacement for
>>> #ifNotNil:
>>> ... I can clean these up as part of my port.
>>>
>>> Dale
>>> _______________________________________________
>>> Magritte, Pier and Related Tools ...
>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>>
>>
>>
>>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: several uses of #ifNotNil: in PierSecurity (Pier2)

Lukas Renggli
In reply to this post by Dale Henrichs
> I did a #senders in Pharo 1.0 with Pier installed  and the offenders don't
> show up, but if you look at the following methods you'll see them:
>
>  PRStructure>>group:
>  PRStructure>>owner:
>  PUSecurity class>>onStructureAdded:
>
> other senders (using the zero arg form) are:
>
>  MAComponentRenderer>>hasError:
>  MAFileUploadComponent>>remove
>  PRCase>>document:
>
> Seems that there is a bug in senders...

I reported it here: http://code.google.com/p/pharo/issues/detail?id=2559

I want to update the rewrite rule. So GemStone only has #ifNil: with
zero arguments?

Lukas


>
> Dale
>
> Dale Henrichs wrote:
>>
>> Lukas,
>>
>> The senders (using the non-portable variant with unary block arg) are all
>> in Pier-Security-lr.165.
>>
>> Dale
>>
>> Lukas Renggli wrote:
>>>
>>> I don't see any senders in my image.
>>>
>>> Actually #ifNotNil: is accepted by Slime, the rewrite rules we follow are
>>> these:
>>>
>>>        self rewriteRule
>>>                replace: '``@boolean ifNotNilDo: ``@block'
>>>                        with: '``@boolean ifNotNil: ``@block';
>>>                replace: '``@boolean ifNotNilDo: ``@block1 ifNil:
>>> ``@block2'
>>>                        with: '``@boolean ifNotNil: ``@block1 ifNil:
>>> ``@block2';
>>>                replace: '``@boolean ifNil: ``@block1 ifNotNilDo:
>>> ``@block2'
>>>                        with: '``@boolean ifNil: ``@block1 ifNotNil:
>>> ``@block2';
>>>                replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
>>>                        with: '``@boolean ifNotNil: [ :arg | | `@temps |
>>> ``@.body ]';
>>>                replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]
>>> ifNil: ``@block '
>>>                        with: '``@boolean ifNotNil: [ :arg | | `@temps |
>>> ``@.body ] ifNil: ``@block';
>>>                replace: '``@boolean ifNil: ``@block ifNotNil: [ | `@temps
>>> | ``@.body ]'
>>>                        with: '``@boolean ifNil: ``@block ifNotNil: [ :arg
>>> | | `@temps | ``@.body ]'
>>>
>>> Personally I only use #ifNil: for lazy accessors, otherwise I don't
>>> like these constructs.
>>>
>>> Lukas
>>>
>>> On 16 June 2010 21:37, Dale Henrichs <[hidden email]> wrote:
>>>>
>>>> I'm porting to Pier2  to GemStone and ran into several places where
>>>> #ifNotNil: is being used ... what is the accepted replacement for
>>>> #ifNotNil:
>>>> ... I can clean these up as part of my port.
>>>>
>>>> Dale
>>>> _______________________________________________
>>>> Magritte, Pier and Related Tools ...
>>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>>>>
>>>
>>>
>>
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: several uses of #ifNotNil: in PierSecurity (Pier2)

Dale Henrichs
That's true right now .... I haven't made a big issue out #ifNotNil:
because the Seaside coding convention says not to use #ifNotNil:.

#ifNotNil: isn't implemented in our base system, so I _could_ change the
implementation to match the "standard" if there is one...

Dale

Lukas Renggli wrote:

>> I did a #senders in Pharo 1.0 with Pier installed  and the offenders don't
>> show up, but if you look at the following methods you'll see them:
>>
>>  PRStructure>>group:
>>  PRStructure>>owner:
>>  PUSecurity class>>onStructureAdded:
>>
>> other senders (using the zero arg form) are:
>>
>>  MAComponentRenderer>>hasError:
>>  MAFileUploadComponent>>remove
>>  PRCase>>document:
>>
>> Seems that there is a bug in senders...
>
> I reported it here: http://code.google.com/p/pharo/issues/detail?id=2559
>
> I want to update the rewrite rule. So GemStone only has #ifNil: with
> zero arguments?
>
> Lukas
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: several uses of #ifNotNil: in PierSecurity (Pier2)

Lukas Renggli
> That's true right now .... I haven't made a big issue out #ifNotNil: because
> the Seaside coding convention says not to use #ifNotNil:.

I've fixed all senders now. I think this is written there because
older versions of Squeak had a problem with that.

> #ifNotNil: isn't implemented in our base system, so I _could_ change the
> implementation to match the "standard" if there is one...

Yeah, I think that should be changed. Most Smalltalks accept zero or
one argument blocks in #ifNotNil:.

Lukas

>
> Dale
>
> Lukas Renggli wrote:
>>>
>>> I did a #senders in Pharo 1.0 with Pier installed  and the offenders
>>> don't
>>> show up, but if you look at the following methods you'll see them:
>>>
>>>  PRStructure>>group:
>>>  PRStructure>>owner:
>>>  PUSecurity class>>onStructureAdded:
>>>
>>> other senders (using the zero arg form) are:
>>>
>>>  MAComponentRenderer>>hasError:
>>>  MAFileUploadComponent>>remove
>>>  PRCase>>document:
>>>
>>> Seems that there is a bug in senders...
>>
>> I reported it here: http://code.google.com/p/pharo/issues/detail?id=2559
>>
>> I want to update the rewrite rule. So GemStone only has #ifNil: with
>> zero arguments?
>>
>> Lukas
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki