Skip to content

Feature Request: with statement for SES (Secure EcmaScript) support #1056

@leotm

Description

@leotm

Problem

Continuing our convo

We have no plans to support non-strict local eval or with - unfortunately they are incompatible with our code generation strategy and bytecode instructions. It is theoretically possible to implement them on top of JS objects with the existing bytecode, but the effort would be significant and the performance truly appalling...

...FWIW, I think we might be able to add support for with. It feels wrong to completely ignore a language feature that has been with us for many years. It also feels good to pass most of test262. Plus, the implementation is interesting and will not slow everything down. But I can't promise it is high priority.

in order to introduce SES to our RN ecosystem (starting with metamask-mobile)

we can get by without local eval, but with statements are required

Solution

with statements support 🙏

Alternatives considered

Additional Context

https://github.com/facebook/hermes/blob/main/doc/Features.md#excluded-from-support

Excluded From Support

  • Symbol.unscopables (Hermes does not support with)
  • with statements

hermesengine.dev/playground

# with ([1, 2, 3]) {
#   console.log(toString()); // 1,2,3
# }

/tmp/hermes-input.js:1:1: error: invalid statement encountered.
with ([1, 2, 3]) {
^~~~~~~~~~~~~~~~~~
Emitted 1 errors. exiting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions