Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Make member
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jcheyns
Starting Member

Belgium
1 Posts

Posted - May 06 2010 :  11:38:23 AM  Show Profile  Reply with Quote
Sometimes a have a loval variable I want to promote to become a member of my class, say:

CMyClass::aFunction(){

//bla bla

int aVeryWellChosenVariableName; // <-- at a certain point in time I want this one to become a member

//bla bla
}


Would that be possible? Are there any objections?

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - May 06 2010 :  3:19:52 PM  Show Profile  Reply with Quote
Currently the closest refactoring we have is "Add member". You click on a class name an type in the type and name. You can use the clipboard to make it even faster.

Do you use this type of promotion often enough to make it worth doing a separate refactoring for this?

Objections? If I think about edge cases, what about initializations and constructors?

int apple = 5;

here, we have 3 options:
1. Apple = 5;
2. Delete the line, and move initialization to the constructor (what if there are any, what if there are more constructors, user maybe use a shared function and call it from other constructors, etc.)
3. Move the initialization to the initializer list(s).

Constructors like:

cSomeClass obj("SomeString");

or what if there is a local reference like

int banana=5;
int apple=banana+5; // we would like to use the promote refactoring on apple

We can leave the initialization like

int apple=5;

becomes

Apple=5;

which makes sense from this point of view but it may seems odd. Another possibility is to disable the refactoring on symbols with initialization, but it would make more questions :)

I don't want to say it is impossible, but it may not as easy as you might suppose.

Edited by - accord on May 06 2010 3:21:15 PM
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - May 10 2010 :  4:25:43 PM  Show Profile  Reply with Quote
I have put in a feature request to see what the developers make of this:

case=43947

This case is about to promote variable to function parameter or member. A similar request came up recently:
http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=9542
Go to Top of Page

jase439
Ketchup Master

54 Posts

Posted - May 10 2010 :  11:38:27 PM  Show Profile  Reply with Quote
I would definitely make frequent use of both these "promotion" features if implemented.

Edited by - jase439 on May 10 2010 11:38:42 PM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000