On 12/6/13 1:29 PM, Joshua Bell wrote:
// Throws TypeError on older implementations since Dictionary won't coerce to Number (?)
Sure it will. It'll do ToNumber() and probably end up NaN (which becomes 0 as an unsigned long long) unless your object has a valueOf method that returns something interesting.
I don't think overloading has many proponents at the moment, though.
Sure; in practice this would be done as a union type, not overloading. That still has the same "how do I tell?" issue, of course.
other options are a different method name, or passing |undefined| as the version, neither of which are great. Allowing null/undefined/0/falsy to mean "current version" wouldn't be too terrible, though, and isn't a compat concern since it explicitly throws today.
It sure doesn't. null and 0 are perfectly fine values for an unsigned long long (null becomes 0 after ToNumber()). undefined is treated as not passed.
-Boris