Re: [PATCH 0/4] Re: [PATCH 3/4] t: rev-parse-parents: avoid yoda conditions

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

 



On Sat, Sep 7, 2013 at 11:13 PM, Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
> On Sat, Sep 7, 2013 at 11:06 PM, Jeff King <peff@xxxxxxxx> wrote:
>> On Sat, Sep 07, 2013 at 10:11:49PM -0500, Felipe Contreras wrote:
>>
>>> > Though I prefer the current, I can certainly live and adapt to a changed
>>> > standard, and I do not mind doing so if there is a good reason. But I've
>>> > yet to see any argument beyond "it is not what I like". Which to me
>>> > argues for the status quo as the path of least resistance.
>>>
>>> Didn't Junio already provided reasoning?
>>
>> If the reasoning is "cmp(actual, expect) makes more sense to humans"
>> then I do not think it is universal.
>
> No.
>
> ---
> A(ny) sanely defined "compare A with B" function should yield the
> result of subtracting B from A, i.e. cmp(A,B) should be like (A-B).
> That is what you feed qsort() and bsearch() (it is not limited to C;
> you see the same in "sort { $a <=> $b }").  The definition naturally
> makes "cmp(A,B) < 0" like "A < B" and "cmp(A,B) > 0" like "A > B".
> ---
>
>> Otherwise why would so many
>> existing test frameworks do it the other way?
>
> Which many existing frameworks do it the other way?
>
>>> Here's more; human semantics:
>>>
>>> Computer, compare A with B
>>> cmp(A, B)
>>>
>>> Why would I write?
>>>
>>> cmp(B, A)
>>>
>>> Could you even construct an English sentence that starts with B, and then A?
>>
>> "Computer, given that we expect B, how does A differ?". Or "Computer, we
>> expect B; does A match it?"
>>
>> Or any number of variations. I'm sure you will say "but those seem
>> awkward and unlike how I think about it". But that was my point; it
>> seems to be a matter of preference.
>
> Really? You think any sane human being would prefer:
>
> Computer, given that we expect B, how does A differ?

And btw, that could barely be translated to cmp(B, A), probably cmp_given(B, A).

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]