File tree Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Original file line number Diff line number Diff line change @@ -167,27 +167,11 @@ arithmetic expression like the following:
167
167
consists exclusively of method calls, because it is equivalent to the
168
168
following expression, as we saw in the previous section:
169
169
170
- (1) .+(((2) .*(3) )./(x))
170
+ 1 .+(2 .*(3)./(x))
171
171
172
172
This also means that ` + ` , ` * ` , etc. are valid identifiers
173
173
in Scala.
174
174
175
- The parentheses around the numbers in the second version are necessary
176
- because Scala's lexer uses a longest match rule for tokens.
177
- Therefore, it would break the following expression:
178
-
179
- 1.+(2)
180
-
181
- into the tokens ` 1. ` , ` + ` , and ` 2 ` . The reason that
182
- this tokenization is chosen is because ` 1. ` is a longer valid
183
- match than ` 1 ` . The token ` 1. ` is interpreted as the
184
- literal ` 1.0 ` , making it a ` Double ` rather than an
185
- ` Int ` . Writing the expression as:
186
-
187
- (1).+(2)
188
-
189
- prevents ` 1 ` from being interpreted as a ` Double ` .
190
-
191
175
### Functions are objects
192
176
193
177
Functions are also
You can’t perform that action at this time.
0 commit comments