Object.is steps are very thing

Rick Waldron waldron.rick at gmail.com
Sun Mar 17 12:11:47 PDT 2013


On Sat, Mar 16, 2013 at 7:56 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

>
> On Mar 16, 2013, at 4:42 PM, Tom Schuster wrote:
>
> > 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.
>
> I see...it certainly isn't intended for those preambles to be interpreted
> in that way.  They really are just boiler plate for inducing the the italic
> parameter names.
>
> If there is an actual overload based upon the number of passed arguments
> we are much more explict.   See for example, 15.4.1.1 and 15.4.1.2.
>
> Nobody had previously brought this particular point of confusion to may
> attention.  It should like I shold change the standard boiler plate
> preamble to something slike:
>
> The *is* function takes parameters /value1/ and /value2/ and performs the
> following steps when called:
>


I disagree that the language is at all confusing. The existing preamble is
consistent and makes sense in the context of describing a public API that
delegates to an abstract operation.

If the reader needs any further information about the semantics of
Object.is, the algorithmic steps for SameValue are thorough.

Rick


> Allen
>
>
>
> >
> > 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
> >>
> >>
> >>
> >>
> >>
> >
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130317/bc7e66b1/attachment.html>


More information about the es-discuss mailing list