--
You received this message because you are subscribed to the Google Groups "Narwhal and Jack" group.
To post to this group, send email to narw...@googlegroups.com.
To unsubscribe from this group, send email to narwhaljs+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/narwhaljs?hl=en.
2010/8/18 Matthew Taylor <rhyo...@gmail.com>:
Java is a statically typed language, and needs a definition of the
MyNarwhalPackageEnvironment class or interface at compile time. It's
not possible to define a Java class or interface in Rhino (although
it's possible to subclass or implement one). The closest you'll get is
some generic invocation interface, like
engine.invoke(module, function, args...)
Hope that helps,
Hannes
We haven't put anything in place to make Narwhal modules available
from within Java, so this would be an area where you would need to do
significant invention. As Hannes points out, you could make such an
API that uses Rhino's types. However, Narwhal is designed to initiate
itself from the shell. You would need to construct a Narwhal on Java
bootstrapping, which would need to prepare environment variables,
evaluate the narwhal.js script, and pass a suitable engine object to
the returned function.
Kris Kowal