[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-dev
Subject:    [groovy-dev] the class$ function
From:       Jochen Theodorou <blackdrag () gmx ! org>
Date:       2006-02-15 23:38:30
Message-ID: 43F3BB76.8020004 () gmx ! org
[Download RAW message or body]

Hi,

I hope someone can answer me my question about a function that is in 
groovy since a long time, but I don't see why it is needed.

For each class we use we create a synthetic field based oin the class 
name... for exmaple for groovy.lang.MetaClass we create a field 
groovy$lang§MetaClass. We use this field to cache the class we created 
through the function class$, which does a lookup of the class taking the 
class name as String. so for example class$("java.lang.MetaClass") will 
return MetaClass and then we will store the result in the field. 
Obviously we do this only if the field is null, if not we skip the call 
to class$

My question about this is: why? Why can't we do simply "LDC 
java.lang.MetaClass" as the java compiler does? What is the reason for 
this function?


bye blackdrag
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic