Comments (5)
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.
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-stylefunction
s 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.
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.
Let me rephrase :) Maybe not a goal per-se, but long term one could do that?
from hermes.
That clears things up, thanks!
from hermes.
Related Issues (20)
- hermes-eslint missing `__defineGeneric` in context `getScope` HOT 1
- Date constructor accept wrong ISO 8601 date HOT 2
- libc.so (SIGABRT, SIGSEGV) HOT 4
- Performance regression traversing large arrays compared to other engines HOT 4
- Hermes 0.7.2 : Max heap size was exceeded HOT 4
- hermes eslint: No sourceCode in context HOT 6
- Bug: recursion: "Maximum call stack size exceeded" HOT 2
- Wrong `DCMAKE_TOOLCHAIN_FILE` in docs HOT 3
- Intl.NumberFormat can't always display the number's sign HOT 1
- Intl.NumberFormat with compact notation doesn't display formatting HOT 1
- Examples how to use the experimental C ABI? HOT 3
- babel-plugin-syntax-hermes-parser drops chunk names HOT 1
- static_h: Assertion `Val && "isa<> used on a null pointer"' failed with -typed on tsc.js HOT 2
- fatal: unable to access 'http://github.com/facebook/hermes.git/' HOT 2
- I hope Static Hermes supported Windows, Linux, and MacOS. HOT 2
- Local debug and release build throws a type error HOT 3
- I hope it was possible for Static Hermes to native AOT compile all the existing NPM modules. HOT 1
- Intl.DateTimeFormat does not support 'Europe/Kyiv' timezone HOT 2
- It would be good for Static Hermes if it could use pure JavaScript code(that has no type annotations) with automatic type guessing like "var" code in Dart, or ":=" in Go. HOT 7
- Using Intl with standalone Hermes app HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hermes.