On 7/21/04, Brent 'Dax' Royal-Gordon wrote: >Amen. Please don't steal unnecessary metacharacters in qq() >strings--although I still think we should keep it, @ causes a lot of >problems.
That's why my suggestion would be to use a character that already has a special meaning in double-quoted strings: ". Well, we probably need a bit more than that, so maybe "~ and ~" for scalar context or ", and ," for list context, or some such. No new metacharacters and you could put just about anything -- hashes, subs, small island nations -- inside the "~...~"! Actually, I've been pondering this incessant urge to interpolate -- I have to admit, I suffer from it as much as anyone, but when I ask myself why, I can't come up with a good answer. Being able to stick a simple $foo in a string is great, but sometimes I catch myself interpolating when, uh, extrapolating would not only be much more readable, but occasionally it would even mean less typing. At any rate, I'm leaning more and more to the sparse, simple proposals (the ones that I might actually be able to remember). Normally, I'm all for cramming everything into The Core(TM) up to and including Sinks::Kitchen on the grounds that if you don't like it, you don't hafta use it. However, this doesn't apply to the rules for interpolation because even if I decide that I'll never interpolate anything anywhere, I still have to remember what all the rules are so I don't forget to escape the right things. Hm, every time I go to post this, I think of something else. Now I'm recognising that I've been labouring under a false dichotomy: we don't have to have simple rules for interpolation OR complex rules. This is Perl, why can't we have both ways to do it? q// -- no interpolation qq// -- moderate interpolation: $foo, @bar[$none], %bat«man» qqq// -- ultimate interpolation: anything not A-z0-9 has a special meaning =) Except it's probably qi instead of qqq, or maybe qq does lots of interpolation and the new guy does less. And q, qq, qqq, ', ", <<, etc. are probably all just abbreviations for "quote :various :interp :adverbs" anyway. I was also going to say something tongue-in-cheek about Unicode quotation marks, but curly-quotes could actually be quite useful. They're a twistier, more complex version of plain old straight quotes, but most interestingly they come in left-handed and right-handed versions. So you might nest them to indicate alternating literal and interpolated values. Erm... or maybe not. But I'm sure there's some way to put them to good use. - David ³wondering how likely curly-quotes are to come out right² Green