我的印象是:
// short syntax
def foo(bar: Bar)(baz: Baz): Quux
食糖
// long syntax
def foo(bar: Bar): (Baz) => Quux
但是,在继承问题上,我似乎不能把两者混在一起。 整个树木必须在短yn或长yn中界定;从来都不是。
例如:
case class Context
case class Work
trait ContextualWorker {
def workWithContext(ctxt: Context)(work: Work): Traversable[Work]
}
class ShortConcreteWorker extends ContextualWorker {
override def workWithContext(ctxt: Context)(work: Work) = Nil
}
class LongConcreteWorker extends ContextualWorker {
// error on next line: method workWithContext overrides nothing <-------------
override def workWithContext(ctxt: Context): (Work) => Traversable[Work] = {
val setupCode = 1
{ work => Nil }
}
}
如果我改变海峡,使用长子,那么短期合同工人就没有汇编成册。
www.un.org/spanish/ecosoc 为什么这些是不可交换/不可继承的? 你们如何绕过它?
现在最灵活的做法似乎是界定长子的树木,或许可以归入短期合同规定的执行类别。 劳动者:
case class Context
case class Work
trait ContextualWorker {
def workWithContext(ctxt: Context): (Work) => Traversable[Work]
}
class ShortConcreteWorker extends ContextualWorker {
override def workWithContext(ctxt: Context) = workWithContextImpl(ctxt)_
private def workWithContextImpl(ctxt: Context)(work: Work) = Nil
}
class LongConcreteWorker extends ContextualWorker {
override def workWithContext(ctxt: Context): (Work) => Traversable[Work] = {
val setupCode = 1
{ work => Nil }
}
}