develooper Front page | perl.perl6.internals | Postings from August 2004

Re: Something to ponder

Thread Previous | Thread Next
Aaron Sherman
August 17, 2004 15:20
Re: Something to ponder
Message ID:
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

I would think it would look more like (again, Perlish example):

		does returntype(
			Net::Address::IP -> $ip {
				die "Remote host unresolvable: '$ip'";
			}, Net::Address -> $addr {
				die "Non IP unresolvable address: '$addr'";
			}, Str -> $_ {
				print "Seemingly valid hostname: '$_'\n";

Of course, that's just Perl. Perhaps Python would add something that
would look like:

	returnswitch: sock.peername()
		lambda ip: raise OSError, "Unresolvable %s" % str(ip)
		lambda addr: raise OSError, "Unresolvable non-IP %s" % str(ip)
	returncase str:
		lambda name: print "Seemingly valid hostname: '%s'" % name

My python skills are still developing, so pardon me if I've gotten it
wrong, and I'm just inventing for purposes of

Is that the kind of thing you had in mind, Dan, or am I misunderstanding
how return continuations work?

☎ 781-324-3772

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About