Scala will transform the expression -2.0 into
the method invocation " [...]".
Answer
(2.0).unary_-
Tags
#odersky-programming-in-scala-1ed #scala
Question
Scala will transform the expression -2.0 into
the method invocation " [...]".
Answer
?
Tags
#odersky-programming-in-scala-1ed #scala
Question
Scala will transform the expression -2.0 into
the method invocation " [...]".
Answer
(2.0).unary_-
If you want to change selection, open original toplevel document below and click on "Move attachment"
Parent (intermediate) annotation
Open it Scala will transform the expression -2.0 into
the method invocation " (2.0).unary_- ".
Original toplevel document
Basic Types and Operations are -2.0, !found, and ~0xFF. As with the
infix operators, these prefix operators are a shorthand way of invoking methods. In this case,
however, the name of the method has "unary_" prepended to the operator character. For instance, <span>Scala will transform the expression -2.0 into
the method invocation "(2.0).unary_-". You can demonstrate this to yourself by typing the method call both via operator notation and explicitly:
scala> -2.0 // Scala invokes (2.0).unary_-
res2: Doub
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.