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

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