From: Junio C Hamano Date: Sun, 17 Sep 2006 01:22:09 GMT Subject: Re: [PATCH] gitweb: Make git_get_refs_list do work of git_get_references Message-ID: <7vodtf8eym.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <200609170226.39330.jnareb@gmail.com> Jakub Narebski writes: > Make git_get_refs_list do also work of git_get_references, to avoid > calling git-peek-remote twice. It now returns either list of refs as > before in scalar context, or references hash and list of refs in list > context. I do not think we want to have too many functions that return different things depending on contexts. Forcing callers to remember what the function does in which context is bad. You seem to like writing: my $value = that_function(@args) but I'd rather see all callers to say: my ($value) = that_function(@args); even when they expect just one value from the function. One less thing to remember, and one less source of surprises. Especially for this particular case, you are not even avoiding extra computation when you are only returning list, so I do not think making the return value depend on the calling context is buying you much.