-
Notifications
You must be signed in to change notification settings - Fork 570
Deprecate primes in identifiers exported from foreign modules #3792
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
Conversation
| (AST.StringLiteral Nothing $ mkString (T.replace "'" "$prime" unescaped))) | ||
| (AST.Var Nothing "$foreign")) | ||
| | otherwise | ||
| = accessorString (mkString unescaped) (AST.Var Nothing "$foreign") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this emitted for every reference to a foreign identifier within a module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$foreign[$foreign.hasForeignProperty("foo'") ? "foo'" : "foo$prime"] would have been emitted for every reference to a foo' identifier imported from a foreign module yes.
|
Personally, I'm inclined to remove the |
|
This looks like a great start, thank you! I think it might be preferable to use the existing |
So I guess we would spend a major release series warning on FFI primes, and where the way of silencing the warning is to rename to something which doesn't contain primes at all, and then make it an error when we do ES modules? I guess that's preferable in that it doesn't involve messing with the generated code or |
|
Also it means that people are less likely to accidentally break their libraries on older compiler versions when dealing with the warning, which is probably also a plus. |
8d7996a to
cf33e3f
Compare
|
I’ve removed the support for escaped primes and updated the deprecation message. |
cf33e3f to
28b5645
Compare
|
|
||
| In the FFI module for [33mMain[0m: | ||
|
|
||
| The identifier [33ma'[0m contains a [33m'[0m. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think people might not realise that a ' is the same thing as a prime, which might make this wording confusing. How about having the error say this:
The identifier a' contains a prime (').
Primes in identifiers ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I applied your suggestion!
28b5645 to
9e7e937
Compare
hdgarrood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! Could you add yourself to CONTRIBUTORS.md too please?
9e7e937 to
d28a891
Compare
|
Sorry for missing that, I just did. |
|
No worries - thanks very much! |
|
I opened a few pull requests removing primes from foreign modules on the libraries I had to patch to be able to run tests while working on #3791. There’s probably a lot more libraries to upgrade in the official package set but that’s a start 😅 |
|
Thanks! I'll go through and get those all merged before we make the new release. |
a4cfcd9 to
dff3f62
Compare
|
I rebased the PR onto master ( |
dff3f62 to
aa8a4e5
Compare
|
Any objections to merging this now? |
|
No objections from me. |
This PR implements @hdgarrood suggestion regarding the depreciation of primes in foreign modules exports.