Re: [PATCH] Change "refs/" references to symbolic constants

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

 



On Tue, 20 Feb 2007, Andy Parkins wrote:

> On Tuesday 2007 February 20 10:30, Junio C Hamano wrote:
> 
> > But at least to me,
> >
> > 	if (!prefixcmp(head, PATH_REFS_HEADS))
> > 		head += strlen(PATH_REFS_HEADS);
> >
> > is easier to follow than:
> >
> >         if (ref_is_head(head))
> >                 head += STRLEN_PATH_REFS_HEADS;

Ditto for me.

> Fine.  I don't really mind - and it's less work on my patch :-)
> 
> My argument in favour of the ref_is_head() method is that the prefixcmp() 
> method requires knowledge from the caller about how you tell whether a given 
> ref is a head - the second pushes that information further down the call 
> tree, abstracting it out just a little more.

That's the problem though.  Too much abstraction hides away the purpose.  
With prefixcmp() it shows that the code cares about a string prefix.  
With ref_is_head() you don't know what is happening there since that 
might be many things like a pointer comparison, etc. and you have to 
look ref_is_head() implementation to be sure.


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