This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
Rearchitect Q for closure avoidance and WeakMap #415
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
modular
branch, notmaster
.Implement the
Promise
constructor. The promise constructor servesboth 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)
andinspect()
. The new promise constructor replaces theQ.promise
function, which is deprecated. The new promise constructorreplaces
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 tothe coerced promise. Fixes #372.
When coercing a thenable, memoize the resulting promise to avoid
re-starting a lazy promise.
Factor most Node.js tools into
q/node
module. Mirror deprecatedinterfaces in Q.
Support for
close
andclosed
has been removed fromQueue
, whichhas 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.
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:
The following methods of
Q
are deprecated in favor of theirequivalents on the
promise
prototype:progress
,thenResolve
,thenReject
,isPending
,isFulfilled
,isRejected
,dispatch
,get
,post
,invoke
,keys
Other deprecations:
require("q/node").makeNodeResolver(deferred.resolve)
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
forninvoke
nmcall
forninvoke
nmapply
fornpost