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 Sun, Sep 8, 2013 at 12:02 AM, Jeff King <peff@xxxxxxxx> wrote:
> On Sat, Sep 07, 2013 at 11:52:10PM -0500, Felipe Contreras wrote:
>
>> > Ah, you mean "if you think that the compare function should behave like
>> > C *_cmp functions, it should be A-B". Perhaps it is simply that I do not
>> > think of the function in those terms, but more like "show me the
>> > differences from B to A".
>>
>> But that is the problem, you are unable to ignore the implementation.
>> You don't see test_cmp(), you see 'diff -u'.
>
> Yes, I already said earlier in the thread:
>
>   I certainly think of "test_cmp A B" as "differences from A to B", and
>   the order makes sense. IOW, the "test_cmp is diff" abstraction is
>   leaky, and that is fine (if it were not leaky, then order would not
>   matter at all, but it clearly does).

Then I don't think you can give a fair and objective opinion about
what should be the ideal ordering of the arguments. You would be
forever biased to whatever is the order of 'diff -u'.

> And I do not think it is a problem. The point of the function is not to
> abstract away the idea of comparison. The point is to give a hook for
> people on systems without "diff -u" to run the test suite.

The point according to whom? I say it's the other way around.

>> > John mentioned JUnit, NUnit, and PHPUnit earlier in the thread. I
>> > believe that Ruby's Test::Unit::Assertions also has
>> > assert_equal(expected, actual).
>>
>> That's because they all do first expect, then actual.
>>
>> assert_equal( expected, actual, failure_message = nil )
>> assert_not_equal( expected, actual, failure_message = nil )
>>
>> That's why.
>
> I do not see any reason why "not_equal" would not also work as
> "assert_not_equal(actual, expected)". Maybe I am missing your point.

All right, maybe it's because Ruby started in Japan, and their
sentences have very different orderings, maybe it's legacy from
another test framework, maybe there's no reason at all and somebody
just randomly picked them.

Either way the fact that others are doing it differently doesn't mean
that's the best way, that would be argumentum ad populum, and mothers
are keen to remind us that if other kids are jumping the bridge, that
doesn't mean we should too.

-- 
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]