Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: [PATCH] Git.pm: Don't return 'undef' in vector context.

From: Dan Zwell <hidden>
Date: 2016-06-15 22:43:52

Junio C Hamano wrote:
I did not examine the callers but my gut feeling is that it
would be simpler and cleaner to always return () without
checking the context.  In scalar context:

	sub null {
        	...
                return ();
	}
	my $scalar = null();

would assign undef to $scalar anyway.

I generally try to stay away from functions that changes their
return values depending on the context, because they tend to
make reading the callers to find bugs more difficult.
<snip>
That's reasonable. I'll resend this as part of the git-add--interactive 
color patches. This can be cherry-picked out, but some of the other 
stuff I want to do depends on it (a helper function that I wrote, 
config_with_default($repo, $key, $default)).

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