lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [lmi-commits] master 39f6c8c 2/2: Refactor, adding an argument


From: Greg Chicares
Subject: Re: [lmi] [lmi-commits] master 39f6c8c 2/2: Refactor, adding an argument to years_and_months_since()
Date: Tue, 27 Jun 2017 21:11:47 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 2017-06-22 13:14, Vadim Zeitlin wrote:
> On Thu, 22 Jun 2017 07:14:02 -0400 (EDT) Greg Chicares <address@hidden> wrote:
[...]
> GC>      BOOST_TEST_THROW
> GC> -        (years_and_months_since(base_date, other_date)
> GC> +        (years_and_months_since(base_date, other_date, true)
> 
>  For many years I've been on a crusade against boolean arguments, so let me
> try to convince you of their evil: the argument is basically just that the
> line above is incomprehensible as you have no idea about what does this
> "true" mean.

I had thought that the main thrust of your argument was that a parameter
that can take two values today may very well need three values tomorrow.
I.e., I remembered the "inextensible" argument here:
  https://www.wxwidgets.org/develop/coding-guidelines/#no_bool_params
but not the "readability" one.

>  I don't know if I've convinced you, but I wanted to at least try. As I
> read much more code than I write, I hate boolean parameters with a passion.
  ^^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^ ^^^^^ <-- I never thought of it that way

Point taken. I'll bear this in mind in the future. I'm not going to change
the calendar-date class at this time because the "curtate" concept is
overloaded and I'm not sure how the API should ideally be (re)designed.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]