RBRuleIfNotNilDo usage

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

RBRuleIfNotNilDo usage

alistairgrant
Hi Everyone,

I'm loading some code in to Pharo 7 that tries to use #ifNotNilDo:.

There's already a transformation to re-write it to the correct
#ifNotNil: - RBRuleIfNotNilDo.

How can I apply the transformation to all existing methods in the
image that call #ifNotNilDo:?

Thanks,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: RBRuleIfNotNilDo usage

Stephane Ducasse-3
Hi alistair


If you run your program the code will be automatically transformed (I
cannot check the deprecation definitino right now)

Else have a look at tests of the ParseTreeRewriter.

Stef

On Sun, Nov 12, 2017 at 2:12 PM, Alistair Grant <[hidden email]> wrote:

> Hi Everyone,
>
> I'm loading some code in to Pharo 7 that tries to use #ifNotNilDo:.
>
> There's already a transformation to re-write it to the correct
> #ifNotNil: - RBRuleIfNotNilDo.
>
> How can I apply the transformation to all existing methods in the
> image that call #ifNotNilDo:?
>
> Thanks,
> Alistair
>

Reply | Threaded
Open this post in threaded view
|

Re: RBRuleIfNotNilDo usage

alistairgrant
Hi Stef,

On 12 November 2017 at 14:34, Stephane Ducasse <[hidden email]> wrote:

> Hi alistair
>
>
> If you run your program the code will be automatically transformed (I
> cannot check the deprecation definitino right now)
>
> Else have a look at tests of the ParseTreeRewriter.
>
> Stef
>
> On Sun, Nov 12, 2017 at 2:12 PM, Alistair Grant <[hidden email]> wrote:
>> Hi Everyone,
>>
>> I'm loading some code in to Pharo 7 that tries to use #ifNotNilDo:.
>>
>> There's already a transformation to re-write it to the correct
>> #ifNotNil: - RBRuleIfNotNilDo.
>>
>> How can I apply the transformation to all existing methods in the
>> image that call #ifNotNilDo:?
>>
>> Thanks,
>> Alistair

Thanks!

#ifNotNilDo: was deprecated in Pharo 6, and the method was removed
completely in Pharo 7.

The easiest thing to do is to port #ifNotNilDo: forward to Pharo 7 so
that the methods are automatically re-written.

And then get the offending libraries to be updated.  But that's another story.

Thanks again,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: RBRuleIfNotNilDo usage

Stephane Ducasse-3
I wonder if we packaged somewhere the removed deprecated method.
We should do that but since we do it manually I guess that this is ad-hoc.

Stef

On Sun, Nov 12, 2017 at 2:45 PM, Alistair Grant <[hidden email]> wrote:

> Hi Stef,
>
> On 12 November 2017 at 14:34, Stephane Ducasse <[hidden email]> wrote:
>> Hi alistair
>>
>>
>> If you run your program the code will be automatically transformed (I
>> cannot check the deprecation definitino right now)
>>
>> Else have a look at tests of the ParseTreeRewriter.
>>
>> Stef
>>
>> On Sun, Nov 12, 2017 at 2:12 PM, Alistair Grant <[hidden email]> wrote:
>>> Hi Everyone,
>>>
>>> I'm loading some code in to Pharo 7 that tries to use #ifNotNilDo:.
>>>
>>> There's already a transformation to re-write it to the correct
>>> #ifNotNil: - RBRuleIfNotNilDo.
>>>
>>> How can I apply the transformation to all existing methods in the
>>> image that call #ifNotNilDo:?
>>>
>>> Thanks,
>>> Alistair
>
> Thanks!
>
> #ifNotNilDo: was deprecated in Pharo 6, and the method was removed
> completely in Pharo 7.
>
> The easiest thing to do is to port #ifNotNilDo: forward to Pharo 7 so
> that the methods are automatically re-written.
>
> And then get the offending libraries to be updated.  But that's another story.
>
> Thanks again,
> Alistair
>

Reply | Threaded
Open this post in threaded view
|

Re: RBRuleIfNotNilDo usage

Henrik Sperre Johansen
Stephane Ducasse-3 wrote
> I wonder if we packaged somewhere the removed deprecated method.
> We should do that but since we do it manually I guess that this is ad-hoc.
>
> Stef
>
> On Sun, Nov 12, 2017 at 2:45 PM, Alistair Grant &lt;

> akgrant0710@

> &gt; wrote:
>> Hi Stef,
>>
>> On 12 November 2017 at 14:34, Stephane Ducasse &lt;

> stepharo.self@

> &gt; wrote:
>>> Hi alistair
>>>
>>>
>>> If you run your program the code will be automatically transformed (I
>>> cannot check the deprecation definitino right now)
>>>
>>> Else have a look at tests of the ParseTreeRewriter.
>>>
>>> Stef
>>>
>>> On Sun, Nov 12, 2017 at 2:12 PM, Alistair Grant &lt;

> akgrant0710@

> &gt; wrote:
>>>> Hi Everyone,
>>>>
>>>> I'm loading some code in to Pharo 7 that tries to use #ifNotNilDo:.
>>>>
>>>> There's already a transformation to re-write it to the correct
>>>> #ifNotNil: - RBRuleIfNotNilDo.
>>>>
>>>> How can I apply the transformation to all existing methods in the
>>>> image that call #ifNotNilDo:?
>>>>
>>>> Thanks,
>>>> Alistair
>>
>> Thanks!
>>
>> #ifNotNilDo: was deprecated in Pharo 6, and the method was removed
>> completely in Pharo 7.
>>
>> The easiest thing to do is to port #ifNotNilDo: forward to Pharo 7 so
>> that the methods are automatically re-written.
>>
>> And then get the offending libraries to be updated.  But that's another
>> story.
>>
>> Thanks again,
>> Alistair
>>

It would also be possible to force the issue, and instead of keeping the
definitions in image + rewrite on use, add the rules to a CompilerPlugin,
either loaded by default when importing code, or as a "rewrite deprecated
sends on import" toggle in the settings somewhere.

Cheers,
Henry



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: RBRuleIfNotNilDo usage

Marcus Denker-4
In reply to this post by alistairgrant

>
> Thanks!
>
> #ifNotNilDo: was deprecated in Pharo 6, and the method was removed
> completely in Pharo 7.
>
> The easiest thing to do is to port #ifNotNilDo: forward to Pharo 7 so
> that the methods are automatically re-written.
>

Yes, this would be best.

we never deprecated ifNotNilDo: because it was too intrusive. With the retwriting
deprecation it is possible, but then to not be intrusive, we need to keep the deprecated
methods longer.

Of course in the end, people only act if they are forced, so the question is if it would
help that much.

        Marcus


Reply | Threaded
Open this post in threaded view
|

Re: RBRuleIfNotNilDo usage

alistairgrant
Hi Marcus,

On 21 November 2017 at 11:18, Marcus Denker <[hidden email]> wrote:

>
>>
>> Thanks!
>>
>> #ifNotNilDo: was deprecated in Pharo 6, and the method was removed
>> completely in Pharo 7.
>>
>> The easiest thing to do is to port #ifNotNilDo: forward to Pharo 7 so
>> that the methods are automatically re-written.
>>
>
> Yes, this would be best.
>
> we never deprecated ifNotNilDo: because it was too intrusive. With the retwriting
> deprecation it is possible, but then to not be intrusive, we need to keep the deprecated
> methods longer.
>
> Of course in the end, people only act if they are forced, so the question is if it would
> help that much.

Actually I meant that I will just port the rewrite rule forward in my
image, not that it should be done as part of the official
distribution.

I agree that we need to be forced, and we don't want to clutter up the
image with an ever growing list of deprecated methods, so I'm fine
with the current process.

Sorry for the poor choice of wording.

Cheers,
Alistair