Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Make member

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
jcheyns Posted - May 06 2010 : 11:38:23 AM
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?
3   L A T E S T    R E P L I E S    (Newest First)
jase439 Posted - May 10 2010 : 11:38:27 PM
I would definitely make frequent use of both these "promotion" features if implemented.
accord Posted - May 10 2010 : 4:25:43 PM
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
accord Posted - May 06 2010 : 3:19:52 PM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000