Most of your problem, apparently, is that NormalMCMC and NormalImportance accept arguments, but, as you rightly mean, traits cannot have constructors.
Instead, you can take the parameters that you want to provide through the attribute constructor (if such a thing exists) and make them abstract members of the attribute.
Then the elements are implemented in the construction of the characteristic.
Given:
trait Foo { val x : String
You can use it as one of the following:
new Bar with Foo { val x = "Hello World" } new Bar { val x = "Hello World" } with Foo
Which gives you equivalent functionality using Trait constructors.
Note that if the Bar type already has a non-abstract val x : String , then you can just use
new Bar with Foo
In some scenarios, this can also help make x lazy, which can give you more flexibility if the initialization order should be a problem.
Kevin wright
source share