"Alexey Trofimenko" <[EMAIL PROTECTED]> writes:

> I wanna ask, could be there in perl6 any difficulties with
> recognizing C<::> as part of C<... ?? ... :: ...> and C<::> as
> "module sigil"? Does it involve some DWIM?

Among other things, the ?? will tip off the parser that it's looking
for an expression followed by the :: operator, so under normal
conditions the namespace-oriented :: will never be mistaken for the ::
that goes with ??, because the parser won't be looking for that kind
of :: except after a ??.

It may be though that if you need to put the namespace-oriented ::
between a ?? and its corresponding ::, you might need parentheses:

my $foo = $bar ?? ($baz::wibble) :: $baz::quux; # This is clear and good.

Otherwise...

my $foo = $bar ?? $baz::wibble :: $baz::quux; # This is more questionable.

The parser _might_ try to pair the first :: with the ??, in which case
it's going to get confused -- probably when it tries to figure out
what wibble is, or definitely when it hits the second :: -- and would
then have to either backtrack or complain.  (Complaining is easier;
backtracking is DWIMmier and arguably more Perlish in the long run but
could be added in the post-6.0 era if desired; turning a former error
into something valid is usually considered to be backward-compatible.)

But that case -- using the namespace :: between ?? and :: -- should be
the only situation where any ambiguity could arise over ::, and so it
seems reasonable to require (or at least strongly recommend) the
parentheses in that case.

I am assuming here that we don't need to have a unary or binary ??
operator.  That would complicate matters rather substantially.

-- 
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"[EMAIL PROTECTED]/ --";$\=$ ;-> ();print$/

Reply via email to