Brendan Eich wrote:
> On Oct 13, 2008, at 3:56 PM, Waldemar Horwat wrote:
> 
>> Brendan Eich wrote:
>>> The agreement from the May TC39 meeting was that the declarations
>>> implicit (:*) and explicit annotations must normalize to the same
>>> type, or there's an error.
>>
>> That was back when the language had lots of requirements for 
>> compile-time expressions, including on all types.  We agreed that 
>> that's not part of ES-Harmony, and this condition doesn't make sense 
>> when type expressions are evaluated at run time.
> 
> True enough -- but even without normalization, multiple equivalent (at 
> runtime, depending on flow) annotations could be allowed. Should they be?

No.  Just because the type matched the last five times you evaluated it doesn't 
mean that it will match the next time.  Also, with multiple lets it's too easy 
to mistake the case of shadowing (when multiple let declarations are in nested 
blocks) with sharing (when they are far apart in the same block).  You might 
refactor:

{
  let x = "outer";
  ... use x ...
  if (always_true) {
    let x = "inner";
    ... use x ...
  }
  ... use x ...
}

into:

{
  let x = "outer";
  ... use x ...
  let x = "inner";
  ... use x ...
  ... use x ...
}


    Waldemar
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to