Opt-in versioning

Ingvar von Schoultz ingvar-v-s at comhem.se
Tue Jul 22 18:17:11 PDT 2008


Forgive me if I put this aside for a while. It seems to
me that my descriptions are creating confusion and mixup.
Therefore I want to keep things short and simple for a
while. This way I hope that things will become clearer.

I will reply after some time.

Ingvar



Michael Haufe wrote:
> 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
> 
> 
> 
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss
> 

-- 
Ingvar von Schoultz

------- (My quirky use of capitals in code comes from my opinion that
reserved and predefined words should all start with lowercase, and
user-defined should all start with uppercase, because this will easily
and elegantly prevent a host of name-collision problems when things
like programming languages are upgraded with new labels.)



More information about the Es4-discuss mailing list