Re: Expando as a Trait?

2016-03-19 Thread Cédric Champeau
I think what you are suggesting is close to this example in the docs: http://groovy-lang.org/objectorientation.html#_dynamic_methods_in_a_trait Am I right? 2016-03-18 16:51 GMT+01:00 Gerald Wiltse : > Expando is a pretty cool object. And if we extend it, we get it's really > nice "behavior". Unf

Re: Expando as a Trait?

2016-03-19 Thread Gerald Wiltse
Yes indeed. Just as Tim posted here, the basics of this functionality can be manually. http://stackoverflow.com/questions/7078855/groovy-dynamically-add-properties-to-groovy-classes-from-inside-class-methods However, his comment points out the fact that groovy expando is a nicely polished and m

Expando as a Trait?

2016-03-19 Thread Gerald Wiltse
Expando is a pretty cool object. And if we extend it, we get it's really nice "behavior". Unfortunately, as extending = inheritance, thus extending expando precludes us from extending our true parent classes. This is why implementing interfaces and traits is often a better choice than inheriting, e