[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A plea for a new old language




On Wednesday, May 7, 2003, at 08:33 AM, Dan Sugalski wrote:
> I'm trying to get Larry to do it with Perl 6, but that's a ways off. 
> Ruby does them but it's a little-used feature. Beyond that... well, 
> AFAIK, beyond that there's nothing. And I'd really like there to be.

Io has continuations in the form of asynchronous messages and futures. 
Example:

aFuture = obj @foo

// the @ means "perform message foo asynchronously"
// that is, in a light weight thread owned by obj
// The aFuture's value ivar is set with the result

result = aFuture value

// This causes the current light weight thread to pause
// until the aFuture's vale is set.
// So this is effectively a continuation.
// another option is:

obj @(foo) sendResultTo(target, "foobar")

// which is more like the callcc style

The interesting thing about this style of use is that no one seems to 
find it difficult to understand. Also, Io uses futures to do automatic 
deadlock detection. When a deadlock would happen, it raises an 
exception instead of allowing it.

Cheers,
Steve
Io, a small language: http://www.iolanguage.com/