On Wed, Apr 27, 2005 at 06:29:46PM +0200, Thomas Sandla▀ wrote:
> Patrick R. Michaud wrote:
> >>my $matches = any( @x_chars ) eq any( @y_chars );
> >>my $match = $matches.pick;
> >
> >Perhaps the easiest way to explain the difficulty here is to note that
> >executing a relational op (i.e. returning a boolean) value on a junction
> >argument returns a junction of boolean values.
> Is that so? Does Perl6 have some fundamental law of junction preservation?
> I would expect $matches to be either false or true---the junction values
> are garbage collected.

I would certainly expect $matches to be false or true if the
expression was invoked in a boolean context, but I'm not certain
it can "auto-collapse" outside of that.  In particular, we know that

    $x = any(0, 1);
    $y = $x + 1;         # $y == any(1, 2)

so a slightly different formulation of this would be:

    $w = any('a', 'b');
    $x = $w eq 'b';      # $x == any(0, 1)
    $y = $x + 1;         # $y == any(1, 2)

I think the assignment to $x above shouldn't be collapsed directly
to a simple false or true value until it's evaluated in a boolean


Reply via email to