On Tue, 2004-08-24 at 08:24, Aaron Sherman wrote:

>     $foo => 'a' or 'b'

I was too focused on the idea of C<??>/C<::> as a pair-like construct,
and I missed what should have been obvious:

        a ?? b :: c

IS

        given a { when true { b } default { c } }

Which S4 tells us is:

        a -> $_ { when true { b } default { c } }

If you take the C<??> out of the ternary expression and make it a
generic, binary logical operator that tests the topic for truth and
executes lhs if topic is true and rhs if it is false, then that becomes:

        a -> $_ { b ?? c }

And further S4 tells us that that can become:

        a ~~ b ?? c

because C<~~> automatically topicalizes its lhs for its rhs.

So, with the very minor change of making C<??> binary instead of
ternary, it turns out that we ALREADY HAVE a replacement for C<?:>, and
didn't realize it!

C<??> would also be darn useful in all sorts of places, as this lets you
write things like:

        given a {
                b ?? c;
                say "We did the first step";
                d ?? e;
                say "We did the second step";
        }

etc. My $0.02, but I think this is the way to go, and the whole C<::>
thing just fades into historical note land.

-- 
â 781-324-3772
â [EMAIL PROTECTED]
â http://www.ajs.com/~ajs

Reply via email to