Opt-in versioning

Michael Haufe TNO at TheNewObjective.com
Mon Jul 21 17:58:19 PDT 2008


So let me see if I understand this argument correctly.

{{...}} means the same thing as a generic "let" statement and {{...}} is 
optional
 Because it's optional, the language should contain both "let" and {{...}}?

I don't see how this doesn't add a level of complexity.Instead of just 
remembering how I declared my variable I would also have to see what 
kind of block I put it in. If my program has 1500+ lines of code, this 
isn't exactly going to be clear, especially if the whitespace is nasty 
and the "{{" isn't on the same line, nor indented properly . "let" 
clearly states that this variable is bound by its block and  I just have 
to find the "{ }". var means its clearly bound by its function and I 
just have to find where the "function" is.

I assume with these rules the following is legal?

if(a){
   
}
else{{

}}

If I want the benefits of this blocking, does that mean I have to give 
up some of my shorthand?

(a === b) ? true : false;

How would the block work in this case?

The JavaScript 1.7 let statement is already the better block we need, 
and instead of being a generic solution like the one you've suggested, 
it has flexibility and doesn't force me to change the way I already code 
things:

var x = 5;
var y = 0;

let (x = x+10, y = 12) {
  print(x+y + "\n");
}

-----------------------
var x = 5;
var y = 0;
document.write( let(x = x + 10, y = 12) x+y  + "<br>\n");
-----------------------
if (x > y){
   let gamma = 12.7 + y;
   i = gamma * x;
}

document.write(x+y + "<br>\n");
print((x + y) + "\n");

-----------------------
for (let expr1; expr2; expr3) statement  where expr2, expr3, and statement are local
-----------------------

How would you're "better block" work as a viable alternative without creating more work or doing what can already be done by let?

Examples from http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7






More information about the Es4-discuss mailing list