Re: [PATCH (take 3)] gitweb: Use git-show-ref instead of git-peek-remote

2 messages, 2 authors, 2016-08-11 · open the first message on its own page

Re: [PATCH (take 3)] gitweb: Use git-show-ref instead of git-peek-remote

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:28:01

Jakub Narebski [off-list ref] writes:
While at it make git_get_references return hash in list context,
and reference to hash (as it used to do) in scalar and void contexts.
Why did you have to add this?  Generally, context sensitive
returns make the program much harder to maintain, because it
forces the call sites to be extremely careful to choose between
"my ($foo) = func()" vs "my $foo = func()", and people who later
call the function inevitably make mistakes.

So unless there is a compelling reason, I'd rather not see more
"wantarray" in the program.

Re: [PATCH (take 3)] gitweb: Use git-show-ref instead of git-peek-remote

From: Jakub Narebski <hidden>
Date: 2016-08-11 20:36:10

Junio C Hamano wrote:
Jakub Narebski [off-list ref] writes:
quoted
While at it make git_get_references return hash in list context,
and reference to hash (as it used to do) in scalar and void contexts.
Why did you have to add this?  Generally, context sensitive
returns make the program much harder to maintain, because it
forces the call sites to be extremely careful to choose between
"my ($foo) = func()" vs "my $foo = func()", and people who later
call the function inevitably make mistakes.

So unless there is a compelling reason, I'd rather not see more
"wantarray" in the program.
O.K. I have browsed through gitweb, and I see that we almost always
want the hashref, not hash (for passing further).

-- 
Jakub Narebski
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help