> > For some reason, Perl mode behaves oddly
>
> Perl is... odd. I've used perl for a long time with emacs. You just learn to live with the problems.
Sorry, but I don't like these kind of complaints ...
The OP wants to use a special Perl DWIM feature called "autoquoting",
meaning that in a "('key', value)" pair with "fat-comma" '=>' the
quotes are optional on the LHS : "(key => value)".
But if you put a variable or function on the LHS it will be evaluated
to the key:
$key="k"; %h=($key => 1)
And IMHO the parsing rules are not too complicated: "check for
following =>".
At least cperl-mode gets it right.
Now how do other languages solve this problem?
AFAI can see Python has nothing like autoquoting", everything unquoted
is evaluated:
x={"a":1}
And JS has autoquoting, but the LHS is _never_ evaluated:
x={a:1}
You can't make an omelette without breaking eggs.
If you want python's semantics you need python's restrictions and put
quotes!
> Perl's syntax has too many cases of context sensitive interpretations of characters. It's just hell to make emacs capable to deal with all this. I suspect Perl is the only software capable of parsing perl code :-)
True unfortunately the grammar doesn't have a formal specification,
but there IS a module on CPAN called PPI, doing the parsing extremely
well.
> If it's any consolation, we managed to convince Larry Wall back in the days when perl 5 was being "designed" to not follow Tom Christiansen's idea of what the scope operator should be. Tom wanted the single quote. Most prefered C++'s :: for familiarity and friendlyness to parsers. If you think things are bad now, imagine having the single quote has the scope operator :-)
The simple quote was the Perl4 standard and is for compatibility
reasons still supported in Perl5.
But I think it will be deprecated soon.
IIRC the perldoc cites "problems with emacs" for changing this
behaviour. :)
Cheers
Rolf