Skip to content

Make opaque a soft keyword? #5468

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

Closed
liufengyun opened this issue Nov 19, 2018 · 4 comments
Closed

Make opaque a soft keyword? #5468

liufengyun opened this issue Nov 19, 2018 · 4 comments
Assignees

Comments

@liufengyun
Copy link
Contributor

Fastparse has a method opaque, which is used in other projects, like Scalapb. After #5300 , the benchmark test for ScalaPB breaks. Can we make opaque a soft keyword like inline?

https://github.com/lihaoyi/fastparse/blob/a36e2cf1b82be967403a23cde3a813e5d4d3f741/fastparse/src/fastparse/package.scala#L337

https://github.com/liufengyun/ScalaPB/blob/a561d5cd107ba4ef8c3a32f57719a2429970b692/scalapb-runtime/shared/src/main/scala/com/trueaccord/scalapb/textformat/Basics.scala#L36

@allanrenucci
Copy link
Contributor

I believe we should first fix "soft keyword", otherwise it is not very helpful. See #5145

@liufengyun
Copy link
Contributor Author

@allanrenucci I think the example in #5145 is a corner case. The current implementation already helps a lot, it covers most (if not all) practical usage.

class Test {
  def foo(x: Int): Int = {
    val inline = 3
    5 + inline         // ok
    inline + 5         // ok
    // inline            // error
  }
}

@allanrenucci
Copy link
Contributor

I disagree. If it does not cover all cases, I think we should disallow it. It will be very confusing for users to have a small subset of keywords that can be used as an identifier but only if it does not start a statement.

I can imagine people using the name opaque in an API without knowing about this corner case.

Also, at the time we discussed #5145, @odersky said it would be fairly easy to fix. Not sure why he closed the issue. Let's bring this up in the meeting

@allanrenucci
Copy link
Contributor

Fixed in #5471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants