W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2014

Re: Promise<void> or Promise<undefined>?, was Re: RfC: pre-LC version of Screen Orientation; deadline August 18

From: Mark S. Miller <erights@google.com>
Date: Thu, 14 Aug 2014 17:01:00 -0700
Message-ID: <CABHxS9h4cP9ssB8cN=6WRyCdRCf0O2nWEMUO_rB0yCRoWkw4jg@mail.gmail.com>
To: Marcos Caceres <marcos@marcosc.com>
Cc: Jonas Sicking <jonas@sicking.cc>, Dominique Hazael-Massieux <dom@w3.org>, Domenic Denicola <domenic@domenicdenicola.com>, public-script-coord <public-script-coord@w3.org>, Mounir Lamouri <mounir@lamouri.fr>
Good. This resolves the tension with JS as well.

"A promise for an integer" is satisfied by fulfilling the promise with one.

"A promise for a void" is satisfied by fulfilling the promise with
undefined.




On Thu, Aug 14, 2014 at 4:33 PM, Marcos Caceres <marcos@marcosc.com> wrote:

>
>
> On August 14, 2014 at 7:31:05 PM, Jonas Sicking (jonas@sicking.cc) wrote:
> > On Thu, Aug 14, 2014 at 1:36 PM, Marcos Caceres wrote:
> > > interface ScreenOrientation {
> > > Promise lock (OrientationLockType orientation);
> > > }
> >
> > It doesn't make sense to put a *value* between the <>. You should put
> > a *type* there. I.e. it doesn't make sense to do
> >
> > Promise<1> returnOne();
> >
> > The thing you do is
> >
> > Promise returnOne();
> >
> > 'void' is the type for 'nothing', so that's what should be used for
> > functions that only return undefined. Whether they return that
> > synchronously or asynchronously.
>
> Yeah, agree. The confusion was "undefined" being treated as a type (not at
> a value).
>
>
>
>


-- 
    Cheers,
    --MarkM
Received on Friday, 15 August 2014 00:01:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:22 UTC