Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compat] Add an option to enable x-string compilation to JS #2543

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

hmdne
Copy link
Member

@hmdne hmdne commented Jun 3, 2023

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.

@hmdne hmdne force-pushed the hmdne/compat-backtick branch 2 times, most recently from 9aaa5a5 to 02bdecb Compare June 3, 2023 13:11
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.
@hmdne
Copy link
Member Author

hmdne commented Jun 3, 2023

The lint failure is due to Rubocop upgrade I suppose.

@hmdne hmdne added this to the v1.8 milestone Jun 8, 2023
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌 awesome!!!

@hmdne hmdne merged commit 6520f45 into master Jun 8, 2023
20 of 21 checks passed
@hmdne hmdne deleted the hmdne/compat-backtick branch June 8, 2023 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants