Sdk: Transpiler JS -> Dart

Created on 3 Mar 2018  路  2Comments  路  Source: dart-lang/sdk

Good day.

Many people would like to use the JS translation tool in Dart.
Basically for frameworks the standard 袝S5, 袝S6 is used. This tool will convert the code of the fresh libraries to Dart. Doubtful parts of the code that do not make it possible to uniquely identify a strict type, mark as "ToDo:" or "Warnings:", for manual editing. This will automatically convert 90-95% of the written code.
Fresh library will be published in the repository pub. The version with the original version will also be preserved. For example: vue v2.5.13 = vue2: "2.5.13"

This will definitely help to increase the audience of Dart! Since most developers have problems with the usual libraries in everyday life.

Most helpful comment

General practice shows that in browser you can successfully use JavaScript libraries and Dart together via JS interop, see examples like over_react. Translation is not the right solution because it essentially forks the library making support hard long term.

Also while it is certainly possible to run JavaScript on top of Dart, a high-level translation from arbitrary JavaScript to Dart is a very hard task due to semantic chasm that separates these languages. Producing a readable and maintainable close to idiomatic Dart from an arbitrary JavaScript library is non-trivial.

I however don't want to discourage anybody from trying it out! As #1402 states: it would be a very interesting community project.

All 2 comments

Duplicate of #1405

General practice shows that in browser you can successfully use JavaScript libraries and Dart together via JS interop, see examples like over_react. Translation is not the right solution because it essentially forks the library making support hard long term.

Also while it is certainly possible to run JavaScript on top of Dart, a high-level translation from arbitrary JavaScript to Dart is a very hard task due to semantic chasm that separates these languages. Producing a readable and maintainable close to idiomatic Dart from an arbitrary JavaScript library is non-trivial.

I however don't want to discourage anybody from trying it out! As #1402 states: it would be a very interesting community project.

Was this page helpful?
0 / 5 - 0 ratings