Gaal Yahas wrote:
In pugs, r7961:

     my @pats = /1/, /2/;
     say "MATCH" if 1 ~~ any @pats; # MATCH
     say "MATCH" if 0 ~~ any @pats; # no match

So far so good. But:

     my $junc = any @pats;
     say "MATCH" if 1 ~~ $junc; # no match
     say "MATCH" if 0 ~~ $junc; # no match

Bug? Feature?

Ohh, interesting. This reminds me to my proposal
that junctions are code types and exert their magic
only when recognized as such. The any(@pats) form
constructs such a code object right in the match while
the $junc var hides it. My idea was to explicitly
request a code evaluation by one of

  my &junc = any @pats;         # 1: use code sigil
  say "MATCH" if 1 ~~ junc;

  say "MATCH" if 1 ~~ do $junc; # 2: do operator

  say "MATCH" if 1 ~~ $junc();  # 3: call operator

But this might just be wishful thinking on my side.

Reply via email to