3/06/2006
Thoughts on Implementing Dynamic Typed Object in JVM
Java is a static typed language. JVM is a static typed virtual machine. How to implement dynamic typed object in JVM?
I just got an idea: generate a interface for each method. When you call a method, you first cast the object to the interface which supports the method to call. We might end up needing to implement hundred interface for a object.
Yep, that is it. Using interface to get workround for static typing limit. The side-effect might be:
hard to implement Mixin
hard to implement method missing
classloader will go crazy...
But I think, this way will have a better performance and interop experience, because we are actually using java object model instead of making a new object model using map.
Subscribe to Posts [Atom]