Per-Instance MetaClass: Double-Checking My Understanding

View: New views
1 Messages — Rating Filter:   Alert me  

Per-Instance MetaClass: Double-Checking My Understanding

by Robert Fischer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm just double checking before I fix it, but this page is woefully out of date, isn't it?

http://groovy.codehaus.org/Per-Instance+MetaClass

 From what I understand, all instances now have their own metaClass without any special handling.
This code, for instance, throws a MissingMethodException on the call to b.foo().

def a = new Object()
a.metaClass.foo = { -> println "Bar" }
def b = new Object()
b.foo()

Is there any particular gotchas around Per-Instance MetaClasses I should include on that page?

--
~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Grails Expert Retainer Services
http://smokejumperit.com/grails-retainer/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email