Larry Wall larry-at-wall.org |Perl 6| wrote:
Neither, probably. You'd get an undef of type Num. Which might or
might not convert to NaN or 0 under various circumstances.
The orthodox documentation has Failure being undef that throws an
exception if you try and get a value from it. Nothing else besides
Failure has a special capability of combining with other types that
way. You can't get 0 from it -- just a throw.
It could be some other undefined protoobject of type Num, that had added
behavor mixed in explicitly by the function before returning it. But,
it's already a Num, so undef but 0 doesn't do anything useful. It can't
trigger a conversion unless it tries to convert to some other type. Do
we really need another mechanism here? And why would this function
(e.g. ++) be different than functions in general, which are supposed to
"fail"? Failure means thowing an exception or mixing the Failure into
the correct return type, and that behaves as described in the previous
paragraph.
--John
(Am I Worthy yet?)