1

Does the Fantom programming language, either directly or via a third-party implementation, support JSR-223? That is, can Fantom be used to script Java objects via the 'javax.script' API?

Paul
  • 2,621
  • 13
  • 30

2 Answers2

1

You can use the Fantom FFI to use javax.script directly if you wanted - so possible, but maybe depends on what you're after?

afrankvt
  • 181
  • 3
  • Looked at FFI. It defines a very clear mapping between Fantom/Java types - which suggests that Fantom would be a good language for JSR-223. – Paul Apr 05 '13 at 07:51
  • However, I'm not trying to script Java from Fantom, I'm trying to embedded Fantom into a Java servlet application which hands off requests to be handled by scripts in one of several languages (because I am experimenting with them). I've got this working for Groovy, JRuby and Jython as they all provide a JSR-223 implementation. Clojure should work too, as there is a third party JSR-223 implementation. I'm wondering if this has been done for Fantom (either in the standard distribution or as an add-on). – Paul Apr 05 '13 at 08:03
  • Not sure I fully grok - but doesn't seem like it would take a whole lot - you got an example or something simple to illustrate? – afrankvt Apr 05 '13 at 15:08
  • Well, here is a simple JSR-223 example using Groovy: http://groovy.codehaus.org/JSR+223+Scripting+with+Groovy. I've done similar things with each of Clojure, JRuby and Jython. Since there isn't a JSR-223 for Fantom, I wanted to write one. But there doesn't seem to be a appropriate Fantom method/class that provides all that is needed. For example: How can I 'bind' variables for a Fantom 'script' to use? Can I actually write a 'script' rather than a class in Fantom? How can I get the return value from the script? – Paul Apr 10 '13 at 13:25
0

Just realised that this question still has no accepted answer. So, to answer it myself...

No - Fantom does not support JSR-223. (As of 15 May 2015.)

There have been no further comments on the Fantom blog (re http://fantom.org/forum/topic/2127 or otherwise). There appears to be nothing on the interweb re 'Fantom', 'javax.script' and 'JSR-223' as far as an implementation for Fantom goes.

Paul
  • 2,621
  • 13
  • 30