in reply to Re^2: What could make "()" a good value for boolean false?
in thread What could make "()" a good value for boolean false?
I hope not, because I'm opposed to it. Sub that are expected to return a scalar shouldn't suddenly return nothing. It causes subtle problems that aren't caught by the compiler.
Consider what happens if type suddenly returned nothing instead of `undef`:
my $h = { type => type(), name => name(), };
return (); should be used for subs that are expected to return a list.
return undef; should be used for subs that are expected to return a scalar. There are exceptions, of course.
|
---|