[Neo] Dynamic properties...

Tobias Ivarsson tobias.ivarsson at neotechnology.com
Sat Apr 18 03:24:59 CEST 2009


On Sat, Apr 18, 2009 at 12:43 AM, Mattias Ask <mattias.ask at jayway.se> wrote:

> Thanks for the input! Of course I couldn't let this go so I looked
> some at Groovy to see what is possible there:
>
> <code>
> class Teen {
>    def stateOfMind() { "You don't understand me!" }
> }
>
> def hasse = new Teen()
>
> def emc = new ExpandoMetaClass( Teen.class, false )
> emc.children = { ["Kurt", "Lisa"] }
> emc.initialize()
>
> hasse.metaClass = emc
>
> print hasse.children()
>
> </code>
>
> This does exactly (I hope... I've never looked at Groovy before) what
> I want to do. It adds a method to the "hasse" instance of my Teen-
> class (and only to the "hasse" instance), something that in my mind
> maps very well with how you can handle a Neo Node. Well... I guess
> Groovy is the next thing in my competence plan now :)


If you are willing to leave Java the Language there are a whole range of
languages you can choose from (that have this capability). Groovy is only
one of the options. JRuby and Jython come to mind, for example.

Regardless of which language you choose, I just want to say: Welcome! it's a
beautiful world out here!

Happy hacking,
-- 
Tobias Ivarsson <tobias.ivarsson at neotechnology.com>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857


More information about the User mailing list