Giter Club home page Giter Club logo

Comments (4)

ljharb avatar ljharb commented on June 8, 2024

I would assume that it indeed outputs with the square brackets and quotes.

In my Safari, it outputs function $+() { as the first line; in Chrome, it outputs function get $+() {; in FF, it matches Safari.

The spec allows a lot of things that are unwise; I would hope that since the browsers don't agree, that it would be feasible (altho surely low priority) for them all to change to the reasonable thing?

from test262.

anba avatar anba commented on June 8, 2024

FWIW: This issue is also filed at https://bugzilla.mozilla.org/show_bug.cgi?id=1658492.

from test262.

ptomato avatar ptomato commented on June 8, 2024

However, how should we handle the result of Function.prototype.toString for built-in functions with invalid names as identifiers (e.g., RegExp["$+"] that is not standardized yet)?

It is not standardized yet, but it is part of https://github.com/tc39/proposal-regexp-legacy-features which is a stage 3 proposal. Therefore it's fair game to have tests in test262 for it.

By my reading, the unambiguously correct output according to the spec is function get $+() { [native code] } so I'd say that's what we should test for, but...

I'd suggest opening an issue in that proposal. In ECMA-262 as far as I know, there are no builtin functions that have a name that is a String but isn't a LiteralPropertyName, so step 4 of SetFunctionName has no need to emit a ComputedPropertyName when name is a String. With the introduction of Legacy RegExp Features, that assumption becomes incorrect (note that it might not be an intended assumption, though.) This seems like it's worth bringing a normative change to committee.

from test262.

ptomato avatar ptomato commented on June 8, 2024

Actually, I see there already is such an issue: tc39/proposal-regexp-legacy-features#19

from test262.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.