Skip to content

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

Closed

Description

@judofyr

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?

Activity

  1. rafaelfranca commented on May 30, 2018

    @rafaelfranca
    Member

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

  2. judofyr commented on May 30, 2018

    @judofyr
    ContributorAuthor
    • 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.
  3. rafaelfranca commented on May 30, 2018

    @rafaelfranca
    Member

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

  4. judofyr commented on May 30, 2018

    @judofyr
    ContributorAuthor

    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

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