Apologies if this has already been covered, but I haven't been able to
keep up to date much recently. It occurs to me that the distinction between
the use of &, | and ^ for bitwise ops and their use for junctions can be
flattened. For instance, consider

    $a = 2 | 3;
    print $a;

Of course, it could say

JUNCTION(0xDEADBEEF)

but here's another way of looking at it. Given that we have a junction
of two integers, we look at the zeroth bit of the junction. If ANY of the
zeroth bits in 2 and 3 are set, then we set the zeroth bit in the result.
If ANY of the first bits in 2 and 3 are set, then we set the first bit in
the result. Hey presto, we've just defined bitwise or in terms of junctions.

Because basically, that's what people do with bitwise ops - they munge a
bunch of values together, and look to see if any or all of a certain bit
in the result is true. From that point of view, junctions are just a delayed
version of what people are already doing with bitwise ops.

This naturally leads to ^ being syntactic sugar for the one() operator, but
I don't know if that's been already covered either.

-- 
You're all sick, except Simon. And he's sick, too. -- Kake Lemon Pugh

Reply via email to