Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Perl mode and y=>
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
LanX  
View profile  
 More options Sep 29 2011, 5:33 am
Newsgroups: gnu.emacs.help
From: LanX <lanx.p...@googlemail.com>
Date: Thu, 29 Sep 2011 02:33:52 -0700 (PDT)
Local: Thurs, Sep 29 2011 5:33 am
Subject: Re: Perl mode and y=>

> > 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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.