Strict undefined this

David Flanagan david at
Fri Aug 29 22:30:36 PDT 2008

Douglas Crockford wrote:
> Mark S. Miller wrote:
>> Therefore, I'd prefer either #b or #c to #a. Between #b and #c I don't
>> have a strong preference, but I think I prefer #b (it's safer) to #c
>> (it more clearly preserves Tennent Correspondence and is generally
>> easier to reason about). But I'd be happy with either.
>> This question needs to be settled for the ES3.1 spec, and so has a
>> greater urgency than many of our other recent discussions.
> I share your discomfort with #a. I prefer #c because it gives the developer the 
> option to do stuff like
>      if (this === undefined) {
>          throw "Did you forgot to use the new operator when calling F?";
>      }

Coming at this from a non-theoretical perspective, I'd say that choice c 
is the one that makes intuitive sense, and the one that is easy to 
explain (say, if one were writing a book about this language).  If 
safety and theoretical concerns don't dictate a choice, I'd argue that 
common sense suggests c.

	David Flanagan

More information about the Es-discuss mailing list