Austin Hastings writes:
> A12 sez:
>
> If your delegation object happens to be an array:
>
> has @:handlers handles 'foo';
>
> then something cool happens. <cool rays> In this case
> Perl 6 assumes that your array contains a list of potential
> handlers, and you just want to call the first one that
> succeeds.
>
> This is not clear, and I'm not liking it at the moment anyway. It has the
> effect of saying:
>
> "If you HAS-A attribute that is an array, you cannot delegate to it, but if
> you IS-A array, no worries."
Well, the @ sign has to mean something, right? I mean,
/ <@foo> /
doesn't turn the stringified value of @foo into a regex and match
against it. I figure you can delegate from a queue like:
class Queue {
has Array $:elements handles Âpush pop spliceÂ;
}
And if you need the @ sigil for, say, a regex, you can still say:
/ <@$:elements> /
Though the hash "handles" handler hardly seems useful to me. Perhaps
someone can explain what that's intended to accomplish.
Luke