groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerald Wiltse <>
Subject Expando as a Trait?
Date Fri, 18 Mar 2016 15:51:39 GMT
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, especially when one just wants to compose behaviors such as
those offered by expando.

Which leads me to ask the question: is it crazy to suggest that the body of
Expando would actually make a good Trait?   Has this been discussed before?

I'm novice so there could be obvious reasons not to do this which I'm not
aware of.

Gerald R. Wiltse

View raw message