develooper Front page | perl.perl6.language.flow | Postings from July 2005

standard asynchronous deferred-to-result syntax RFP

Thread Next
From:
David Nicol
Date:
July 14, 2005 12:11
Subject:
standard asynchronous deferred-to-result syntax RFP
Message ID:
934f64a205071410165a197ff3@mail.gmail.com
I have uploaded asynchronous::universal::ready and
asynchronous::universal::set_callback
to CPAN.  They are both entirely trivial packages with a mess of
documentation.  The
idea behind them is to support asynchonous frameworks in which the
immediate result
of passing away a message is a placeholder object with a ready method
that will return
a false value until its result message comes back, at which time the
placeholder upgrades
itself to a result.

To avoid mandating true ready methods for all objects in the cosmos that might 
get returned as the result of an asynchronous function,
asynchronous::universal::ready
provides a true ready method in UNIVERSAL.

set_callback presumes two interfaces to an asynchronous framework,
"set_callback"
for declaring a coderef that is supposed to be run when the
asynchronous function
completes.  Synchronous objects have already completed, so
UNIVERSAL::set_callback
runs the coderef immediately.  The other interface is a method
"callback_queue" which
would give direct, framework-dependent access to the callback queue on
an object, should
such a thing exist in the given asynchronous framework. 
UNIVERSAL::callback_queue
returns an empty arrayref.

The hubristic hope is that authors of asynchronous frameworks will
standardize on these
interfaces:  ready, set_callback, callback_queue.

Thanks for listening, and I'll take my answer off the air. :-)


-- 
David L Nicol
Aesop's fables, with text-sensitive advertising:
http://cronos.advenge.com/pc/aesop/start.html

Thread Next


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