develooper Front page | perl.perl6.language | Postings from December 2004

Re: Angle quotes and pointy brackets

From:
Larry Wall
Date:
December 1, 2004 09:06
Subject:
Re: Angle quotes and pointy brackets
Message ID:
20041201170642.GB32346@wall.org
On Wed, Dec 01, 2004 at 09:55:32AM +0000, Matthew Walton wrote:
: >I neglected to mention that the smart quoter should also recognize
: >pair notation and handle it.
: 
: I've been trying to get my brain round that, but I can't quite figure 
: out what you mean. Pair notation is, as I understand it, when you get
: 
: 	key => value
: 
: to construct a pair. Assuming that's me remembering correctly, then 
: where does the smart quoter have to deal with pair notation? Are you 
: considering allowing something like:
: 
: 	« key1 => flop key2 => floop »
: 
: Which would be
: 
: 	hash(key1 => flop, key2 => floop);
: 
: or am I completely off my rocker? I hope I am, because that's kind of 
: ugly.

Yes, that's the sort of thing I mean.  I actually want it for enum defs:

    my Scalar enum hex « :zero(0) one two three four five six seven eight nine
                         :ten<a> eleven twelve thirteen fourteen fifteen »;

: As an aside, is it possible for us to define our own autoquoting 
: operators? I assume it will be, but I'm feeling insecure and need 
: reassurance.

You can replace the whole darn grammar if you like, so it's certainly
possible.  I don't think we'll go out of our way to make it easy
though.  Probably requires a lookahead on the identifier rule to
see if the next thing happens to be a => workalike.  Alternately,
you have to do syntax tree munging with an infix macro, since by the
time you see an infix macro its left argument is already parsed.

Larry



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About