Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ahjustat on March 06, 2019, 02:02:12 am

Title: Support for JavaScript iterator and "for-of"
Post by: ahjustat on March 06, 2019, 02:02:12 am
Does EA support JavaScript "for-of" https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) syntax for iterating through a collection?
Title: Re: Support for JavaScript iterator and "for-of"
Post by: Geert Bellekens on March 06, 2019, 03:05:32 am
There is a reference in the manual/website somewhere that indicates which javascript interpreter is used.

But it seems even easier to just try it no?

Geert
Title: Re: Support for JavaScript iterator and "for-of"
Post by: ahjustat on March 06, 2019, 07:33:27 am
I tried, but cannot get it to work. Neither 'let' nor 'of' are syntax highlighted as reserved words.

The scripting user guide https://sparxsystems.com.au/resources/user-guides/automation/scripting.pdf (https://sparxsystems.com.au/resources/user-guides/automation/scripting.pdf) states SpiderMonkey 1.8, which is quite old, it looks like.

What do others use? If given the option, I would rather choose a language which isn't Microsoft-specific.
Title: Re: Support for JavaScript iterator and "for-of"
Post by: Sunshine on March 06, 2019, 10:59:10 am
...
What do others use? If given the option, I would rather choose a language which isn't Microsoft-specific.
I'm with you on that thought but found it easier just to use JScript as most of the examples are in JScript or VBScript.

Title: Re: Support for JavaScript iterator and "for-of"
Post by: Geert Bellekens on March 06, 2019, 03:34:19 pm
I'm using VBScript.
One of the reasons is that it allows easy transfer between VBA (Excel/Word) code and VBScript code as both have a nearly identical syntax.

Geert