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

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

 



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

  Powered by Linux