[compat] Add an option to enable x-string compilation to JS #2543
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For now, it's enabled by default. But if it's not specified and there are backticks in the code, it will issue a warning.
In Opal 2.0 we will switch the default to disabled.
The rationale is simple: we aim to be as compatible with Ruby as possible. This will give us a big headstart into being able to compile various existing Ruby libraries for NodeJS. Now, if there are backticks, the code must be ported, because backticks with usual Ruby semantics compile to invalid JavaScript. Yet still, for NodeJS we do implement
Kernel#`
, so this code may work out of the box.On the other hand, there is a lot of Opal-dependent code, but compared to above - people who wrote that code know that Opal exists. So, with proper guidance, they should be able to migrate their code by adding a magic comment.