Matthew Walton writes:
> Luke Palmer wrote:
>
> >The remaining problem is what to do about unary dot. Repeated here for
> >the, er, benefit? of p6l:
> >
> > class Duple {
> > has $.left;
> > has $.right;
> >
> > method perform (&oper) {
> > &oper($.left);
> > &oper($.right);
> > }
> > }
> >
> >Let's change that into a Tuple class:
> >
> > class Tuple {
> > has @.elems;
> >
> > method perform (&oper) {
> > for @.elems {
> > .perform($_);
> > }
> > }
> > }
> >
> >Can you find the mistake?
>
> Well it's not using &oper on the elems anymore.
That's mostly because I really screwed up the example. Mind, it was
very, very early in the morning when I wrote this. Let's try again.
(This is a pretty trivial example, but the problem only gets worse as we
approach real life).
class MyStream {
has $.stream;
method :send_one ($item) {
$.stream.send($item);
}
method send ([EMAIL PROTECTED]) {
.:send_one("BEGIN");
for @data {
.:send_one($_);
}
.:send_one("END");
}
}
Luke