Thomas Sandlaà writes:
> Luke Palmer wrote:
> >That's quite nice, but I've been kind of wanting to go the other way.
> >You know, not every operation in Perl 6 needs to have a punctuation
> >operator.
> >
> >I think we should not use \, and also get rid of ^. I'm interested in
> >seeing an example where using ^ is readable enough over one() where its
> >conciseness is warranted. I haven't found that yet.
>
> What I tried to provide is syntactic completeness---and beauty---in the
> sense of the table given below. I've found a posting of Damian where he
> opposes the usage of binary '!' and '!!' because it looks too negative.
> Is there another grammar reason why there is no single character list op
> for the none junction?
Yeah. Because it doesn't exist in English, the natural language that
Perl most closely follows (which isn't very closely).
if $a | $b == 3 {...}
If A or B is 3 ...
if $a & $b == 3 {...}
If A and B are 3 ...
if $a \ $b == 3 {...}
*If A nor B is 3 ...
In English it's more like:
if \ $a \ $b == 3 {...}
If neither A nor B is three ...
And that's one of the reasons that I don't want ^ either:
if $a ^ $b == 3 {...}
*If A oneof B == 3 ...
The most Englishish equivalent of this is the one we already have:
if one($a, $b) == 3 {...}
If one of $a, $b is three ...
I suppose.
> Another unanswered question is: how often is the ref operator needed
> in Perl6?
I don't know. There's not really a corpus of Perl 6 yet is there. And
Perl is TMTOWDI, right, so you never really *need* it. But how often
will it be wanted? I don't really know. I know I don't use it very
much at all in Perl 5.
> eval | value | | bitwise ops
> rhs if | returning | junction | num str bit
> lhs is | low | high | | + ~ ?
> -------+-----+------+----------+----------------
> true | and | && | & all | +& ~& ?&
> always | xor | ^^ | ^ one | +^ ~^ ?^
> false | or | || | | any | +| ~| ?|
> false | nor | \\ | \ none | +\ ~\ ?\
> undef | err | // |
I definitely like the symmetry. But we have to remember that the P in
Perl (can) stand for Practical. The advantages of having syntactic
symmetry are nice, and they aid learning. But they aren't nearly as
important as semantic symmetry/consistency. (Not to say that they
aren't important)
We have a surplus of semantic ideas, and a shortage of characters on the
keyboard. Adding seldom-used (and in this case, confusing) operators in
the face of consistency is a Maxwellian thing, but I don't think it's
hiding any deep truth behind it this time.
Compare:
say "nope" if $a \\ $b;
say "nope" unless $a && $b;
I find the latter actually reads well in our precious natural languages.
The former just seems like golfing.
Luke