On Oct 9, 10:06 am, sleepnova <[email protected]> wrote: > On 10月9日, 下午3時00分, Hannes Wallnoefer <[email protected]> wrote: > > > On Oct 9, 8:25 am, sleepnova <[email protected]> wrote: > > > > Is there any document about this? > > > Not really. This was introduced with a small patch to make > > JavaAdapters implementing org.mozilla.javascript.Scriptable be treated > > as Scriptables (native JS objects) by Rhino. > > >https://bugzilla.mozilla.org/show_bug.cgi?id=462827 > > > This is a neat hack, but it has its perils, so while it's great for > > prototyping, I recommend implementing host objects in Java (which is > > what I do now in Helma NG). > > So, you suggest to implement host object in Java instead of js. > I am wondering if there is any plan to define an official way to > implement host object in js. > I think it would be great to have such extension so people can > implement functionalities through uniform js abstraction.
I'm not saying you shouldn't use this feature. It's just that there's a price you pay for the simlicity you get. If you implement a host object in JS using JavaAdapter, each object access goes through Rhino's LiveConnect JS->Java method dispatch mechanism, which means far more overhead and less control (because of automatic argument and return value conversion) than native host objects. But if it works for you there's no reason you shouldn't use it. Hannes _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
