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

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -