Scala a better println
问题 I often find myself doing things like: println(foo) when I'd like to do: println foo The compiler does not allow this. Also, println is a mouthful, I really just want to say: echo foo So, in a base package object I created the echo version of println: def echo(x: Any) = Console.println(x) Easy enough, have echo application wide, great. Now, how do I invoke echo without needing to wrap the Any to print in parens? 回答1: object ∊ {def cho(s: Any) {println(s)}} ∊cho "Hello world" will save your