scala - Reverse inheritance -
    for custom dsl, have set of data producers , consumers.  (it's little more complicated that, suffice set problem.)  users set consumer, may require type of data.  make sure type system enforces correct type of data sent correct consumer.   the possible elaborations of data bounded inasmuch possible write single data producer can @ least fill in sensible default values.  thus, there should lower bound data types consists of supplier of default data.  also, data shares characteristics, there should upper bound.  , data can manipulated in ways preserve suitability given consumer, or widen suitability more consumers.  thus, types should like   alldata <: d <: anydata   what (or most) compact , elegant way encode constraint in scala, assuming not want require alldata  extend every other data type d ?   right have superclass looks like   class anydata {   def foo: int => string = defaultinttostringimpl   def mapfoo(oo: string => string) = alldata((foo _) andthen oo) }   a...