Skip to content

Should the factory be run in a new event loop turn? #20

@domenic

Description

@domenic

In #18, I propose letting the factory run in a new event loop turn. This parallels assimilation, which must be done in the next turn for integrity reasons. Nevertheless, it's not necessary for the constructor; we could have assimilation do a next-turn call to the constructor.

Note that this doesn't prevent building deferreds from the promise constructor, but it does make them more awkward:

function defer() {
  var resolve;
  var reject;

  var promise = new Promise(function (resolveArg, rejectArg) {
    resolve = resolveArg;
    reject = rejectArg;
  });

  return {
    promise: promise,
    resolve: function (x) {
      nextTick(function () { resolve(x); });
    },
    reject: function (reason) {
      nextTick(function () { reject(reason); });
    }
  };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions