Please see my page at fail.html for my latest musings on the topic.

—John

Replies are listed 'Best First'.
Re: Failure vs Undef
by dragonchild (Archbishop) on Aug 31, 2008 at 20:54 UTC
    Wow. That's really nice. I've always hated overloading the meaning of undef or 0 (as you have to do in C). Having an explicit "failure" value makes life a lot nicer.

    I'd be interested in more examples of using Failure, particularly P5 vs. P6.


    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      If you give me some ideas, I might elaborate on them.
        You gave several examples of P5 error checking, but didn't give the P6 version(s). Also, isn't there a way of telling the Failure object why the failure happened?

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: Failure vs Undef
by moritz (Cardinal) on Aug 31, 2008 at 21:07 UTC
    You might add an example for the infix:<orelse> operator, which seems to be also designed for handling undefs and failures, but which I don't really understand yet ;-)
Re: Failure vs Undef
by FunkyMonk (Bishop) on Aug 31, 2008 at 21:51 UTC
    Small nit. err was dropped sometime after 5.9.3, wasn't it?

    Still, another excellent article. ++

      I'm not sure. I made a note to change err to orelse, but I want to hear back from P6 mailing list first for the real story.

Re: Failure vs Undef
by massa (Hermit) on Sep 01, 2008 at 11:26 UTC
    Your set-inclusion line seems to be inverted to me. I would write:
    unhandled failures failures undefs falses
    That is to say, "the set of unhandled failures is a proper subset of the set of failures, that is a proper subset of the set of undefined values, that is a proper subset of false values".
    Because "" is a false value, but none of the others, undef is an undefined value and a false value but none of the others, etc...
    []s, HTH, Massa (κς,πμ,πλ)