Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Move implementation, not default parameters

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
steinsomers Posted - Jun 06 2007 : 06:47:13 AM
I wish Move Implementation to Source File (in C++) would not copy the default value (if any) of parameters and write it as a comment in the source file. For instance
void f(int p /*= 0*/)

I argue such comments are not only ugly (well no point arguing about that) but useless and even dangerous. I don't see how the default value of a parameter could matter to the implementation of a function, but if you somehow want to know, you shouldn't rely on these comments. There is (in VAX 1557) nothing verifying that the default value is still the same as the one in the declaration (if any is left).
Is there any alternative or filter for my AutoText to shape $ParameterList$ to my likings?

5   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Jun 26 2014 : 01:51:30 AM
case=3495 is implemented in build 2042 (see Refactoring page of VA Options dialog).
MHaggag Posted - Jun 07 2007 : 6:23:03 PM
Check this thread for a possible solution
feline Posted - Jun 06 2007 : 2:05:12 PM
quote:
Originally posted by steinsomers

There is (in VAX 1557) nothing verifying that the default value is still the same as the one in the declaration (if any is left).


One small addition to all of this, if you use Change Signature then this updates the commented out default parameter value in the cpp file for you.

True this does not ensure that the comment is correct, but it helps, especially if you normally use Change Signature.
sl@sh Posted - Jun 06 2007 : 10:27:50 AM
I too find the default comments useful. Not neccessarily for seeing the value used as a default, but mainly as a reminder that one or more of the parameters have default values.

This means several things to me:
1. As an imlementor, when I spot calls to the method, I will more likely recognize them, even when some of the parameters are omitted.
2. When implementing this function I will put more effort into asserting that default parameters indeed contain valid values in those cases they get used. It is easier to accidentally omit a parameter in a method call, than providing a wrong value! Of course, the implementor should check *all* the parameters for validity, but in practice it is just not feasible to catch each and every exception.
3. When, at a later time, I feel the need for an overloaded method that makes some reasonable assumptions (= default parameter values), I will more likely recognize there already is one (in a way)

I can easily accept that some people feel none of the reasons above is worth considering, but I would presume that there are others that find it as helpful as me.

The one counter-argument that remains is that indeed the commented-out default values do not get synchronised with the method declaration. It is possible that existing default values get changed or removed, or new ones get added. However, this much is true for any kind of refactoring, so it shouldn't be taken into account when considering the usefulness of this functionality.
feline Posted - Jun 06 2007 : 08:55:37 AM
Not currently, but we are considering adding an option to suppress these default parameters:

case=3495

I find seeing these defaults useful, but that is a personal preference.

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