GithubHelp home page GithubHelp logo

Comments (5)

avp avatar avp commented on April 26, 2024 3

Dropping Babel from the RN build pipeline entirely is not a current goal for Hermes. The code that developers write has various non-standard features such as JSX and custom operators which we are not working on implementing in Hermes, and Babel is used to turn these features used by developers into compliant JS which Hermes can understand.

Additionally, the ECMAScript standard is constantly being updated, and using Babel will allow developers to use these features before Hermes fully supports them in a spec-compliant way.

from hermes.

avp avatar avp commented on April 26, 2024 1

In the default React Native pipeline, the Babel transforms are run prior to the Hermes compiler, which should allow you to use modern JS features without needing to know the details of what Hermes itself is able to consume right now.

Any features listed in the "In Progress" section of the document are not officially supported yet, but we have started to add code to support them. This means that they should not be supplied directly as input to Hermes, because Hermes doesn't support fully spec-compliant behavior for them yet. In practice, however, this simply means that JS code which uses "in progress" features should be transformed by Babel into features which are supported by Hermes.

As to the two specific features you're inquiring about:

  • let/const are currently parsed and emitted as bytecode, but the end behavior is not spec-compliant yet, which is why they are listed as "in progress". Block scoping is not properly handled yet, for example.
  • We've made some progress towards classes and method definitions, but we currently emit an error when attempting to generate bytecode for a JS class. In your actual build pipeline you can lower classes into ES5-style functions via Babel, so this shouldn't be a major limitation in practice.

Providing example code of precisely what is and isn't supported at the moment poses some difficulty, as we're in active development on all of these language features right now and the partial list of things we support changes week over week. We will move features from "in progress" to "supported" when the Hermes implementations are compliant and tested, at which point they may be supplied directly as input to Hermes.

If you notice there are features in the "supported" section which are not behaving as you would expect, please open an issue so that we can investigate any potential bugs.

from hermes.

benkane avatar benkane commented on April 26, 2024

That makes sense, thanks. If I'm understanding correctly, does that mean there is a long term goal to be able to use only Hermes and drop Babel from the build pipeline for the Android side of things?

Totally understood about the example code. After your explanation, that doesn't sound necessary.

from hermes.

benkane avatar benkane commented on April 26, 2024

Let me rephrase :) Maybe not a goal per-se, but long term one could do that?

from hermes.

benkane avatar benkane commented on April 26, 2024

That clears things up, thanks!

from hermes.

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.