W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2013

Re: [Futures] accept/resolve/reject on a resolver don't have clearly defined behavior if no value is passed

From: Jonas Sicking <jonas@sicking.cc>
Date: Thu, 6 Jun 2013 10:01:40 -0700
Message-ID: <CA+c2ei-0YQ=aPj6_bEYDNBu0bNT2KSAEjYRw7d84=eouQuw2SA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: DOM public list <www-dom@w3.org>, Anne van Kesteren <annevk@annevk.nl>, Cameron McCormack <cam@mcc.id.au>
On Jun 6, 2013 8:54 AM, "Boris Zbarsky" <bzbarsky@mit.edu> wrote:
>
> On 6/6/13 7:12 AM, Anne van Kesteren wrote:
>>
>> The behavior we want is equivalent to:
>>
>> function accept(value) { ... }
>> accept()
>>
>> Which will result in value being undefined.
>
>
> Sure, but the question is what arguments.length ends up being.  That's
the only difference between "missing argument" and "argument explicitly
passed as undefined" in JS.
>
> If we plan to always pass explicit undefined to callbacks when we were
accepted with no value, then we should make the callbacks take a
non-optional "any", since they will in fact always get one.

This seems like the simplest solution to me. It also has the advantage that
the Future implementation doesn't need to spend time looking for
'undefined' and treating it differently.

/ Jonas
Received on Thursday, 6 June 2013 17:02:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:21 UTC