Skip to content
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

Clarify what are valid values for "identifier" in #call #76

Closed
judofyr opened this issue May 29, 2018 · 4 comments
Closed

Clarify what are valid values for "identifier" in #call #76

judofyr opened this issue May 29, 2018 · 4 comments

Comments

@judofyr
Copy link
Contributor

judofyr commented May 29, 2018

Context#call(identifier, *args) is only tested against these identifiers in the test case:

  • "id"
  • "a.b.id"
  • "CoffeeScript.eval"

However, in the wild (example for Autoprefixer Rails) people are sending full JavaScript code as the "identifier". This works on some backend (Node.js), but fails on others (Duktape). What is the intended behaviour here? Should Duktape support full JavaScript in identifier, or should Autoprefixer Rails be fixed to first define it as a function?

@rafaelfranca
Copy link
Member

What is the behavior of other runtimes like mini_racer and therubyracer?

@judofyr
Copy link
Contributor Author

judofyr commented May 30, 2018

  • RubyRacer: Supports any JavaScript as identifier
  • MiniRacer: Also supports any JavaScript as identifier, but it's implemented as eval + JSON.generate(args) (see the TODO in the source) instead being directly serialized into the runtime.

@rafaelfranca
Copy link
Member

In that case I believe Duktabe should also support any JavaScript as identifier.

@judofyr
Copy link
Contributor Author

judofyr commented May 30, 2018

I'll try to create a PR with updated tests and documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants