Helma Logo
main list history

Version 7 by hannes on 15. October 2008, 00:41

1=== Update: as of 2008/10/15, metamethod support has been removed from Helma. It had too much of a performance impact, and most things can be achieved by other means, often reducing complexity.
2

Version 6 by hannes on 04. September 2008, 14:24

13<strike>Currently Currently you have to manually patch and build Rhino to use Metamethods using the patch attached to this page.</strike> The patch is in the current svn/git snapshots, but of course you can still use the patch to build it by yourself.
14
15<b>Update 1:</b> The patch is in the current svn/git snapshots, but of course you can still use the patch to build it by yourself.
16
17<b>Update 2:</b> Due to a very silly bug, __set__ methods were called without the second argument in the initial version. This is fixed in the new patch as well as git/svn repositories.

Version 5 by hannes on 04. September 2008, 11:37

13Currently <strike>Currently you have to manually patch and build Rhino to use Metamethods using the patch attached to this page.</strike> The patch is in the current svn/git snapshots, but of course you can still use the patch to build it by yourself.

Version 4 by hannes on 03. September 2008, 22:16

1Since I have gotten a more frustrated with *JSAdapter|http://blogs.sun.com/sundararajan/entry/self_javascript_and_jsadapter* lately, I have started working on a new metaprogramming extension to Rhino which I call Metamethods. It is based on *JOMP|http://www.bias2build.com/thesis/javascript_mop_expanded.html*, but looks for methods in the target object itself rather than a separate meta object. It is also thread-safe and adds a method to controll control behavior of the equals operator (==).

Version 3 by hannes on 03. September 2008, 22:12

3In detail, Metamethods looks for the following methods:methods in a JavaScript object:

Version 2 by hannes on 03. September 2008, 22:12

15<% this.attachments %>
16
17This patch is against the current Rhino CVS snapshot. Let me know if it fails to apply to earlier versions of Rhino.

Version 1 by hannes on 03. September 2008, 22:10

1Since I have gotten a more frustrated with *JSAdapter|http://blogs.sun.com/sundararajan/entry/self_javascript_and_jsadapter* lately, I have started working on a new metaprogramming extension to Rhino which I call Metamethods. It is based on *JOMP|http://www.bias2build.com/thesis/javascript_mop_expanded.html*, but looks for methods in the target object itself rather than a separate meta object. It is also thread-safe and adds a method to controll the equals operator (==).
2
3In detail, Metamethods looks for the following methods:
4
5* <b>__has__</b>(property): this method is called when checking for a property
6* <b>__get__</b>(property): this method is called when getting a property
7* <b>__set__</b>(property, value): this method is called when setting a property
8* <b>__delete__</b>(property): this method is called when deleting a property
9* <b>__getIds__</b>(): this method is called when iterating over property ids
10* <b>__hasInstance__</b>(object): this method is called when the instanceof operator is used
11* <b>__equals__</b>(object): this method is called when the == operator is used
12
13Currently you have to manually patch and build Rhino to use Metamethods using the patch attached to this page.