- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
using prefix operators as identifiers
Tue, 2011-05-31, 17:12
I haven't seen anything in the spec that justifies this behavior:
scala> val ~ = 5~: Int = 5scala> println(~)<console>:1: error: illegal start of simple expression println(~) ^
It affects all the prefix method names (+, -, ~, !).
Unless I missed something in the spec this is either a problem with the spec or with the parser. Any thoughts before I file a bug report?
Yuvi
scala> val ~ = 5~: Int = 5scala> println(~)<console>:1: error: illegal start of simple expression println(~) ^
It affects all the prefix method names (+, -, ~, !).
Unless I missed something in the spec this is either a problem with the spec or with the parser. Any thoughts before I file a bug report?
Yuvi
Tue, 2011-05-31, 17:48
#2
Re: using prefix operators as identifiers
Hi Michael,
According to section 1.1 of the spec, no they are not reserved. Additionally, if they were reserved the val assignment would not succeed.
scala> val class = 1<console>:1: error: illegal start of simple pattern val class = 1
Yuvi
According to section 1.1 of the spec, no they are not reserved. Additionally, if they were reserved the val assignment would not succeed.
scala> val class = 1<console>:1: error: illegal start of simple pattern val class = 1
Yuvi
Aren't those identifiers reserved?