Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge...
by chrisweekly on Thursday August 06, 2020 @11:22AM
(#24071733)
Amen. Babel gets a lot of things right (and arguably has a tougher job than a 3to2 compiler would, given the speed of change and the target breadth / problem surface area).
[ Parent
| on HN ]
Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge...
by masklinn on Thursday August 06, 2020 @11:43AM
(#24071960)
> arguably has a tougher job than a 3to2 compiler would
It doesn't. Not that its job is easy, but its job is to take constructs which are brand new and translate them to an older version of the language.
Of the same language.
It doesn't have to deal with the language or the APIs literally working differently when used the same way.
The Python version of Babel would be 3to3 compiler.
Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge...
by kqr on Thursday August 06, 2020 @12:43PM
(#24072678)
Babel is not limited to JavaScript frontends. You can take any language and write a Babel front-end for it. This is, for example, how Fable compiles F# code to JavaScript. Those two languages are very different from each other -- far more differences than Python 2 and Python 3 -- and it works brilliantly.