Rocco Caputo wrote:

On Fri, Feb 20, 2004 at 08:37:39AM -0500, sungo wrote:


but really, you've changed the subject.  i wasn't talking about aliases.
i was talking about event dispatch.  we were talking about one specific
piece of api that can be fixed to be much more clear. i don't really
have interest in saving the world right now because i don't have time to
code that big of a patch.

i think adding an event dispatch method set to the session, even if it
just called the kernel methods behind the scenes, would help clarify the
api.  assuming we just add the two methods currently implemented for
event dispatch, things become pretty clear in several spots

$_[SENDER]->post('thanks_for_the_fish' => $fish);

$_[SESSION]->post('do_something'); # much clearer to me than $_[KERNEL]->yield('do_something');
$_[SESSION]->call('pie');


The semantics become very explicit as to who we're operating on with a
minimum of noise.



Here's a summary of what we've discussed so far. Keep in mind that Scott's original goal was to make wheels faster, not to make call() syntactically sweeter.

1: Implement $session->call() in terms of $kernel->call().

 Pros:
   It supports $other_session->invoke().
   It's the most convenient form of call() ever.
 Cons:
   It's the slowest form of call() ever.
   It leads to programs that save $other_session references.
   It's not available on all sessions.  To use it defensively
   requires:

     if ($other_session->can("call")) {
       $other_session->call(...);
     }
     else {
       $kernel->call($other_session, ...);
     }

2: Limit $session->call() to the current session with an explicit test
and croak.  Pass $session->call() directly to $self->_invoke_state().

 Pros:
   It uses the sweetest call() syntax.
   It's faster than wrapping $kernel->call().
 Cons:
   Its interface is misleading.
   It's not available on all sessions.  See #1.
   It may not be much faster than cvs' $kernel->call().

3: Implement invoke() as a Kernel method.

 Pros:
   $kernel->invoke() is the fastest option so far.
   Its interface doesn't imply more features than it implements.
   It's immediately available to every Session type.
 Cons:
   It's not as syntactically sweet as $session->call().
   Coming up with a good name for it is HARD.



Thank you for the summary Rocco. I think this clarifies the current discussion and breaks everything down in an easier to follow fasion.

- Scott

Reply via email to