Object.is steps are very thing

Allen Wirfs-Brock allen at wirfs-brock.com
Sat Mar 16 17:06:39 PDT 2013

On Mar 16, 2013, at 4:49 PM, Axel Rauschmayer wrote:

> Has using more powerful function/method signatures ever been a consideration for the spec? For example, type annotations could replace imperative coercions.

I am applying ES6 style default value  and rest parameter conventions to the chapter 15 signatures.

Given that ES coercions generally may have observable side-effects, I think the imperative coercions is exactly what we need as it place strictly orders the occurrence of each coercion (needed for interoperability) and allows coercions to be deferred until the point in the algorithm where the result is actually needed.  WebIDL takes the  signature driven approach and it leads to early and unnecessary coercions. 

I also think that automatically coercions are get in the way of the sort of ad hoc overload determination that is used within some JavaScript functions.


> On Mar 17, 2013, at 0:01 , Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> On Mar 16, 2013, at 11:18 AM, Tom Schuster wrote:
>>> 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."
>> Most built-in functions are described in this manner.  In fact, the preamble text for  for Object.is was copied/pasted/edited from a previously existing Object constructor methods.
>> In general, we prefer to exclusively describe the  semantics of built-ins using the algorithmic steps and to avoid redundancy between the preambles and the algorithms.  When I notice it,  generally remove such redundancy that is left over from earlier editions. 
>> Paragraph 4 of the introduction to chapter 15 says that any parameters for which arguments are not provided have the value undefined.  So we don't need to say anything about what happens if fewer or more than 2 arguments are passed.
> -- 
> Dr. Axel Rauschmayer
> axel at rauschma.de
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130316/aedd44b3/attachment.html>

More information about the es-discuss mailing list