Larry Wall wrote:
> Jonathan Lang wrote:
> : So 'orelse' is exactly like '//', except that the result of the left
> : side gets passed to the right side as an error message. Is there a
> : reason to make this exception, as opposed to altering '//' to behave
> : exactly like 'orelse' does?
> How 'bout, it's convenient to have the simpler defaulting semantics
> when you don't care what kind of undefined value is on the left.
If you don't care what kind of undefined value is on the left, you
probably won't notice if it's passed to the right; and the optimizer
may very well end up implementing the simpler semantics in this case,
even if you use 'orelse'. And if you explicitly want to use the
simpler semantics, you can come very close by blocking the right side
in a block that takes no arguments.
Conversely: if you do care about the undefined value, the subtle
distinction between '//' and 'orelse' (beyond the implied difference
in precedence) will be yet another language quirk that you'll have to
remember. Very inconvenient.
Jonathan "Dataweaver" Lang