Author |
Topic |
|
AGPX
Senior Member
28 Posts |
Posted - Aug 26 2007 : 10:26:27 AM
|
Hi,
We're using VAX in a project and it's a god damn cool tool.
During development we need some extra features VAX don't have such as Extracting a symbol as a constant.
I see currently some other assistance tools do this.I think it'll be a gem to VAX.
Thanks.. |
Edited by - AGPX on Aug 26 2007 10:27:11 AM |
|
sl@sh
Tomato Guru
Switzerland
204 Posts |
Posted - Aug 27 2007 : 06:13:42 AM
|
IIRC this already was suggested. The problem with this is VAs ability to determine what is a constant and what not. E. g. if you have a considerably short string constant or an integer value, chances are that any automated replacement also replaces instances that shouldn't be!
What is worse, depending on the number of projects and their relative visibility, you might end up replacing constants in projects that do not know of the constant's declaration!
To make this kind of refactoring work in a useful way, it should prompt the user the same way the 'Rename' dialog does - enabling the user to select or unselect whatever needs to be replaced. Even then, I'm not sure it would be wise to have this work cross-project. |
|
|
AGPX
Senior Member
28 Posts |
Posted - Aug 27 2007 : 08:35:47 AM
|
Yes , you are right,i've never mention doing it in cross project. But at least including it as you explained or with a simpler way will be better than nothing.
Maybe it should be done by locally finding related references.Cross-project is not necessary and as you say it's not wise.As simpliest solution it can replace related symbol with only current selection.
It's a common refactoring used in many languages and IDE's.So that should be very good. |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Aug 27 2007 : 11:12:15 AM
|
We are considering a similar feature, to turn a number or string into a local variable:
case=1492
once you have the variable it is a small step to make it a constant.
For how, if you are looking at a single function, or within a selection have you considered find and replace? Not quite the same, and it does leave you needing to add the constant by hand, but it should work most of the time. |
zen is the art of being at one with the two'ness |
|
|
AGPX
Senior Member
28 Posts |
Posted - Aug 28 2007 : 02:15:55 AM
|
Yes , that works most of the time,but if constant is not defined as variable and you have lots of different kind of constants ,it gets harders to extract as constants |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Aug 28 2007 : 08:21:04 AM
|
I don't understand.
My suggestion, and the refactoring idea when implemented, are designed to take some code like this:
static void functionToUpdate()
{
func1(bla(34), 7);
// more stuff
func2(4, bla(34));
}
which then becomes:
static void functionToUpdate()
{
int new_variable = bla(34);
func1(new_variable, 7);
// more stuff
func2(4, new_variable);
}
you then just need to convert "new_variable" into a constant. This is a two step process, but quite often people will want to extract a variable without turning it into a constant. |
zen is the art of being at one with the two'ness |
|
|
AGPX
Senior Member
28 Posts |
Posted - Aug 28 2007 : 08:51:52 AM
|
I get it now , i didn't understand you well . OK |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Nov 07 2014 : 10:07:55 AM
|
case=1492 is implemented in build 2052 |
|
|
|
Topic |
|