Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 refactoring for introduce variable...

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
dango Posted - Jan 15 2008 : 6:10:12 PM
When I'm creating new code I often type the code before adding new member variables to the class.

Could you add a refactoring when you notice a lhs name is not recognized to introduce a new variable/new field/new member variable?

Thanks,
D
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 21 2008 : 4:08:18 PM
I like the idea, but my immediate reaction is that we are going to run into a pile of edge cases. Just taking something very simple, if you have the code:

int nFoo = 2;
test1 = nFoo * 1.0;
test2 = nFoo * 2;


I know what I probably mean, but this is opening the whole issue of implicit casts. It really depends on how clever people want the feature to be.
sl@sh Posted - Jan 21 2008 : 04:22:38 AM
Talking about new lhs variables, the appropriate type could be derived from the right hand side expression. Eclipse does something along these lines, allowing to correct a type definition on an initialisation line. E. g. in
double bar = 2.5;
int foo = 3*bar;
, the second line would be automatically transformed into
double foo = 3*bar;
by invoking the right shortcut.

This becomes a lot more helpful when invoking functions that return objects of templated classes, such as
std::list<MyClass>::const_iterator
, saving the time to look up the exact return type and actually typing it out!
feline Posted - Jan 17 2008 : 2:48:01 PM
Are you talking about local variables that are being underlined as mistyped symbols?

So long as you are in a class member function triggering a variation of VA's "Add member" dialog to add the variable to the current class sounds reasonable. It could pick up the unknown variable, but it would not have any idea of the type. You would need to type (or copy / paste) this into the dialog without any help from VA - no suggestions.

Is this what you are thinking of?

It seems quite reasonable, I am just a little concerned that people will be unhappy that VA has not attempted to infer the type of the variable. You can make an argument for doing this, but I can just see to many edge cases, involving pointer types and implicit casts for this to be wise.

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