This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: invokedynamic: New Java Bytecode for the Dynamics
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
I am thrilled to see this post by Gilad Bracha, on the new invotedynamic bytecode that is "coming to a JSR near you very soon".
I was beginning to think that this may not be coming, even though I know that people asked for it at the dynamically type language meetup at Sun, but look:
Last winter we had a meeting with various people who work on such languages - things like Groovy, Perl, Python/Jython. Our conclusion was that the most practicable thing was to support dynamically typed method invocation at the byte code level.
The new byte code, invokedynamic , is coming to a JSR near you very soon. Im forming an expert group which I will chair (because of my deep fondness for standards, committees, meetings and process). This group will get to argue over various fine details of how this instruction should work.
Basically, it will be a lot like invokevirtual (if you dont know what that is, either open a JVM spec and find out, or stop reading). The big difference is that the verifier wont insist that the type of the target of the method invocation (the receiver, in Smalltalk speak) be known to support the method being invoked, or that the types of the arguments be known to match the signature of that method. Instead, these checks will be done dynamically.
There will probably be a mechanism for trapping failures (a bit like messageNotUnderstood in Smalltalk).
Does this do everything everyone wants? No, but that is not the point. It isnt really feasible to accommodate the exact needs of a wide variety of disparate languages. Instead, one should provide a good general purpose primitive, that all these languages can build on.
Very nice indeed :)
It is also a nice post to see Gilad go off on tangents such as:
Tangent: thats dynamically typed languages - not the increasingly common horrible misnomer dynamic languages (as opposed to static languages, where nothing moves, like hieroglyphics, perhaps?).
and:
Another tangent: I always refer to the .Net VM and not the the CLR. Its a VM, such things have always been called VMs, and the only reason I can think of for giving it a different name is to confuse people. Confusing people might be useful if you wanted to convince them that youve invented something when you actually copied it from somebody else.
What do you think about "agile" languages Gilad? ;)
Now we just need the Java platform to be able to do some of the ugly code gen for us, give us an AST to work with etc... and then we are cooking.