develooper Front page | perl.perl6.language | Postings from May 2008

make POST blocks more usable

From:
Moritz Lenz
Date:
May 27, 2008 07:35
Subject:
make POST blocks more usable
Message ID:
483C204E.9070906@casella.verplant.org
I skimmed through S06 and I found no convenient way to use the return
value of sub/method in it's POST blocks.

Since they can (and should) be used (among other things) to check the
sub's/method's return value, I'd like to propose that the return value
of a sub is given as the argument to POST block, so that you can write

sub my_sqrt ($x) {
    # calculation with many possible return pathes

    POST -> $result {
        $result * $result == $x
    }
}

I don't really know what do when the sub is left through an exception,
maybe it should search for a POST multi with empty arguments? (or do
exceptions ignore POST blocks anyway?)

Cheers,
Moritz

-- 
Moritz Lenz
http://moritz.faui2k3.org/ |  http://perl-6.de/




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About