"Syntax for Efficient Traits" is now ready for discussion (was: Classes as Sugar is...)
P T Withington
ptw at pobox.com
Wed Sep 15 08:44:32 PDT 2010
On 2010-09-14, at 17:39, Tom Van Cutsem wrote:
> It is true that original traits are always stateless. This is not so much to
> avoid name conflicts as to avoid the whole problem of diamond inheritance
> (duplicate state inherited via different inheritance paths, cf. C++'s
> virtual inheritance).
Off topic, but the "problem of diamond inheritance" is a myth IMO. It come's from C++'s premature optimization[*] of property access in instances to base+offset and shared methods -- it is not an intrinsic problem of OOP. In many OOP languages (most with a Lisp lineage), what C++ calls "virtual inheritance" is the norm, not the exception.
Original traits, again IMO, propagated this myth by declining to include state.
[*] Or less generously, compiler's simplicity.
More information about the es-discuss