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

Cannot escape operators #8918

Closed
scabug opened this issue Oct 15, 2014 · 5 comments
Closed

Cannot escape operators #8918

scabug opened this issue Oct 15, 2014 · 5 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Oct 15, 2014

I saw someone reporting this on irc

val - = 2
-
1+1 // << illegal start of simple expression

val + = 2
$plus // << ok
1+1

@scabug
Copy link
Author

scabug commented Oct 15, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8918?orig=1
Reporter: Guillaume Massé (masgui)

@scabug
Copy link
Author

scabug commented Oct 16, 2014

@som-snytt said:
You cannot escape!

@scabug
Copy link
Author

scabug commented Oct 16, 2014

Guillaume Massé (masgui) said:
why not ?

Finally, an identifier may also be formed by an arbitrary string between back-quotes (host systems may impose some restrictions on which strings are legal for identifiers). The identifier then is composed of all characters excluding the backquotes themselves.

@scabug
Copy link
Author

scabug commented Oct 16, 2014

@som-snytt said:
I meant it in the sense of, "Mwa-ha-ha!" evil cackling.

But also, an id is an id. Backquotes don't change anything here. Reduced:

scala> val - = 2
-: Int = 2

scala> $minus
res0: Int = 2

scala> -  // newline or semi should disambiguate unary op
     | 1
<console>:2: error: illegal start of simple expression
       1
^

scala> -(      // contrast
     | 1
     | )
res3: Int = -1

@scabug
Copy link
Author

scabug commented Oct 17, 2014

@som-snytt said (edited on Oct 25, 2015 7:42:45 AM UTC):
scala/scala#4059

scala/scala#4301

where they must be followed by a simple expr to be taken as unary ops.

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

No branches or pull requests

2 participants