我有以下的scala代碼。我不明白爲什麼這些隱含的東西沒有被編譯器弄明白。我也嘗試在Main中放置導入線。但請注意,隱式對象是內部主要創建時,那麼代碼正確運行 import LoggingAddon._
object Main {
def main(args: Array[String]): Unit = {
val dog = new Dog
Util.act(
Section Definitions.
Definition eq_dec X := forall x y : X, {x=y} + {x <> y}.
Existing Class eq_dec.
(* Any function that uses eq_dec. Doesn't matter -- ↓ ↓ ↓ *)
Definition f {X:
假設我有2種方法中,A,B,和4類,C,d,E,T。 def A(c: C)(implicit t: Request[T]): D { ... }
def B(fn: C => D): E {
implicit val t // I have to declare implicit val for A here
fn(c)
...
}
然後,我想用一個調用方