Miroslav Silovic writes:
> [EMAIL PROTECTED] wrote:
> >So Pugs will evaluate that to (#f|#f), by lifting all junctions
> >out of a multiway comparison, and treat the comparison itself as
> >a single variadic operator that is evaluated as a chain individually.
>
> I think this is correct, however... this is not what I meat in my
> comment. Note I didn't use chained comparison anywhere.
>
> What I meant is that for any form with two parameters (in the example,
> 4 < ___ and ___ < 2), aparently it's not the same whether the two
> parameters refer to the same junction or to two equal (but distinct)
> junctions.
Well, we see the same kind of thing with standard interval arithmetic:
(-1, 1) * (-1, 1) = (-1, 1)
(-1, 1) ** 2 = [0, 1)
The reason that junctions behave this way is because they don't
collapse. You'll note the same semantics don't arise in
Quantum::Entanglement (when you set the "try to be true" option).
But you can force a collapse like this:
my $x = 4 < $j;
if $j < 2 { say "never executed" }
I'm wonding if we should allow a method that returns a junction that is
allowed to collapse the original:
if 4 < $j.collapse and $j.collapse < 2 {
say "never executed";
}
But that's probably not a good idea, just by looking at the
implementation complexity of Quantum::Entanglement. People will just
have to learn that junctions don't obey ordering laws.
Luke