On Fri, 16 Apr 2004, Juerd wrote:
> Defining ` to be a bareword quoting operator would be only one step away
> from what I suggested initially:
>
> 1. %hash`key
> 2. %array`5
> 3. :key`value
>
> 4. say `hello;
>
> This would make it like <<>> now, but allowing only one bareword, and
> only if it is simple (identifier-ish). Oh, and much easier to read and
> type :)
>
> I like the idea of making a bareword quoting operator!
I never liked unbalanced quotations in lisp, and I don't think I will like
them in perl either.
Written language sets a strong precedent that quotations should be
balanced. (Apostrophes are not balanced, but they elide instead of
quote.) I haven't decided how I feel about a bareword quoting operator,
but I am strongly against quoting things with unbalanced quotation marks.
Besides:
say `hello;
say 'hello';
I count one keystroke difference there, and ' is easier to type than `,
so give it some credit for that. You'll spend many, many more keystrokes
explaining to people what the first one means, and why unexpected things
happen if they type
say `hello`;
Just so you don't read too much into that, I will agree in advance that
%hash`key is more apostrophitic in nature. I disagree with that change
for other reasons, but making ` an unbalanced quoting operator is
one step too far.
> (But only 1 and 2 really matter to me. 1 more than 2.)
>
> > To get an item out of a hash, you can write %varname{"key"}.
> > You can also write %varname<<key>> if there aren't any spaces in
> > the key. Finally, if the key doesn't have any characters in it
> > except for letters, numbers and underscores, you can write
> > %varname`key.
>
> That's not a great way to teach a langage, and for a reference manual, I
> think separation into three paragraphs will make things much clearer.
You didn't answer his question, "which is less complicated?"
> Basically, if ` is made a generic bareword quoter, <<>> is its plural
> form. That makes it easier to explain.
<< Well, except that it isn't really! >>
Three different subscripting syntaxes, each with different quoting rules.
I don't find that prospect attractive.
~ John Williams