[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master 6b93e91 11/12: Remove an unneeded auxilia
From: |
Greg Chicares |
Subject: |
Re: [lmi] [lmi-commits] master 6b93e91 11/12: Remove an unneeded auxiliary function |
Date: |
Wed, 23 May 2018 19:06:38 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 2018-05-23 17:24, Vadim Zeitlin wrote:
> On Tue, 22 May 2018 17:09:23 -0400 (EDT) Greg Chicares <address@hidden> wrote:
[...]
> GC> - increase_to_if_smaller(max_header_lines_, std::size_t(h / lh));
> GC> + max_header_lines_ = std::max(max_header_lines_, std::size_t(h /
> lh));
[...]
> This is not terribly important, but I regret this function disappearance
> because IMHO the old version was more clear than the new one: you need to
> carefully scan the line now to confirm that the same variable appears in
> both the LHS and the RHS, whereas it was immediately clear before.
(OTOH, it wasn't necessarily obvious to me which argument was increased.)
> Of course, "max" is standard
That's its conclusive advantage IMO.
> but it doesn't allow to avoid
> specifying the variable name twice, which is a significant disadvantage.
> It's unfortunate that C++ doesn't have "a max= b" to go with "a += b" etc
> (Perl 6, of course, does).
When reviewing this commit I dreamt of user-defined primitives, with an
extensible character set, which would let us write APL's '⌈' and '⌊'
for max() and min():
max_header_lines_ ⌈= std::size_t(h / lh);