Is it possible?
I tried something like this:
object foo extends Foo {
constructorNamedArg = "qqq";
} {
abstractMethod() => bar.baz();
}
I would not use inheritance for this. Instead I would define Foo
as a concrete class:
class Foo(String constructorNamedArg, Baz abstractMethod()) {}
And now at the call site I would write:
Foo {
constructorNamedArg = "qqq";
abstractMethod() => bar.baz();
}
Or even:
Foo {
constructorNamedArg = "qqq";
function abstractMethod() {
return bar.baz();
}
}
It's a common refactoring in Ceylon to go from abstract class with formal methods to concrete class parameterized by functions.
HTH
According to the specification, it is not possible, there can be only positional argument list.