rename a method programatically

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

rename a method programatically

cdelaunay
Hello,

I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Igor Stasenko
This is good question!
Behavior and ClassDescription is where you should look at.
I don't remember the details, but i could say that its hard to find
what is an 'official' way to do that.
API is messy.
We need to improve the SystemNotification and system changes layer to
make everything clear.

On 23 November 2010 15:17, Cyrille Delaunay <[hidden email]> wrote:
> Hello,
> I would like to know how I can rename a method programatically and safelly
> (without missing to raise any event that has to be raised)



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

jaayer
In reply to this post by cdelaunay




---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----

>Hello,
>
>I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
>  

I don't believe there is any simple way to do this.

Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.


Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Mariano Martinez Peck
Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.

Cheers

Mariano

On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:




---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----

>Hello,
>
>I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
>

I don't believe there is any simple way to do this.

Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.



Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Tudor Girba
Definitely use the RB for any code transformations.

Cheers,
Doru


On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:

> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
>
> Cheers
>
> Mariano
>
> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
>
>
>
>
> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
>
> >Hello,
> >
> >I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
> >
>
> I don't believe there is any simple way to do this.
>
> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
>
>
>

--
www.tudorgirba.com

"To lead is not to demand things, it is to make them happen."




Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Igor Stasenko
On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
> Definitely use the RB for any code transformations.
>

I don't think it's a good option for meta-programming.
For meta-programming, basic interface in Behavior or ClassDescription
should be enough for manipulating
with methods, without dependency from RB.
Actually, RB then can use same API for manipulations.

> Cheers,
> Doru
>
>
> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
>
>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
>>
>> Cheers
>>
>> Mariano
>>
>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
>>
>>
>>
>>
>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
>>
>> >Hello,
>> >
>> >I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
>> >
>>
>> I don't believe there is any simple way to do this.
>>
>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
>>
>>
>>
>
> --
> www.tudorgirba.com
>
> "To lead is not to demand things, it is to make them happen."
>
>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Tudor Girba
Well, as long as you want to perform a refactoring I believe that RB provides the API in question.

Doru


On 24 Nov 2010, at 00:52, Igor Stasenko wrote:

> On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
>> Definitely use the RB for any code transformations.
>>
>
> I don't think it's a good option for meta-programming.
> For meta-programming, basic interface in Behavior or ClassDescription
> should be enough for manipulating
> with methods, without dependency from RB.
> Actually, RB then can use same API for manipulations.
>
>> Cheers,
>> Doru
>>
>>
>> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
>>
>>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
>>>
>>> Cheers
>>>
>>> Mariano
>>>
>>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
>>>
>>>
>>>
>>>
>>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
>>>
>>>> Hello,
>>>>
>>>> I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
>>>>
>>>
>>> I don't believe there is any simple way to do this.
>>>
>>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
>>>
>>>
>>>
>>
>> --
>> www.tudorgirba.com
>>
>> "To lead is not to demand things, it is to make them happen."
>>
>>
>>
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>

--
www.tudorgirba.com

"Not knowing how to do something is not an argument for how it cannot be done."


Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Igor Stasenko
On 24 November 2010 02:00, Tudor Girba <[hidden email]> wrote:
> Well, as long as you want to perform a refactoring I believe that RB provides the API in question.
>
Yes, of course. But question was 'how to do that programmatically' ,
not using browser or other UI.

> Doru
>
>
> On 24 Nov 2010, at 00:52, Igor Stasenko wrote:
>
>> On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
>>> Definitely use the RB for any code transformations.
>>>
>>
>> I don't think it's a good option for meta-programming.
>> For meta-programming, basic interface in Behavior or ClassDescription
>> should be enough for manipulating
>> with methods, without dependency from RB.
>> Actually, RB then can use same API for manipulations.
>>
>>> Cheers,
>>> Doru
>>>
>>>
>>> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
>>>
>>>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
>>>>
>>>> Cheers
>>>>
>>>> Mariano
>>>>
>>>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
>>>>
>>>>
>>>>
>>>>
>>>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
>>>>
>>>>> Hello,
>>>>>
>>>>> I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
>>>>>
>>>>
>>>> I don't believe there is any simple way to do this.
>>>>
>>>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
>>>>
>>>>
>>>>
>>>
>>> --
>>> www.tudorgirba.com
>>>
>>> "To lead is not to demand things, it is to make them happen."
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>
> --
> www.tudorgirba.com
>
> "Not knowing how to do something is not an argument for how it cannot be done."
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

cdelaunay
Indeed, in my case I would like to do that wihtout using UI. I want to write a test in which I rename a method and see if the events emited have been well-catched by RPackage.

2010/11/24 Igor Stasenko <[hidden email]>
On 24 November 2010 02:00, Tudor Girba <[hidden email]> wrote:
> Well, as long as you want to perform a refactoring I believe that RB provides the API in question.
>
Yes, of course. But question was 'how to do that programmatically' ,
not using browser or other UI.

> Doru
>
>
> On 24 Nov 2010, at 00:52, Igor Stasenko wrote:
>
>> On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
>>> Definitely use the RB for any code transformations.
>>>
>>
>> I don't think it's a good option for meta-programming.
>> For meta-programming, basic interface in Behavior or ClassDescription
>> should be enough for manipulating
>> with methods, without dependency from RB.
>> Actually, RB then can use same API for manipulations.
>>
>>> Cheers,
>>> Doru
>>>
>>>
>>> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
>>>
>>>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
>>>>
>>>> Cheers
>>>>
>>>> Mariano
>>>>
>>>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
>>>>
>>>>
>>>>
>>>>
>>>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
>>>>
>>>>> Hello,
>>>>>
>>>>> I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
>>>>>
>>>>
>>>> I don't believe there is any simple way to do this.
>>>>
>>>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
>>>>
>>>>
>>>>
>>>
>>> --
>>> www.tudorgirba.com
>>>
>>> "To lead is not to demand things, it is to make them happen."
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>
> --
> www.tudorgirba.com
>
> "Not knowing how to do something is not an argument for how it cannot be done."
>
>
>



--
Best regards,
Igor Stasenko AKA sig.


Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Mariano Martinez Peck
RB has NOTHING to do with a UI or with a Browser. Actually, it is very well splitted in packages, and I think you can just use RB with a simple api "programmatically".


On Wed, Nov 24, 2010 at 9:17 AM, Cyrille Delaunay <[hidden email]> wrote:
Indeed, in my case I would like to do that wihtout using UI. I want to write a test in which I rename a method and see if the events emited have been well-catched by RPackage.

2010/11/24 Igor Stasenko <[hidden email]>

On 24 November 2010 02:00, Tudor Girba <[hidden email]> wrote:
> Well, as long as you want to perform a refactoring I believe that RB provides the API in question.
>
Yes, of course. But question was 'how to do that programmatically' ,
not using browser or other UI.

> Doru
>
>
> On 24 Nov 2010, at 00:52, Igor Stasenko wrote:
>
>> On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
>>> Definitely use the RB for any code transformations.
>>>
>>
>> I don't think it's a good option for meta-programming.
>> For meta-programming, basic interface in Behavior or ClassDescription
>> should be enough for manipulating
>> with methods, without dependency from RB.
>> Actually, RB then can use same API for manipulations.
>>
>>> Cheers,
>>> Doru
>>>
>>>
>>> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
>>>
>>>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
>>>>
>>>> Cheers
>>>>
>>>> Mariano
>>>>
>>>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
>>>>
>>>>
>>>>
>>>>
>>>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
>>>>
>>>>> Hello,
>>>>>
>>>>> I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
>>>>>
>>>>
>>>> I don't believe there is any simple way to do this.
>>>>
>>>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
>>>>
>>>>
>>>>
>>>
>>> --
>>> www.tudorgirba.com
>>>
>>> "To lead is not to demand things, it is to make them happen."
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>
> --
> www.tudorgirba.com
>
> "Not knowing how to do something is not an argument for how it cannot be done."
>
>
>



--
Best regards,
Igor Stasenko AKA sig.



Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Tudor Girba
In reply to this post by cdelaunay
I was also referring to a programatic solution :). Perhaps the name is misleading, but RB is not the UI. RB is primarily the engine behind that contains the logic of performing a refactoring.

Doru

On 24 Nov 2010, at 09:17, Cyrille Delaunay wrote:

> Indeed, in my case I would like to do that wihtout using UI. I want to write a test in which I rename a method and see if the events emited have been well-catched by RPackage.
>
> 2010/11/24 Igor Stasenko <[hidden email]>
> On 24 November 2010 02:00, Tudor Girba <[hidden email]> wrote:
> > Well, as long as you want to perform a refactoring I believe that RB provides the API in question.
> >
> Yes, of course. But question was 'how to do that programmatically' ,
> not using browser or other UI.
>
> > Doru
> >
> >
> > On 24 Nov 2010, at 00:52, Igor Stasenko wrote:
> >
> >> On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
> >>> Definitely use the RB for any code transformations.
> >>>
> >>
> >> I don't think it's a good option for meta-programming.
> >> For meta-programming, basic interface in Behavior or ClassDescription
> >> should be enough for manipulating
> >> with methods, without dependency from RB.
> >> Actually, RB then can use same API for manipulations.
> >>
> >>> Cheers,
> >>> Doru
> >>>
> >>>
> >>> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
> >>>
> >>>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
> >>>>
> >>>> Cheers
> >>>>
> >>>> Mariano
> >>>>
> >>>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
> >>>>
> >>>>> Hello,
> >>>>>
> >>>>> I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
> >>>>>
> >>>>
> >>>> I don't believe there is any simple way to do this.
> >>>>
> >>>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
> >>>>
> >>>>
> >>>>
> >>>
> >>> --
> >>> www.tudorgirba.com
> >>>
> >>> "To lead is not to demand things, it is to make them happen."
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Best regards,
> >> Igor Stasenko AKA sig.
> >>
> >
> > --
> > www.tudorgirba.com
> >
> > "Not knowing how to do something is not an argument for how it cannot be done."
> >
> >
> >
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>

--
www.tudorgirba.com

"Problem solving efficiency grows with the abstractness level of problem understanding."




Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

Mariano Martinez Peck


On Wed, Nov 24, 2010 at 9:44 AM, Tudor Girba <[hidden email]> wrote:
I was also referring to a programatic solution :). Perhaps the name is misleading, but RB is not the UI. RB is primarily the engine behind that contains the logic of performing a refactoring.


Exactlly. The UI can be OB-Refactory, or Gaucho, or just programatic.
 
Doru

On 24 Nov 2010, at 09:17, Cyrille Delaunay wrote:

> Indeed, in my case I would like to do that wihtout using UI. I want to write a test in which I rename a method and see if the events emited have been well-catched by RPackage.
>
> 2010/11/24 Igor Stasenko <[hidden email]>
> On 24 November 2010 02:00, Tudor Girba <[hidden email]> wrote:
> > Well, as long as you want to perform a refactoring I believe that RB provides the API in question.
> >
> Yes, of course. But question was 'how to do that programmatically' ,
> not using browser or other UI.
>
> > Doru
> >
> >
> > On 24 Nov 2010, at 00:52, Igor Stasenko wrote:
> >
> >> On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
> >>> Definitely use the RB for any code transformations.
> >>>
> >>
> >> I don't think it's a good option for meta-programming.
> >> For meta-programming, basic interface in Behavior or ClassDescription
> >> should be enough for manipulating
> >> with methods, without dependency from RB.
> >> Actually, RB then can use same API for manipulations.
> >>
> >>> Cheers,
> >>> Doru
> >>>
> >>>
> >>> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
> >>>
> >>>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
> >>>>
> >>>> Cheers
> >>>>
> >>>> Mariano
> >>>>
> >>>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
> >>>>
> >>>>> Hello,
> >>>>>
> >>>>> I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
> >>>>>
> >>>>
> >>>> I don't believe there is any simple way to do this.
> >>>>
> >>>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
> >>>>
> >>>>
> >>>>
> >>>
> >>> --
> >>> www.tudorgirba.com
> >>>
> >>> "To lead is not to demand things, it is to make them happen."
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Best regards,
> >> Igor Stasenko AKA sig.
> >>
> >
> > --
> > www.tudorgirba.com
> >
> > "Not knowing how to do something is not an argument for how it cannot be done."
> >
> >
> >
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>

--
www.tudorgirba.com

"Problem solving efficiency grows with the abstractness level of problem understanding."





Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

cdelaunay
Ok, thank you :)

2010/11/24 Mariano Martinez Peck <[hidden email]>


On Wed, Nov 24, 2010 at 9:44 AM, Tudor Girba <[hidden email]> wrote:
I was also referring to a programatic solution :). Perhaps the name is misleading, but RB is not the UI. RB is primarily the engine behind that contains the logic of performing a refactoring.


Exactlly. The UI can be OB-Refactory, or Gaucho, or just programatic.
 
Doru

On 24 Nov 2010, at 09:17, Cyrille Delaunay wrote:

> Indeed, in my case I would like to do that wihtout using UI. I want to write a test in which I rename a method and see if the events emited have been well-catched by RPackage.
>
> 2010/11/24 Igor Stasenko <[hidden email]>
> On 24 November 2010 02:00, Tudor Girba <[hidden email]> wrote:
> > Well, as long as you want to perform a refactoring I believe that RB provides the API in question.
> >
> Yes, of course. But question was 'how to do that programmatically' ,
> not using browser or other UI.
>
> > Doru
> >
> >
> > On 24 Nov 2010, at 00:52, Igor Stasenko wrote:
> >
> >> On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
> >>> Definitely use the RB for any code transformations.
> >>>
> >>
> >> I don't think it's a good option for meta-programming.
> >> For meta-programming, basic interface in Behavior or ClassDescription
> >> should be enough for manipulating
> >> with methods, without dependency from RB.
> >> Actually, RB then can use same API for manipulations.
> >>
> >>> Cheers,
> >>> Doru
> >>>
> >>>
> >>> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
> >>>
> >>>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
> >>>>
> >>>> Cheers
> >>>>
> >>>> Mariano
> >>>>
> >>>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
> >>>>
> >>>>> Hello,
> >>>>>
> >>>>> I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
> >>>>>
> >>>>
> >>>> I don't believe there is any simple way to do this.
> >>>>
> >>>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
> >>>>
> >>>>
> >>>>
> >>>
> >>> --
> >>> www.tudorgirba.com
> >>>
> >>> "To lead is not to demand things, it is to make them happen."
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Best regards,
> >> Igor Stasenko AKA sig.
> >>
> >
> > --
> > www.tudorgirba.com
> >
> > "Not knowing how to do something is not an argument for how it cannot be done."
> >
> >
> >
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>

--
www.tudorgirba.com

"Problem solving efficiency grows with the abstractness level of problem understanding."






Reply | Threaded
Open this post in threaded view
|

Re: rename a method programatically

cdelaunay
If someone wants to know, this is the I'm doing it:

  refactoring := RenameMethodRefactoring renameMethod: #oldMethodMethod in: class to: #newMethod permutation: (#()).
  refactoring execute.

2010/11/24 Cyrille Delaunay <[hidden email]>
Ok, thank you :)

2010/11/24 Mariano Martinez Peck <[hidden email]>



On Wed, Nov 24, 2010 at 9:44 AM, Tudor Girba <[hidden email]> wrote:
I was also referring to a programatic solution :). Perhaps the name is misleading, but RB is not the UI. RB is primarily the engine behind that contains the logic of performing a refactoring.


Exactlly. The UI can be OB-Refactory, or Gaucho, or just programatic.
 
Doru

On 24 Nov 2010, at 09:17, Cyrille Delaunay wrote:

> Indeed, in my case I would like to do that wihtout using UI. I want to write a test in which I rename a method and see if the events emited have been well-catched by RPackage.
>
> 2010/11/24 Igor Stasenko <[hidden email]>
> On 24 November 2010 02:00, Tudor Girba <[hidden email]> wrote:
> > Well, as long as you want to perform a refactoring I believe that RB provides the API in question.
> >
> Yes, of course. But question was 'how to do that programmatically' ,
> not using browser or other UI.
>
> > Doru
> >
> >
> > On 24 Nov 2010, at 00:52, Igor Stasenko wrote:
> >
> >> On 24 November 2010 01:43, Tudor Girba <[hidden email]> wrote:
> >>> Definitely use the RB for any code transformations.
> >>>
> >>
> >> I don't think it's a good option for meta-programming.
> >> For meta-programming, basic interface in Behavior or ClassDescription
> >> should be enough for manipulating
> >> with methods, without dependency from RB.
> >> Actually, RB then can use same API for manipulations.
> >>
> >>> Cheers,
> >>> Doru
> >>>
> >>>
> >>> On 23 Nov 2010, at 19:01, Mariano Martinez Peck wrote:
> >>>
> >>>> Cyrille I don't know why you need that but take into account that RB split their packages even more in the last months. So maybe it is easier for you to directly use RB and load with your code, the RB core or the specific package that you need. Mostly if you need some other similar functionalities.
> >>>>
> >>>> Cheers
> >>>>
> >>>> Mariano
> >>>>
> >>>> On Tue, Nov 23, 2010 at 6:56 PM, jaayer <[hidden email]> wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ---- On Tue, 23 Nov 2010 05:17:05 -0800 Cyrille Delaunay  wrote ----
> >>>>
> >>>>> Hello,
> >>>>>
> >>>>> I would like to know how I can rename a method programatically and safelly (without missing to raise any event that has to be raised)
> >>>>>
> >>>>
> >>>> I don't believe there is any simple way to do this.
> >>>>
> >>>> Basically, to rename a method you have to remove it first and compile into its class a new method containing the same source code but with a different selector at the beginning. This is how the refactory browser does it when you select "rename" from the "refactor method" menu. If anyone knows of a better way, I would be interested to hear it.
> >>>>
> >>>>
> >>>>
> >>>
> >>> --
> >>> www.tudorgirba.com
> >>>
> >>> "To lead is not to demand things, it is to make them happen."
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Best regards,
> >> Igor Stasenko AKA sig.
> >>
> >
> > --
> > www.tudorgirba.com
> >
> > "Not knowing how to do something is not an argument for how it cannot be done."
> >
> >
> >
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>

--
www.tudorgirba.com

"Problem solving efficiency grows with the abstractness level of problem understanding."