On Tue, Jul 03, 2001 at 11:54:42PM -0400, [EMAIL PROTECTED] wrote:
> 
> On 29-Jun-2001 Rocco Caputo wrote:
> > On Fri, Jun 29, 2001 at 12:54:30PM -0400, [EMAIL PROTECTED] wrote:
> >> For those of you who aren't on IRC, here is a list of different schemes
> >> for doing addressing in POE and beyond.
> >> 
> >> http://pied.nu/Perl/addresses.txt
> >> 
> >> Anyone have other ideas?  Any preferences?
> > 
> > URI style isn't transparent.  Ideally, a program shouldn't need to
> > know whether it's talking to a poe thingy or a stem thingy, so
> > everything up to the colon gets in the way.

Yeah! I agree! With myself! Me too!

> > I'm partial to kernel/session/event, where kernel/ and kernel/session
> > can just be left off if they're not needed:
> > 
> >   kernel/session/event
> >   session/event
> >   event
> 
> Given a plain scallar, taken out of context (say in the doco, or in email,
> or in a tuple-space), how do you tell if it's a session, kernel or event?
> 
>         session/
>         kernel//

No kernel or event mentioned:
        "/session/"

No session or event mentioned:
        "kernel//"

Same as yield:
        "//" or just ""

Machines can read it; why can't people?  I understand, though: at
first glance, the reader's got to do a little more thinking.
Positional fields suck, especially when paths like that get long (just
what does "/milkyway/sol/earth/n-america/dngor//" mean?).  That's a
point scored for that ugly "/tag=value/tag=value" format.

Anyway, here's how it's parsed.  Mind you, I just woke up and this is
just a little better than pseudocode.

sub parse_address {
  my $address = shift;
  my ($kernel, $session, $event);
  my @address = split /\//, $address;

  if (@address == 0) {
    # Pathological case: yield() by another name.
    ($kernel, $session, $event) = ($my_kernel, $my_session, $my_event);
  }
  elsif (@address == 1) {
    ($kernel, $session, $event) = ($my_kernel, $my_session, @address);
  }
  elsif (@address == 2) {
    ($kernel, $session, $event) = ($my_kernel, @address);
  }
  elsif (@address == 3) {
    ($kernel, $session, $event) = @address;
  }
  else {
    croak "What you say";
  }

  # Empty fields are filled in with current defaults.
  $kernel  ||= $my_kernel;
  $session ||= $my_session;
  $event   ||= $my_event;

  # Do whatever with it.
  ...;
}

[...]

> > I think it scales, too:
> > universe/galaxy/solarsystem/planet/cluster/kernel/session/event
> > 
> > Oh, this is just a bang path in disguise.  Whee!  "/" is a little
> > easier to type than "!", anyway.
> 
> IHNJ, IJLS BANG PATH

Bang! Path! Bang! Path! Bang! Path! Bang! Path! Smock! Smock! Smock!

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net

Reply via email to