Is it possible to call an object method without parentheses, after import it ?
Here is my test code, based on this article by Martin Odersky:
package gardening.fruits
object PrintPlanted {
def main(args: Array[String]) {
// Call method on object
import gardening.fruits
fruits showFruit(apple)
fruits showFruit apple
// Import object
import gardening.fruits._
showFruit(apple)
// showFruit apple
// Error: missing arguments for method showFruit in package fruits;
// follow this method with `_' if you want to treat it
// as a partially applied function
}
}
After importing the package object fruits
, I can call the method showFruit(apple)
, but is there any way to call the method without parentheses like the last of the code ?
I use such of methods in a little DSL and it is a bit annoying to use parentheses. All your suggestions are welcome.