rabix / bunny

[Legacy] Executor for CWL workflows. Executes sbg:draft-2 and CWL 1.0
http://rabix.io
Apache License 2.0
74 stars 28 forks source link

Support for...of array iteration #421

Open kmhernan opened 6 years ago

kmhernan commented 6 years ago

Could we support javascript for/of loops like:

for( i of inputs.children ) {
    // do stuff
}

Currently we get exception:

Caused by: org.rabix.bindings.cwl.expression.CWLExpressionException: missing ; after for-loop initializer (script#5) encountered while resolving expression:
milos-ljubinkovic commented 6 years ago

Got interested in this because we had some similar issues with js. Seems that the default js version in our interpreter is ancient and stuff like this goes away when it's changed to ES6. Pushed directly to develop with this change for v1.0 expressions.

kmhernan commented 6 years ago

Oh great! Thanks.

kmhernan commented 6 years ago

v1.0.4-5 is ES56 but i'm still getting the error, is this expected?

milos-ljubinkovic commented 6 years ago

Seems like rhino doesn't support all ES6 features http://mozilla.github.io/rhino/compat/engines.html

When we switch to nashorn it might work

kmhernan commented 6 years ago

Ah, good to know thanks @milos-ljubinkovic

milos-ljubinkovic commented 6 years ago

I've checked and for (var i in x) is supported in rhino currently and java 9.01's nashorn doesn't support for ... of but might in the future

mr-c commented 6 years ago

FYI: CWL v1.0 expressions are ECMAScript 5.1 only, not ES6.

https://www.commonwl.org/v1.0/CommandLineTool.html#Expressions