<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi,<div class=""><br class=""></div><div class="">I just wanted to ask if there was any change meanwhile?&nbsp;</div><div class=""><br class=""></div><div class="">I understand your arguments but it is a real pain to convert a huge number of JS scripts to cast it to the corresponding Java type. This prevents us to switch to GraalVM.&nbsp;</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Andreas</div><div class=""><br class=""><div class="">--&nbsp;<br class="">Andreas Mueller<br class="">IIT Software GmbH<br class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.swiftmq.com&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=CUkXBxBNT_D5N6HMJ5T9Z6rmvNKYsqupcbk72K0lcoQ&m=aqXLTYtXSZ5-tlsOUsRs48LqPFjLZbC0It182l6jsWw&s=5KMNz1rcA0rOLs-qdW5-JbZiAo3uTWoMqG1MYOPtdHE&e=" class="">http://www.swiftmq.com</a><br class=""><br class=""><span><img apple-inline="yes" id="83B84F5F-3B83-404C-9F89-1835608AEF55" src="cid:D8D52512-246D-49DF-A1D7-CA2813FBD86A@multi.box" class=""></span><br class=""></div><br class=""><blockquote type="cite" class="">On 6. Sep 2018, at 18:29, Andreas Mueller &lt;<a href="mailto:am@iit.de" class="">am@iit.de</a>&gt; wrote:<br class=""><br class="">Hi Christian,<br class=""><br class="">thanks for the explanation.<br class=""><br class="">Look here (last section):<br class=""><br class=""><a href="https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide/javascript.html" class="">https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide/javascript.html</a><br class=""><br class="">Regards&nbsp;<br class="">Andreas&nbsp;<br class=""><br class="">Am 06.09.2018 um 15:47 schrieb Christian Wirth &lt;christian.wirth@oracle.com&gt;:<br class=""><br class=""><blockquote type="cite" class="">Hi Andreas,<br class=""><br class="">thanks for keeping persistent on that matter.<br class=""><br class="">&gt; Actually I don’t need this graaljs “feature” at all. ;-)<br class=""><br class="">In fact you would; you need a new Graal.js/Truffle feature that&nbsp;converts the value for you. From a Java perspective, you are&nbsp;providing a wrong data type according to the&nbsp;method signature. You&nbsp;trust JavaScript to convert correctly, according to some defined&nbsp;(?) semantics of selecting the right method and right conversion.<br class=""><br class="">The reason why we don't have this by default is two fold: first,&nbsp;we try to provide something that works across more languages, not&nbsp;just JS between Java; and secondly, we&nbsp;think such a feature can&nbsp;cause way more trouble than it solves, especially if you go as far&nbsp;as String =&gt; int conversions.<br class=""><br class="">But yes, I acknowledge that this feature could simplify the&nbsp;migration from Nashorn to Graal.js, especially if you don't have&nbsp;an API on either side that does that already and you&nbsp;cannot&nbsp;introduce such API.<br class=""><br class="">&gt; can’t you just act like Nashorn<br class=""><br class="">Are you aware of any documentation (outside source code) that&nbsp;describes Nashorn's semantics on this, that your code depends on?&nbsp;In what order (of target data types) do&nbsp;you expect we try to&nbsp;convert to, if ambiguous - especially when methods with more than&nbsp;one arguments are involved? We have seen behavior that is&nbsp;dependent on the&nbsp;ordering of method definitions in the Java class&nbsp;file; that is something we cannot easily support. We have seen&nbsp;errors arise from JS code trusting its numeric data is int, while&nbsp;it was double (or the other way round) unexpectedly; that's not&nbsp;something we can solve automatically in the engine.&nbsp;<br class=""><br class="">We are still working on providing better compatibility. One of&nbsp;the next improvements will be to explicitly select which&nbsp;method+signature you want to call&nbsp;(<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_graalvm_graaljs_issues_37&d=DwQFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=CUkXBxBNT_D5N6HMJ5T9Z6rmvNKYsqupcbk72K0lcoQ&m=aqXLTYtXSZ5-tlsOUsRs48LqPFjLZbC0It182l6jsWw&s=W6SQqnFbKdyxq89O8X22y_LU6XRmNQrOqd94HFJ3Vok&e=">https://github.com/graalvm/graaljs/issues/37</a>). This won't solve&nbsp;the problem of conversion, but allows to mitigate the issue of&nbsp;seemingly random selection of methods that&nbsp;are called. Feel free&nbsp;to file any issues you come across in our Github Issue tracker; we&nbsp;can prioritize issues of high interest.<br class=""><br class="">Note that the Nashorn Compatibility Mode is not something we&nbsp;would encourage you to use on the long run. It helps you to&nbsp;migrate more easily now, but with it enabled, you&nbsp;might miss newer&nbsp;features of Graal.js/GraalVM, or run into compatibility issues in&nbsp;your JS code (JSAdapter has been superseded by ES6's Proxy, that&nbsp;JS Strings are in fact&nbsp;java.lang.Strings is an implementation&nbsp;detail that might not be correct forever, etc.).<br class=""><br class="">Best,<br class="">Christian<br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class="">Am 06.09.2018 um 14:20 schrieb Andreas&nbsp;Mueller:<br class=""><blockquote type="cite" cite="mid:A0CA4089-1A8A-4994-BD7F-4EFF5501FC5F@iit.de" class="">Hi,<br class=""><br class="">I’ve tested the latest graalvm release and I’m still&nbsp;getting an exception due to lossy conversion.<br class=""><br class="">Actually I have a JS var that contains a String but&nbsp;is an int and the Java method call is int. I know that graaljs&nbsp;is restrictive here but can’t you just act like Nashorn when in&nbsp;Nashorn compatibility mode?<br class=""><br class="">I mean I know that I pass a String containing an int&nbsp;so I am responsible for that. Actually I don’t need this graaljs&nbsp;“feature” at all. ;-)<br class=""><br class="">Thanks,<br class="">Andreas<br class=""><br class="">--&nbsp;<br class="">Andreas Mueller<br class="">IIT Software GmbH<br class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.swiftmq.com&d=DwQFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=CUkXBxBNT_D5N6HMJ5T9Z6rmvNKYsqupcbk72K0lcoQ&m=aqXLTYtXSZ5-tlsOUsRs48LqPFjLZbC0It182l6jsWw&s=5KMNz1rcA0rOLs-qdW5-JbZiAo3uTWoMqG1MYOPtdHE&e=">http://www.swiftmq.com</a><br class=""><br class="">&lt;swiftmq_logo_positiv.png&gt;<br class=""><br class=""><br class=""><blockquote type="cite" class="">On 22 Jun 2018, at 20:34,&nbsp;Andreas Mueller &lt;am@iit.de&gt; wrote:<br class=""><br class="">Hi Christian,<br class=""><br class=""><blockquote type="cite" class="">Did you try if it worked if&nbsp;you annotated it? Or is your code (or relevant parts of it)&nbsp;open-source so we can run it ourselves?<br class=""></blockquote><br class="">I didn’t test it yet. It’s not open source either (the scripts&nbsp;are under Apache 2 but the SwiftMQ is not).&nbsp;<br class=""><br class="">The scripts are using a SwiftMQ Stream Interface (the Java&nbsp;part provided by SwiftMQ). The intention is to use any JSR 223&nbsp;available scripting engine so that scripts (SwiftMQ&nbsp;Steeams)&nbsp;can be written in JS, Groovy, Scala, Python etc. We have only&nbsp;tested (and implemented it) in JS. So I can add annotattions&nbsp;but would rather appreciated if you don’t&nbsp;require them at all.<br class=""><br class="">Javadoc of the Stream Interface, FYI (sometimes we just use a&nbsp;Runnable as the callback interface):<br class=""><br class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.swiftmq.com_products_router_swiftlets_sys-5Fstreams_si_javadoc_index.html&d=DwQFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=CUkXBxBNT_D5N6HMJ5T9Z6rmvNKYsqupcbk72K0lcoQ&m=aqXLTYtXSZ5-tlsOUsRs48LqPFjLZbC0It182l6jsWw&s=54Bm_-EE8ZfHOgxlN_OiB61GmCCvN18CFY6hdTA_cYs&e=">http://www.swiftmq.com/products/router/swiftlets/sys_streams/si/javadoc/index.html</a><br class=""><br class=""><br class=""><blockquote type="cite" class="">&gt; What we need is in fact&nbsp;a Nashorn replacement as a scripting engine as part of the&nbsp;JDK<br class="">&gt; or as a plugin into the JDK by adding it to the&nbsp;classpath.<br class=""><br class="">Executing Graal JavaScript on a stock JDK is possible&nbsp;already (without Graal as optimizing compiler), and we are&nbsp;working on a fully-performant solution for JDK 11&nbsp;(with&nbsp;Graal). Graal JavaScript tries to be closely&nbsp;compatible to Nashorn, but it is unrealistic that it ever&nbsp;provides 100% compatibility. Feedback like yours helps us&nbsp;understand&nbsp;what users care about most.<br class=""></blockquote><br class="">We have a lot of scripts we can test again GraalVM, no&nbsp;problem. Just post it when you have a new release and I’ll&nbsp;give it a try.<br class=""><br class=""><blockquote type="cite" class=""><br class="">&gt; Nashorn’s performance is ok for us but an increase&nbsp;would be much<br class="">&gt; appreciated. Are there plans to provide that?<br class=""><br class="">Graal JavaScript is significantly faster than Nashorn on&nbsp;most peak performance benchmarks (often orders of magnitude&nbsp;faster). But please note the difference: Nashorn&nbsp;always compiles the JavaScript code it executes to bytecode.&nbsp;Graal JavaScript requires Graal as optimizing compiler to&nbsp;achive good performance. The setup you are&nbsp;testing right&nbsp;now does not include Graal, so in your case, JavaScript is&nbsp;only interpreted, thus you will experience a performance&nbsp;impact.<br class=""></blockquote><br class="">Interpreted is not an option for us.<br class=""><br class="">Thanks,<br class="">Andreas<br class="">--&nbsp;<br class="">Andreas Mueller<br class="">IIT Software GmbH<br class=""><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.swiftmq.com&d=DwQFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=CUkXBxBNT_D5N6HMJ5T9Z6rmvNKYsqupcbk72K0lcoQ&m=aqXLTYtXSZ5-tlsOUsRs48LqPFjLZbC0It182l6jsWw&s=5KMNz1rcA0rOLs-qdW5-JbZiAo3uTWoMqG1MYOPtdHE&e=">http://www.swiftmq.com</a><br class=""><br class="">&lt;swiftmq_logo_positiv.png&gt;<br class=""><br class=""><br class=""><br class="">IIT Software GmbH<br class="">Falkenhorst 11, 48155 Münster, Germany<br class="">Phone: +49 (0)251 39 72 99 00<br class="">Managing Director: Andreas Müller<br class="">District Court: Amtsgericht Münster, HRB 16294<br class="">VAT-No: DE199945912<br class=""><br class="">This e-mail may contain confidential and/or privileged&nbsp;information. If you are not the intended recipient (or have&nbsp;received this e-mail in error) please notify the&nbsp;sender&nbsp;immediately and destroy this e-mail. Any unauthorized&nbsp;copying, disclosure or distribution of the material in this&nbsp;e-mail is strictly forbidden.<br class="">_______________________________________________<br class="">GraalVM-Users mailing list<br class="">GraalVM-Users@oss.oracle.com<br class="">https://oss.oracle.com/mailman/listinfo/graalvm-users<br class=""></blockquote><br class=""><br class=""><br class=""><br class="">IIT Software GmbH<br class="">Falkenhorst 11, 48155 Münster, Germany<br class="">Phone: +49 (0)251 39 72 99 00<br class="">Managing Director: Andreas Müller<br class="">District Court: Amtsgericht Münster, HRB 16294<br class="">VAT-No: DE199945912<br class=""><br class="">This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender&nbsp;immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.<br class=""></blockquote><br class=""></blockquote><br class=""><br class="">IIT Software GmbH<br class="">Falkenhorst 11, 48155 Münster, Germany<br class="">Phone: +49 (0)251 39 72 99 00<br class="">Managing Director: Andreas Müller<br class="">District Court: Amtsgericht Münster, HRB 16294<br class="">VAT-No: DE199945912<br class=""><br class="">This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender&nbsp;immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.<br class="">_______________________________________________<br class="">GraalVM-Users mailing list<br class="">GraalVM-Users@oss.oracle.com<br class="">https://oss.oracle.com/mailman/listinfo/graalvm-users<br class=""></blockquote><br class=""></div><BR />
<BR />
<HR />
IIT&nbsp;Software&nbsp;GmbH<BR />
Falkenhorst&nbsp;11,&nbsp;48155&nbsp;Münster,&nbsp;Germany<BR />
Phone:&nbsp;+49&nbsp;(0)251&nbsp;39&nbsp;72&nbsp;99&nbsp;00<BR />
Managing&nbsp;Director:&nbsp;Andreas&nbsp;Müller<BR />
District&nbsp;Court:&nbsp;Amtsgericht&nbsp;Münster,&nbsp;HRB&nbsp;16294<BR />
VAT-No:&nbsp;DE199945912<BR />
<BR />
This&nbsp;e-mail&nbsp;may&nbsp;contain&nbsp;confidential&nbsp;and/or&nbsp;privileged&nbsp;information.&nbsp;If&nbsp;you&nbsp;are&nbsp;not&nbsp;the&nbsp;intended&nbsp;recipient&nbsp;(or&nbsp;have&nbsp;received&nbsp;this&nbsp;e-mail&nbsp;in&nbsp;error)&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;immediately&nbsp;and&nbsp;destroy&nbsp;this&nbsp;e-mail.&nbsp;Any&nbsp;unauthorized&nbsp;copying,&nbsp;disclosure&nbsp;or&nbsp;distribution&nbsp;of&nbsp;the&nbsp;material&nbsp;in&nbsp;this&nbsp;e-mail&nbsp;is&nbsp;strictly&nbsp;forbidden.<BR />
</body></html>