On Mon, Apr 25, 2005 at 08:33:06PM +0200, Juerd wrote:
: I think it would be great to be able to use a junction with use:
:
: use strict & warnings;
:
: A disjunction could mean any of the listed modules suffices. This comes
: in handy when you code something that will work with any of three XML
: parsers. Although because ordering matters, the // operator is perhaps
: better.
:
: But "use strict & warnigs;" looks great and I wonder if it can work.
Well, there's a bit of a syntactic problem with & anywhere a term
might be expected after a term, since it will assume you want to
start a &foo. For another example
sub foo (Int&Str &block) {...}
is probably not going to parse right. Maybe that's a good place for
sub foo (:(Int&Str) &block) {...}
Alternately, we install a small heuristic and document it in the fine print.
By and large, we've managed to avoid such heuristics in Perl 6, but maybe
this is a good spot for an evil heuristic.
The "use" ambiguity might easily be resolved by saying that "use"
always parses using indirect object syntax, which would distinguish
use strict & warnings;
from
use strict: &warnings;
(Note: such a colon could possibly be used to distinguish Perl 6 from
Perl 5 in Main too, at least if the first "use" needs a colon.)
I don't know of any easy fix for the "type var" ambiguity though.
However, all that being said, please note that
use strict & warnings: @args;
is unlikely to be useful unless the two modules have a similar
interface. It'd be much more useful to be able to logically cascade
"use" statements as a whole.
Larry