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

Re: Angle quotes and pointy brackets

From:
Matthew Walton
Date:
December 1, 2004 01:55
Subject:
Re: Angle quotes and pointy brackets
Message ID:
41AD9514.9010800@alledora.co.uk
Larry Wall wrote:

> I thought so.
> 
> : I don't think I've ever used a hash slice in my life. Is there something 
> : wrong with me?
> 
> No, a lot of people are naturally monoindexous.

I like that word.

> : >    * The :w splitting happens after interpolation.  So
> : >
> : >	    « foo $bar @baz »
> : >
> : >	can end up with lots of words, while
> : >
> : >	    « foo "$bar" "@baz" »
> : >
> : >	is guaranteed to end up with three "words".
> : 
> : See the comment about 'fabulouser' above and add another 'and 
> : fabulouser' to the end.
> 
> 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. The only other thing I can think of is if you're just talking 
about *implementing* infix:=>, in which case just ignore the above 
because of course the autoquoter needs to recognise its left-hand-side.

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.

> I neglected to mention that we also naturally get both of:
> 
>     circumfix:«< >»
>     circumfix:<« »>
> 
> in addition to
> 
>     circumfix:{'<','>'}
>     circumfix:{'«','»'}
> 
> Have to be careful with
> 
>     circumfix:«{ }»
> 
> though, since {...} interpolates these days.

Yes, that would be fun... almost worth throwing out a compiler warning 
for that, especially if we've still got use warnings. Something like

	Warning: «{ }» creates empty list

or even

	Warning: circumfix:«{ }» creates empty operator

that one could be an error in fact.

or if you're feeling really nasty

	Syntax error

Because I'm sure it should be wrong to create empty circumfix operators. 
Or am I too prescriptive? My inner Haskell programmer is showing through.




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