in reply to Re: style for returning errors from subroutines
in thread style for returning errors from subroutines

This looks really interesting. I wish I could understand more of it!

You lost me just after the closure (which I have read about in The Panther Book, but have never used). Am I right in thinking that the closure creates a place to store return values, and that if a closure is not returned, an error is? Or is the error in the closure? Where exactly? Or is that left up to me?

Boldra

  • Comment on Re: Re: style for returning errors from subroutines

Replies are listed 'Best First'.
Re: Re: Re: style for returning errors from subroutines
by Anonymous Monk on Jun 15, 2001 at 18:08 UTC
    The closure is a holder for a value. You can instead return an error. That is a subref (legally the same as a closure, but not holding a value) that on deref gives a default (including a possibility to leave the program for dead) but is blessed to contain the error and at the same time providing an easy test to distinguish from a closure.