A technical support community for Apple Logic Pro users.

 
onerob
Topic Author
Posts: 6
Joined: Sat Apr 09, 2016 10:47 am

Safe to use 'let' in MIDI scripts?

Wed Apr 21, 2021 10:20 am

I'm wondering if it's OK to use let instead of var in some cases in a script, specifically with relation to backwards compatibility.

Safari didn't support let until 2017 and I'm wondering if that has any bearing on Logic, e.g. if Logic uses the js engine from Webkit and therefore changes over the years. This would mean that let was not available when MIDI scripting first appeared in Logic and so any scripts making use of it wouldn't be backwards compatible with older releases.

Or does Logic have its own internal js engine?
 
User avatar
Dewdman42
Posts: 3304
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Safe to use 'let' in MIDI scripts?

Wed Apr 21, 2021 10:25 am

Scripter is using safari’s JavaScript. “Let” doesn’t work in older versions of OS X but I can’t remember te the cutoff version.

There is very little benefit in using “let” or “const” instead of “var” in scripter scripts which are typically quite small and simple. If in doubt just use “var”. That being said I use “let” and “const” all the time now out of habit
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
onerob
Topic Author
Posts: 6
Joined: Sat Apr 09, 2016 10:47 am

Re: Safe to use 'let' in MIDI scripts?

Wed Apr 21, 2021 10:41 am

Thanks. I'll avoid 'let' in the script I'm currently working on, as I may be posting it online at some point.