-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array.prototype.join() with this === arg1 #1043
Comments
So, to clarify, the problem you are reporting is that
v8 outputs
while Hermes, JSC and SpiderMonkey (JSC and SM from jsvu) produce
I actually don't know off the top of my head what the correct behavior is, but this is related to cycle avoidance. |
Minimal repro:
|
Thank you for your reminder, it may be related to cycle avoidance. Please refer to A.p.join on cyclic arrays does not reflect web reality for more information. It's about 'check for cycles' :) |
@AidPaike I am sorry, what is your desired outcome here? Do you believe that this is a bug, a violation of EcmaScript, or is this a practical problem that you are having in existing software? Given the esoteric nature of this case, and that both SM and JSC seem to share the Hermes behavior, and seeing that the linked tc39 issue is still open, I don't think there is a strong case for changing Hermes yet. However I am happy to discuss it further. |
Indeed, until that ecma262 issue is resolved, implementations shouldn't do anything. |
During my initial journey in learning JavaScript syntax, I experimented with using the argument itself as a delimiter. However, I noticed that the engine automatically removed the delimiter from the returned result, which sparked my interest. Initially, I mistakenly assumed it was a bug, but thanks to your guidance, I discovered that this is a topic also being discussed in ecma262. I am delighted to have been able to explore such depths while still in the early stages of learning JS. Thank you very much for your assistance; I no longer have any doubts. |
Version
Version: 0.12.0 ( 265d0d9 )
Execution steps
/root/hermes_workingdir/build/bin/hermes Testcase.js
Test case 1
Output
Test case 2
Output
Expected behavior
Test case 3
Output
Description
When using the
Array.prototype.join.call()
method, it follows the standard behavior and returns properly when passed arguments such as lists or numbers (Test case 1). However, it does not return properly when passed thearguments
variable (Test case 2). To verify if other variables can return properly (Test case 3 is a good example), I suspect it may be related to the "this" context.Hope hermes gets better and better
Looking forward to your reply :)
The text was updated successfully, but these errors were encountered: