Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Tags
#odersky-programming-in-scala-1ed #scala
Question
if you define a method unary_* and then try to call it on object in prefix notation *p, how will Scala parse it and why?
Answer
*.p because * is not one of the four names allowed for prefix methods

Tags
#odersky-programming-in-scala-1ed #scala
Question
if you define a method unary_* and then try to call it on object in prefix notation *p, how will Scala parse it and why?
Answer
?

Tags
#odersky-programming-in-scala-1ed #scala
Question
if you define a method unary_* and then try to call it on object in prefix notation *p, how will Scala parse it and why?
Answer
*.p because * is not one of the four names allowed for prefix methods
If you want to change selection, open document below and click on "Move attachment"

Basic Types and Operations
The only identifiers that can be used as prefix operators are +, -, !, and ~. Thus, if you define a method named unary_!, you could invoke that method on a value or variable of the appropriate type using prefix operator notation, such as !p. <span>But if you define a method named unary_*, you wouldn't be able to use prefix operator notation, because * isn't one of the four identifiers that can be used as prefix operators. You could invoke the method normally, as in p.unary_*, but if you attempted to invoke it via *p, Scala will parse it as if you'd written *.p, which is probably not what you had in mind![4] Postfix operators are methods that take no arguments, when they are invoked without a dot or parentheses. In Scala, you can leave off empty parentheses on method calls. The conven

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised 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.