Author |
Topic |
|
Curtis
Junior Member
14 Posts |
Posted - Dec 12 2007 : 2:48:50 PM
|
When a class is first created, there are several things you do right away:
1. create fields 2. create properties 3. add fields to the constructor for initialization
Add a refactoring to a constructor to "Add Fields to Constructor for Initialization". Then let the developer choose the fields from a dialog (list fields with a checkbox beside) and add the fields to the constructor and initialize them to the default value. |
Chief Software Fanatic - www.carverlab.com |
|
mwb1100
Ketchup Master
82 Posts |
Posted - Dec 12 2007 : 3:27:23 PM
|
There was a recent request to have VAX create an initialization list: http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=6859
I like the checkbox idea, and I think that even if VAX cannot reasonably determine what the 'default' value for a field might be, just having the field in the initializer list so that I can fill in the actual initial value would be a nice feature. |
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - Dec 13 2007 : 3:15:10 PM
|
As mwb1100 says, initializing custom types is very hard. What about structures? Variables where the type comes from a #define? It is easy to produce real world cases that are very hard to have intelligent defaults for. |
zen is the art of being at one with the two'ness |
|
|
graham.reeds
Ketchup Master
United Kingdom
51 Posts |
Posted - Dec 14 2007 : 09:35:38 AM
|
If it can't think of one, do what it does now - not add it. |
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - Dec 14 2007 : 10:03:23 AM
|
Is this not going to make things worse? For a class with 15 member variables you might get a random 7 of them initialized, and then need to add the remaining 8, at the correct points, into the list. |
zen is the art of being at one with the two'ness |
|
|
PsiX
Junior Member
14 Posts |
Posted - Dec 14 2007 : 10:17:44 AM
|
As was already posted on the other thread and above, it would be nice if VAX could generate the initalizer list even if it can't fill it with meaningful values. Where it can't fill the list, it should leave a comment, but more like this:
X:X(): Base(/* write initializer */), int i(0), void* pPtr(NULL), Complex(/* write initializer */), float(.0f) { }
|
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - Dec 15 2007 : 11:36:33 AM
|
I have put in a feature request for this to see what the developers make of it:
case=10622 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|