How to pass an object to a method in Scala
问题 How can I pass the reference of an object to method in Scala? E.g. I want this to compile object Constants { val constantA:Double = ??? } def calc(numbers:Seq[Double], Constants) = ??? // does not compile def calc(numbers:Seq[Double], constants:Constants) = ??? // does not compile Of course I can just reference Constants without passing it through the argument list, but I would prefer to list pass all dependencies of the method explicitly as arguments. 回答1: Constants is an object. You don't