Object.is steps are very thing

Tom Schuster tom at schuster.me
Sat Mar 16 16:42:32 PDT 2013


I would argue that the disclaimer makes this more confusing. I am
aware of the behavior that not passed parameters are undefined. But It
sounded like we would never execute step 1. when the parameter count
doesn't match. And thus leaving the result of the call not defined.

On Sun, Mar 17, 2013 at 12:06 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
>
> On Mar 16, 2013, at 3:40 PM, David Bruant wrote:
>
>> Le 16/03/2013 19:18, Tom Schuster a écrit :
>>> Hey!
>>>
>>> Looking at the the steps for Object.is the first sentence just says:
>>>> "When the is function is called with arguments value1 and value2 the following steps are taken:"
>>> I don't remember other functions being defined like that. It should at
>>> least say something along the lines of
>>> "When called with less than 2 parameters return false."
>> I'd throw a TypeError. Calling Object.is with strictly more or less than 2 parameters is most likely an error, akin to === with which something different than strictly 2 operands resultsis a SyntaxError.
>
>
> ECMAScript has a well established convention of using undefined for any non-supplied argument values.  It's preferable to consistently follow such conventions.
>
> Allen
>
>
>
>
>


More information about the es-discuss mailing list