On dropping @names

David Herman dherman at mozilla.com
Fri Dec 28 10:53:17 PST 2012

On Dec 28, 2012, at 2:11 AM, Andreas Rossberg <rossberg at google.com> wrote:

>> That doesn't prove that it was a *bug*. That's a question about the programmer's intention. In fact, I don't think you can. For example, I mentioned let-binding at the bottom:
>>     {
>>         console.log(x);
>>         let x;
>>     }
>> It the programmer intended that to print undefined, then TDZ would break the program. Before you accuse me of circularity, it's *TDZ* that doesn't have JavaScript historical precedent on its side. *You're* the one claiming that programs that ran without error would always be buggy.
> Hold on. First of all, that example is in neither of the two forms whose equivalence you were asking about. Second, all I was claiming in reply is that one of those two forms is necessarily buggy in all cases where the equivalence does not hold. So the above is no counter example to that.

Oh, okay, then I just misread what your claim about what would always be buggy. Sorry about that.

> Instead, it falls into the "weird use case" category that I acknowledged will always exist, unless you make 'let' _exactly_ like 'var'.

OK, this is progress. So we agree that there will be styles that will break, and your position is that those styles don't need to be supported. I want to be clear that I think that's a totally reasonable position, I'm just concerned about risk.

I have an additional concern about UBI vs RBA but I'll start a separate thread on that.

> Your line of argument is 'let' is not like 'var', thereby people will probably reject it. While I understand your concern, I do not see any evidence that TDZ specifically will tip that of. So far, I've only heard the opposite reaction.

It's that if they do something benign and are confused by the error they get, they'll abandon it and say "I couldn't figure out how to make let work, so I went back to var." Or that people will have to learn "you should use let in all your new code, but now you have to learn these additional rules." It's easy to say in the abstract "yeah I'd prefer a version of let that catches my bugs," but what will happen when the error reporting produces false positives?

> Moreover, if you drive that argument to its logical conclusion then 'let' should just be 'var'. Don't you think that you are drawing a somewhat arbitrary line to define what you consider 'var'-like enough?

Well, I guess I'm still trying to figure out where we should draw that line. I would like to believe we can find a place that catches more bugs, but I'm not convinced we're there yet. Bear with me? More in a new thread in a few minutes...


More information about the es-discuss mailing list