Deprecation rewrite introduces infinite recursion… how to prevent that?

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

Deprecation rewrite introduces infinite recursion… how to prevent that?

Damien Pollet
I have a double-dispatch chain:
x generic: y → y firstDispatch: x → x secondDispatchFromY: y

However this has been added after the fact, so there are direct uses of the secondDispatchFromY:  layer, which I'd like to deprecate/rewrite to use the generic: one. But if I do so, the intermediate firstDispatch: gets rewritten in the process, and this results in an infinite recursion.

Is there a way to formulate the rewrite rule to avoid that?

I could make a whole new set of secondDispatchFromYbis: methods, change the firstDispatch: ones to use those, and then the rewrite would be ok, but it seems like a lot of noise in the code for a small deprecation…

Thinking of it, this is not really a deprecation, more like an advice on proper use…

--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet
Reply | Threaded
Open this post in threaded view
|

Re: Deprecation rewrite introduces infinite recursion… how to prevent that?

Damien Pollet
Turns out it was pretty easy to implement: https://github.com/pharo-project/pharo/pull/1683

On Sat, 11 Aug 2018 at 15:59, Damien Pollet <[hidden email]> wrote:
I have a double-dispatch chain:
x generic: y → y firstDispatch: x → x secondDispatchFromY: y

However this has been added after the fact, so there are direct uses of the secondDispatchFromY:  layer, which I'd like to deprecate/rewrite to use the generic: one. But if I do so, the intermediate firstDispatch: gets rewritten in the process, and this results in an infinite recursion.

Is there a way to formulate the rewrite rule to avoid that?

I could make a whole new set of secondDispatchFromYbis: methods, change the firstDispatch: ones to use those, and then the rewrite would be ok, but it seems like a lot of noise in the code for a small deprecation…

Thinking of it, this is not really a deprecation, more like an advice on proper use…

--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet


--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet