|
Boost : |
From: Powell, Gary (powellg_at_[hidden])
Date: 2004-04-14 12:19:53
Rob Stewart wrote:
>From: David Abrahams <dave_at_[hidden]>
>> "Jeff Garland" <jeff_at_[hidden]> writes:
>> > On Wed, 14 Apr 2004 13:04:34 +0100, Val Samko wrote
>> >>
>> >> Does that mean that add_month won't be implemented? What if we call
>> >> it inc_month, instead of add_month? inc_month (Increase Month)
>> >> in no way assumes that the day of the month will stay the same,
>> >> it will just increase the month.
>> >
>> > Yes, perhaps a different name would help eliminate any confusion that we are
>> > doing 'math' here.
>>
>> I think readability is more important. Nobody but pedants have
>> problems with string + string. Likewise I think:
>>
>> d + 2*months
>>
>> or whatever is better than the functional-looking alternatives.
>If there was universal acceptance of what it means to add two
>months to a date, I might agree. Given the imprecise notion of
>what it means to add two months, however, I disagree.
>"next_month" or "increment_month" versus "add_month" better
>distinguish the imprecision.
Here I totally agree with Rob, adding months is a non-intuitive operation and
calling out the precision helps the readability of the program.
It makes perfect sense to do
d + (30 * days)
but not with Months.
Yours,
-Gary-
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk