On Apr 14, 3:58 pm, darrel karisch <[EMAIL PROTECTED]> wrote:
> IdScriptableObject remains undocumented, but appears to be a useful
> base class for implementing first class javascript objects as an
> alternative to extending ScriptableObject.  why has this object been
> omitted from the documentation?
> the source code reveals...
>
> /**
> Base class for native object implementation that uses IdFunctionObject
> to export its methods to script via <class-name>.prototype object.
>
> Any descendant should implement at least the following methods:
>     findInstanceIdInfo
>     getInstanceIdName
>     execIdCall
>     methodArity
>
> To define non-function properties, the descendant should override
>     getInstanceIdValue
>     setInstanceIdValue
> to get/set property value and provide its default attributes.
>
> To customize initializition of constructor and protype objects,
> descendant
> may override scopeInit or fillConstructorProperties methods.
>
> */
>
> I notice that all the Native*.java source files extend this class and
> contain comments indicating that some of the code is generated.
> e.g.
>
> // #generated# Last update: 2007-05-09 08:16:24 EDT
> ...
> // #/generated#
> // #string_id_map#
> ...
> // #/string_id_map#
>
> if this is the case, what tool generates the code and is it or can it
> be made available?

Have a look at the idswitch package in toolsrc directory:

http://lxr.mozilla.org/mozilla/source/js/rhino/toolsrc/org/mozilla/javascript/tools/idswitch/

Regarding use as base class for host objects: I guess the gain/pain
ratio is rather low except when performance is far more important than
code readability/maintainability. Java introspection and reflection
has become much faster than it was in the 1990, which is when this
code was devised. Just my unqualified opinion, not based on any
numbers or tests.

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

Reply via email to