Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Reevaluate which methods belong on constructor vs prototype #215

Closed
domenic opened this issue Feb 21, 2013 · 7 comments
Closed

Reevaluate which methods belong on constructor vs prototype #215

domenic opened this issue Feb 21, 2013 · 7 comments

Comments

@domenic
Copy link
Collaborator

domenic commented Feb 21, 2013

As per @erights we shouldn't have Q.when(x) as a synonym of Q(x).then anymore.

As per the resolution of slightlyoff/Promises#16 the DOMFuture promise library will have Future.when as a variadic Q.all. It might be worth introducing that.

Bonus: I think the variadic-Q.all meaning is backwards compatible with our current definition of Q.when.

@kriskowal
Copy link
Owner

I’m punting this. No more milestone.

@domenic
Copy link
Collaborator Author

domenic commented Jun 4, 2013

Note that Future.when seems to have gone away, replaced by Future.every, so that reason is no longer there.

@erights
Copy link
Collaborator

erights commented Jun 4, 2013

Domenic & Kris,

Please help me fill in
http://wiki.ecmascript.org/doku.php?id=strawman:promises

On Mon, Jun 3, 2013 at 8:45 PM, Domenic Denicola
[email protected]:

Note that Future.when seems to have gone away, replaced by Future.every,
so that reason is no longer there.


Reply to this email directly or view it on GitHubhttps://github.com//issues/215#issuecomment-18887606
.

Text by me above is hereby placed in the public domain

Cheers,
--MarkM

@domenic
Copy link
Collaborator Author

domenic commented Jun 4, 2013

Ooh, exciting. https://github.com/kriskowal/q/wiki/API-Reference may help.

Is there a good place to discuss that document? A few thoughts come to mind.

@domenic
Copy link
Collaborator Author

domenic commented Jul 9, 2013

I think at the very least we should create Q.then as a synonym for our current Q.when. I'd then personally kill Q.when, but if we wanted to come up with a new meaning for it we could do that too.

@kriskowal
Copy link
Owner

I’m putting this on the 1.0 milestone. Let’s re-evaluate which methods we will retain on the constructor and the prototype. We can shoot for a leaner Q in this backward-incompatible release.

@erights
Copy link
Collaborator

erights commented Oct 20, 2013

Leaner, yes!

kriskowal added a commit that referenced this issue Oct 21, 2013
Implement the `Promise` constructor.  The promise constructor serves
both as a deferred promise constructor that accepts a function, and a
new kind of promise constructor that accepts a backing handler object.
The backing handler object must implement `dispatch(resolve, op,
operands)` and `inspect()`.  The new promise constructor replaces the
`Q.promise` function, which is deprecated.  The new promise constructor
replaces `makePromise`, which has been removed entirely.  As such,
Q-Connection will have to be rearchitected to provide a custom promise
handler for remote objects instead of using `makePromise`. Fixes #346.

Postpone calling `then` on a thenable until a message is dispatched to
the coerced promise.  Fixes #372.

When coercing a thenable, memoize the resulting promise to avoid
re-starting a lazy promise.

Add support for vicious cycle detection.  Fixes #223.

This change request also reviews the Q API, deprecating many interfaces
that remain from legacy designs.  Fixes #215.

Factor most Node.js tools into `q/node` module.  Mirror deprecated
interfaces in Q.

Support for `close` and `closed` has been removed from `Queue`, which
has additional ramifications for Q-Connection.  I intend to use Q-IO
streams in Q-Connection instead of raw queues.

Most of the Q specifications continue to work after these changes, but
with many deprecation warnings.  The specs have been revised to appease
the deprecation warnings.

:warning: However, the specifications for "progress" have all been
disabled pending a closer investigation to decide whether to fix Q or
fix the specs.

The promise protocol no longer supports "set" and "delete" operations.
Function application is a special case of "post", and for support of
"fbind", it is now possible to pass a "thisp" as a final argument.  The
"when" message is now called simply "then".

Support for pre-ECMAScript 5 has been abandoned outright, pending
review.

Removed:

-   Q.set, promise.set
-   Q.delete, promise.delete
-   Q.nearer
-   Q.master

The following methods of `Q` are deprecated in favor of their
equivalents on the `promise` prototype:

-   `progress`, `thenResolve`, `thenReject`, `isPending`, `isFulfilled`,
    `isRejected`, `dispatch`, `get`, `post`, `invoke`, `keys`

Other deprecations:

-   Q.resolve in favor of Q
-   Q.fulfill in favor of Q
-   Q.isPromiseAlike in favor of Q.isThenable
-   Q.when in favor of Q().then
-   Q.fail and promise.fail in favor of promise.catch
-   Q.fin and promise.fin in favor of promise.finally
-   Q.mapply and promise.mapply in favor of promise.post
-   Q.send and promise.send in favor of promise.invoke
-   Q.mcall and promise.mcall in favor of promise.invoke
-   Q.promise in favor of new Q.Promise with a resolver function
-   Q.makePromise in favor of new Q.Promise with a handler object
-   promise.fbind in favor of Q.fbind
-   deferred.makeNodeResolver() in favor of
    require("q/node").makeNodeResolver(deferred.resolve)
-   promise.passByCopy() in favor of Q.passByCopy(promise),
    provisionally

Node.js wrappers that have been moved into their own module have a
deprecated interface in Q proper:

-   `nodeify`, `denodify`, `nfbind`, `nbind`, `npost`, `ninvoke`

But the following experimental aliases are deprecated and do not exist
in `q/node`:

-   `nsend` for `ninvoke`
-   `nmcall` for `ninvoke`
-   `nmapply` for `npost`
kriskowal added a commit that referenced this issue Oct 30, 2013
Implement the `Promise` constructor.  The promise constructor serves
both as a deferred promise constructor that accepts a function, and a
new kind of promise constructor that accepts a backing handler object.
The backing handler object must implement `dispatch(resolve, op,
operands)` and `inspect()`.  The new promise constructor replaces the
`Q.promise` function, which is deprecated.  The new promise constructor
replaces `makePromise`, which has been removed entirely.  As such,
Q-Connection will have to be rearchitected to provide a custom promise
handler for remote objects instead of using `makePromise`. Fixes #346.

Postpone calling `then` on a thenable until a message is dispatched to
the coerced promise.  Fixes #372. Fixes #369.

When coercing a thenable, memoize the resulting promise to avoid
re-starting a lazy promise.

Add support for vicious cycle detection.  Fixes #223.

This change request also reviews the Q API, deprecating many interfaces
that remain from legacy designs.  Fixes #215.

Factor most Node.js tools into `q/node` module.  Mirror deprecated
interfaces in Q.

Support for `close` and `closed` has been removed from `Queue`, which
has additional ramifications for Q-Connection.  I intend to use Q-IO
streams in Q-Connection instead of raw queues.

Most of the Q specifications continue to work after these changes, but
with many deprecation warnings.  The specs have been revised to appease
the deprecation warnings.

:warning: However, the specifications for "progress" have all been
disabled pending a closer investigation to decide whether to fix Q or
fix the specs.

The promise protocol no longer supports "set" and "delete" operations.
Function application is a special case of "post", and for support of
"fbind", it is now possible to pass a "thisp" as a final argument.  The
"when" message is now called simply "then".

Support for pre-ECMAScript 5 has been abandoned outright, pending
review.

Removed:

-   Q.set, promise.set
-   Q.delete, promise.delete
-   Q.nearer
-   Q.master

The following methods of `Q` are deprecated in favor of their
equivalents on the `promise` prototype:

-   `progress`, `thenResolve`, `thenReject`, `isPending`, `isFulfilled`,
    `isRejected`, `dispatch`, `get`, `post`, `invoke`, `keys`

Other deprecations:

-   Q.resolve in favor of Q
-   Q.fulfill in favor of Q
-   Q.isPromiseAlike in favor of Q.isThenable
-   Q.when in favor of Q().then
-   Q.fail and promise.fail in favor of promise.catch
-   Q.fin and promise.fin in favor of promise.finally
-   Q.mapply and promise.mapply in favor of promise.post
-   Q.send and promise.send in favor of promise.invoke
-   Q.mcall and promise.mcall in favor of promise.invoke
-   Q.promise in favor of new Q.Promise with a resolver function
-   Q.makePromise in favor of new Q.Promise with a handler object
-   promise.fbind in favor of Q.fbind
-   deferred.makeNodeResolver() in favor of
    require("q/node").makeNodeResolver(deferred.resolve)
-   promise.passByCopy() in favor of Q.passByCopy(promise),
    provisionally

Node.js wrappers that have been moved into their own module have a
deprecated interface in Q proper:

-   `nodeify`, `denodify`, `nfbind`, `nbind`, `npost`, `ninvoke`

But the following experimental aliases are deprecated and do not exist
in `q/node`:

-   `nsend` for `ninvoke`
-   `nmcall` for `ninvoke`
-   `nmapply` for `npost`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants