scala - Conditional trait mixins -


say have class a should mixed in trait b, b should either b1 or b2 based on flag b1:

val b1: boolean  type b = if (b1) b1 else b2 // impossible scala code  class extends b 

is there way "dynamically" mixin trait based on condition?

types static things definitions fixed @ compile time. can create instances of variant anonymous classes using if / else logic, though:

val = if (b) new b1 else new b2 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -