notes/pl/scala/features/syntax.txt
Ihar Hancharenka 5dff80e88e first
2023-03-27 16:52:17 +03:00

24 строки
631 B
Plaintext

Syntax:
conctructors:
this (...) - another deffault ...
infix operator
any method with a parameter can be used like an infix operator
r add s
r less s
r max s
like in Haskell, method can be formed of spec-chars
Note: an id can start from alphanums, end with an underscore (_), followed by spec-chars.
Note: the precedence of an operator is determined by its first character
override-specifier exists in Scala
operators:
- all operators ending with a colon (:) are associative to the right
they are seen as method calls on right-hand operand
http://www.slideshare.net/joeygibson/operator-overloading-in-scala-2923973