Scott Walters writes:
> Juerd,
>
> You'd do well to not remove the conclusion of my post when the conclusion
> is that the I strongly support you. Otherwise, your reply, read out of
> context, sounds like you're fending off an attacker ;)
>
> People would do well to seperate the merits of the idea from the merits of the
> suggested implementation. I'd like to see people say "I like the idea but
> the implementation isn't workable" or alternatively "The ` operator isn't
> that important but I'm not sure the idea merits the change". I hate one
> negitive with the other implied.
>
> If I understand correctly, Perl looks for either a term or operator
> at any given moment. %hash and `rf -rm *` are both terms, hence
>
> %hash `rf -rm *`
>
> makes no sense. Aside from playing hell with editors quoting, something
> proposed to be solved by making the real grammar of Perl available in
> a modular way for inclusion in editors, is there any reason that they
> couldn't coexist?
No there's not. We wouldn't even have to fall back to whitespace. The
distinction is the same as that between / for division and / for
starting a pattern. Interestingly, neither ' nor " has any meaning in
operator position, either.
That said, I have mixed feelings about the idea. I am thoroughly
convinced that ` can leave it's current job. Removing qx// would be
going a leap too far.
I think %hash`key is about as pretty as a perl 5 regular expression.
Plus, we already have two hash dereferencing syntaxen. It might be nice
just to let ` go, since we constantly find new things that would like to
be represented by operators, while we are out of operators. After all,
we're using two latin-1 operators in the core.
I agree that balancing brackets are annoying where they don't need to
be, but I think you're focusing on the wrong area. Keep in mind that
you're proposing a syntax for single atoms, so C<word> is replaced only
by C<{word}> or C<ÂwordÂ>, not C<{word ...}> or something. Those are
the brackets that are easy to see. The hard ones are the ones that
start in column 8 and end in column 65.
I'm arguing for now that ` be removed as a synonym for qx//, and not
added as anything else until we find a good use for it.
And for your viewing enjoyment:
macro infix:` ($hash, $key)
is parsed(/ $?key := (\$? \w+) /)
is tighter(&infix:.)
{
if $key ~~ /\$/ {
"($hash.text()).{$key}";
}
else {
"($hash.text()).Â$keyÂ";
}
}
Luke