Re: Proposal for adding variable declaration blocks

Tab Atkins Jr. skrev:
> With this simple goal in mind, I prefer the simple $ syntax.  Consider 
> my vote cast in its direction (and fwiw, I prefer it over =, for both 
> aesthetic and vague compatibility-related reasons).

Agreed!

Putting my teacher's hat on. (I teach web dev for a living.)

Use a sigil!!!!!

1. Do not use a syntax that looks like a function var().

2. Do not use variable names as they are. I will spend countless hours 
explaining all possible and impossible clashes.

3. Do not invent the wheel again. The most common sigil is $. (Basic, 
Perl, PHP, XPath, XSL and W Power Shell - OK, technically it is not a 
"sigil" in BASH, but it looks like one). The only thing that is more 
common is having no sigil, which I rule out (2).

4. Use the sigil at all times, both "right hand side" (setting) and 
"left hand side" (getting). I.e. PHP-style and not BASH-style. I teach 
both. I know that the latter is much more confusing.

I know that purists don't like PHP, but do not let your dismay for its 
quirks drive you away from using this syntax. It will be by far the 
easiest to teach. Trust me. I deal with newbies almost every day.


Lars Gunther

Received on Monday, 21 July 2008 19:22:03 UTC