On Tue, 10 Sep 2013, Ovid wrote:
Not having state in traits was a mistake and the trait researchers have experimented with ways of correcting this. The reason stateless traits was a mistake is
Sounds interesting, I haven't gone through all of their references or formal paper yet, but I've already identified plenty of useful stateless Traits so I can tackle state and subsequent observations and lessons later. When I get time I'll see if I can write up a Moose implementation guide to Traits, after I've finished exploring it all myself and have something that I'm happy with.
to track something that is completely irrelevant to the calling code, but is nonetheless necessary for the trait to do its thing. A stateless trait would then need to implement "glue code" (as it was called in the papers) to glue the trait and class together. This glue code would be duplicated in every class consuming the trait. Oops! That's something traits were supposed to avoid.
Conceptually we'd need an equivalent alias|exclude mechanism for all attributes, and flattening/consumption/override rules, right?
If you would like to know more, email the researchers. They've been very helpful for me and their mailing list is at https://www.iam.unibe.ch/mailman/listinfo/traits. See also: * "Stateful Traits": http://scg.unibe.ch/archive/papers/Berg07aStatefulTraits.pdf * "Stateful Traits and their Formalization": http://ulir.ul.ie/bitstream/handle/10344/2107/2008_Bergel,A.pdf?sequence=2
Cheers Ovid! -- Niall Young ni...@iinet.net.au