Hi,

I read is S03,

    The && and || operators are smarter about list context and return ()
    on failure in list context rather than Bool::False. The operators
    still short-circuit, but if either operator would return a false
    value, it is converted to the null list in list context so that the
    false results are self-deleting.

For "&&", wouldn't it be a better idea to return an empty list only if
the *first* operand is false?  In other words, I suggest that "$a && $b"
behave in list context like this:

    * If $a is false, return ()
    * Otherwise, return $b

Here's a use case that would benefit from this behaviour:

Suppose you want to generate an argument list for an external command.
For some reason you have a boolean value $include_arg3 and you want to
include $arg3 only if $include_arg3 is true:

   my @args = $arg1, $arg2, $include_arg3 && $arg3, $arg4;

Here you probably want to include $arg3 even if it is a false value like
"0", provided that $include_arg3 is true.

Regards,
Christoph

Reply via email to