On 9/7/05, Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> wrote:
> Here's a Real Live Perl 6 module I wrote recently. I've omitted a few
> magic portions of the code for clarity.
Thanks for real live perl 6 code. It's always nice to have real examples.
However, I'm arguing for logical stability without losing expressive
power. The case that convinces me is the one where something becomes
a lot harder without lexical junctions. This one doesn't:
> module Trace-0.01-BRENTDAX;
>
> my $active;
> ...
>
> sub activate(*%newtags) {
> $active |= any(keys %newtags);
@active.push(keys %newtags);
> }
>
> sub trace([EMAIL PROTECTED] is copy, *%to is copy) is export {
> ...
> if $active eq any('all', keys %to) {
if any(@active) eq any('all', keys %to) {
> ...
> print $ERR: @msg;
> return [EMAIL PROTECTED] #but true;
> }
> return;
> }
And that is clearer to me at least. You can tell the nature of the
comparison: that you're checking a list of pattern against a list of
active objects, rather than a list of patterns against a single
object, which is what it looked like before. YMMV on that angle,
though.
The reason I think that this approach won't lose expressive power is
mostly because of our new Set class. The one remaining thing is when
you build up a nested junction in terms of ors and ands and check
that, as was given in one of Damian's old examples. I really haven't
come up with a reason you'd want to do that yet, but I *am* looking.
I'm not on a mission to destroy junctions, really. I'm just on a
mission to make things make sense. :-/
Luke