Skip to content

What should SS: IsSimpleParameterList return for discard binding? #16

@JLHwung

Description

@JLHwung

Comparing https://tc39.es/ecma262/#sec-static-semantics-issimpleparameterlist with the proposal draft, it seems to me that the IsSimpleParameterList is missing the BindingElement: void arm.

The IsSimpleParameterList SS is only used for disallowing local "use strict" within a function body. c.f. https://github.com/rwaldron/tc39-notes/blob/d0c651b358b361b0855cfe7af9ba0b76cab73949/es7/2015-07/july-29.md#611-the-scope-of-use-strict-with-respect-to-destructuring-in-parameter-lists

I prefer returning false for the BindingElement: void production. While I am aware that doing so could become a refactoring hazard, e.g. function f(_) { "use strict"; } is good but function f(void) { "use strict"; } will throw, I believe local strict directive is only good for transitioning from sloppy mode to strict mode. Once the transition is done, such usage should be phased out eventually. Given that discard binding is a novel syntax, I don't think we should still support local "use strict" directive within f(void) {}.

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