It is impossible to get rid of the bracket, but you can replace it. For instance:
object it class Compute { def calc(x: it.type):Compute = { ... } (Compute write "hello" read 'name calc it calc it write "hello" + 'name )
To expand the bit, whenever Scala sees something like this:
object method non-reserved-word
This is supposed to mean object.method(non-reserved-word)
. And vice versa, whenever he sees something like this:
object method object method2 object2
It is assumed that these are two independent operators, as in object.method(object); method2.object
object.method(object); method2.object
, expecting method2
be a new object and object2
be a method.
These assumptions are part of Scala's grammar: it is designed specifically for this.
source share