Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upArray.prototype.toString does not have recursion stopper. #809
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
hashseed
commented
Feb 9, 2017
|
Originally filed here: https://bugs.chromium.org/p/v8/issues/detail?id=5952 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
Dup of #289? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
Thanks! Closing as a duplicate of #289. |
ljharb
closed this
Feb 9, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hashseed commentedFeb 9, 2017
Consider following code:
The reason is that we track in a stack whether the array is cyclic. However, the spec doesn't prescribe this recursion check [0]. In fact, I would expect a stack overflow to occur.
Now consider following code:
Now arguably we do not have a cyclic array, just a recursion that does terminate. I would expect the result to be "a". V8 uses a global stack data structure to track recursion. Presumably this is implemented similarly in JSC and SpiderMonkey.
There is also this esdiscuss thread [1] that discusses this, with the conclusion that this should be spec'ed. Nothing happend since then.
Is this something we want to fix, or do we recoil in fear of breaking the web? If we want to fix, how do we deal with the second example?
[0] https://tc39.github.io/ecma262/#sec-array.prototype.join
[1] https://esdiscuss.org/topic/15-4-4-5-array-prototype-join