Extra script operators

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
fagci
Posts: 80
Joined: 03 Feb 2017 13:06
Location: Novosibirsk, RU
Contact:

Extra script operators

Post by fagci » 19 Feb 2017 06:29

Will be handy to use some syntactic sugar on smartphones, as:

1. ++
2. +=
3. [lat, lon] = split('{location,locationformat,decimal}', ','); //[a,b,c] = line.split() - as in Python language
4. "All variables is an object" concept
5. Define own function
6. Ternary operator r = a ? b : c
7. "?=" or "||=" operator, same as getValue()
8. arr = [1,2,3]

So, less symbols => more time to think about functionality, and clear, compact code.

Using JavaScript possibilities, we can write more clean code, by the way.
And v8 JS engine pretty fast: simple loop with some math operations works faster then C++ code with -O3 optimization.

// I used CoffeeScript on frontend and backend, it's so clear, but spaces instead of using brackets may be so annoying at smartphones. Who knows.


Or, Martin, is there some tricks to use Java functionality in action script?

Best regards.
All systems nominal.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Extra script operators

Post by Martin » 19 Feb 2017 14:23

I agree that some syntactic sugar would be nice. Especially your points 1, 2, 5, 7, 8 are on my list of features under consideration.
You could try to execute some scripts with SL4A in the language of your choice but I'm not sure if this project is still maintained: https://github.com/damonkohler/sl4a

You can use scripts to directly call Java functions of the Android API but it's not very easy to get right and the function calls are hard to read since the scripting feature in Automagic does not allow to write real Java code. Check functions callJava* in action script by pressing the Function-button. Also use the Function-button to insert the functions since it will show a helper dialog to build the function call.

Regards,
Martin

User avatar
fagci
Posts: 80
Joined: 03 Feb 2017 13:06
Location: Novosibirsk, RU
Contact:

Re: Extra script operators

Post by fagci » 19 Feb 2017 14:37

Got it, Martin! Glad to hear!
Will wait for this features =)
All systems nominal.

Locked