On Sep 23, 11:15 am, Daniel Friesen <[email protected]> wrote: > I've started experimenting it in MonkeyScript as well. > > What I don't get his the proper way to handle the prototype for a class. > (Try and find the class prototype, or grab Object prototype) doesn't > seam right.
The prototype is still created using the zero-args constructor of the class. I haven't changed anything in that regard, the general procedure is still the one described here: http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/ScriptableObject.html#defineClass%28org.mozilla.javascript.Scriptable,%20java.lang.Class%29 (BTW, this feature needs documentation, and the API doc for ScriptableObject.defineClass is one place where it should be documented, the other one is http://www.mozilla.org/rhino/tutorial.html#javaScriptHostObjects) If you want to customize prototype/constructor/scope setup, the best thing is to implement finishInit() as described in the API docs above. For example, in my CommonJS Binary/B host class, I only set up the abstract Binary base class in the automatic defineClass, and then create the ByteArray and ByteString classes in finishInit. http://github.com/hns/helma-ng/blob/master/src/org/helma/wrappers/Binary.java#L121 Hannes > > Hannes Wallnoefer wrote: > > I've started rewriting Helma NG host objects to the new annotation > > based format, and it's looking and feeling quite good: > > >http://github.com/hns/helma-ng/blob/88ef182f47abbc8df7a1aef0ce60e82bc... > >http://github.com/hns/helma-ng/blob/88ef182f47abbc8df7a1aef0ce60e82bc... > > > Hannes > > > On Aug 30, 10:22 am, Hannes Wallnoefer <[email protected]> wrote: > > >> I've submitted a patch for writing Rhino host classes using Java > >> annotations instead of the js*_ naming conventions. The feature is > >> roughly explained in the first comment of the bug report, and there's > >> a test case included in the patch. > > >>https://bugzilla.mozilla.org/show_bug.cgi?id=513369 > > >> I'd be happy to get some feedback regarding implementation details > >> such as naming, general design etc. It's the first time I'm writing > >> annotation classes, so I may have made some beginners mistakes. > > >> Hannes > > -- > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
