On Dec 22 2007, 3:23 am, [EMAIL PROTECTED] wrote:
> Hi,
>
> I'm not sure if there will be much interest in this or not...  I've been
> experimenting with adding a metaobject protocol to JavaScript, and I
> modified Rhino to implement it.  I've put up a page that gives an
> overview:
>
>  http://www.bias2build.com/thesis/javascript_mop_expanded.html
>
> The cool thing is that it was relatively simple to put together --
> JavaScript's design seems to let you do a lot with pretty minimal changes.
>  I've been pleased with the result so far.

I find this very intriguing. I've been playing around with JSAdapter
from the Phobos project (that's also bundled with the Rhino in Java
6), and I've just committed support for it to Helma as an experimental
feature.

http://blogs.sun.com/sundararajan/entry/self_javascript_and_jsadapter

All currently implemented meta-object features in Rhino are piecemeal
in one way or other. Getter/setter support only works for explicitly
handled properties, __noSuchMethod__ only supports method invocation,
not property access. It's a good thing we have these, because they
make Rhino compatible with Spidermonkey, but they're just not powerful/
generic enough. JSAdapter is so far the most complete solution, but it
requires another adapter/wrapper and can't be used with plain
javascript objects directly.

With a metaobject protocol like this, it becomes practical to
implement host objects in Javascript instead of Java. IMO, being able
to write a framework in the target (embedded) language rather than the
host language is a great boon. This is one of the main advantages the
Ruby guys have on us. Imagine if Rails was written completely in C
instead of Ruby! Yet, most Rhino embeddings are more or less pure
Java.

I really hope this or something similar can become part of Rhino.

hannes

> Feedback is welcome.  Am I missing any big pieces in what a MOP should
> cover?  Does this seem straightforward to use?  I appreciate any insights.
>
> Thanks, and happy holidays.
>
> --Tom

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to