On Tue, 2004-08-17 at 16:22, Felix Gallo wrote:On Tue, Aug 17, 2004 at 04:08:34PM -0400, Dan Sugalski wrote: > 1) We're going to have MMD for functions soon > 2) Function invocation and return continuation invocation's > essentially identical > 3) Therefore returning from a sub/method can do MMD return based on > the return values
$x -----\
\
@mylist -+--- $obj.mymmdsub;
/ %hash --/
How very fungible of you ;-)
Still, I think that's a nice APPLICATION, but the concept is more flexible, if I understand it correctly. It would be something that would look more like a cross between exception handling and a switch statement. [snip] Is that the kind of thing you had in mind, Dan, or am I misunderstanding how return continuations work?
Yep, though the error dispatch case is definitely the easy one. Where it gets fun is:
sub foo :come_from('bar', int) { print "In foo!"; }
sub baz :come_from('bar', string) { print "in Baz!"; }
sub bar { return(rand() > .5 ? 1 : "Nope"); }
with that code, half the time it'll print "In foo!", the other half "in Baz" when you call bar, because where it goes when bar exits depends on what bar returns...
--
Dan
--------------------------------------it's like this------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk