Brent 'Dax' Royal-Gordon skribis 2004-04-16 13:17 (-0700):
> Clever definition of the colon operator, or creation of a
> bareword-quoting operator, would allow you to use "barewords" anywhere
> you wanted to.

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!

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

Or a table, like in perlcheat :)

Basically, if ` is made a generic bareword quoter, <<>> is its plural
form. That makes it easier to explain.

> I'm going to throw in one more argument at this point.  It's based on a 
> game you all played as children:  Which One Of These Doesn't Belong?
> 
> &stuff(1)
> @stuff[1]
> %stuff{1}
> %stuff«1»
> %stuff`1

Hm...

print if not $foo;
if (not $foo) { print }
print unless $foo;
unless ($foo) { print }

$foo or print;

And there are many more examples in Perl. I personally like having two
ways to write exactly the same thing. If the two ways are very
different and one is because of that much easier than the other, I like
having the alternative even more.


Juerd

Reply via email to