Re: [Futures] accept/resolve/reject on a resolver don't have clearly defined behavior if no value is passed
Jonas Sicking <[email protected]>
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <CA+c2ei-0YQ=aPj6_bEYDNBu0bNT2KSAEjYRw7d84=eouQuw2SA@mail.gmail.com> |
On Jun 6, 2013 8:54 AM, "Boris Zbarsky" <[email protected]> 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