non-self referencial cyclical promises?

Bradley Meck bradley.meck at gmail.com
Wed Feb 24 19:37:52 UTC 2016


I was doing some recursive data structure work and ended up with a cyclical
promise that did not use a direct self reference. It can be reduced down to:

```javascript
var af, a = new Promise(f=>af=f);
var bf, b = new Promise(f=>bf=f);

af(b);bf(a); // the problem

a.then(_=>_) // some env/libs need this to start checking status
```

According to https://tc39.github.io/ecma262/#sec-promise-resolve-functions
it looks like this should cause a recursive and infinite set of
`EnqueueJob("PromiseJobs",...)`

This code currently does strange things in stable browsers, but doesn't
seem to always cause infinite loops in the nightly builds of some things. I
was wondering what the expected behavior is here because I am having
trouble making sense of things.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160224/864563b3/attachment.html>


More information about the es-discuss mailing list