Kenneth McDonald wrote:
Yes, someone on the know please clarify if Java will be able to see
JRuby subclasses of Java classes. This would be a Good Thing (and I'm
guessing it will happen)
It already does happen. If you extend JButton and implement your own
versions of JButton methods, your versions will be called when invoked.
A related question on the efficiency front. Let's say that, purely for
my Ruby code, I define a new subclass of JButton, 'class MyButton <
javax.swing.JButton; . . .; end'. Now, I can use those new features
happily in JRuby, and Java will still happily treat it as a button,
_but_, how much of a performance hit does pure Java code take when
accessing and manipulating that object, since it isn't manipulating a
'normal' Java object. (I'm not looking for exact numbers here, 'big'
indicating that method calls/field accesses take a lot longer, or
'small' indicating that don't take too much longer, would be fine :-) )
This is something I'd like to know in general, and also it can
potentially be quite important in complex dynamic Swing layouts, where
speed is of the essence...
And, if the answer is 'big', an ideas on how much compilation might do
to improve this?
I think it's not "big" enough to be noticed much in a large swing
application. Yes, the subclass's logic will be visible to Java. Yes,
using that subclass will bring along some invocation/execution overhead
due to our dynamic dispatch plumbing. But we don't have a good number to
express how much that overhead is.
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email