Apps Script runs on Google Servers, probably the Rhino JavaScript engine running on Google App Engine. Rhino is written in Java and the implementation used by Apps Script seems to be at about ES5.1, which of course is kind of old. It would be handy to know which version of Rhino it’s at, because then this table would show us exactly what JavaScript capability it has. If anybody knows, then ping me and let me know. I’ll dig around and update this post if I can figure it out.
Why not use Node?
So is this platform still the best solution ? Most (probably almost all) Apps Script Services, have underlying APIS that can be called directly, which means they could be wrapped in Node modules. The Apps Script code itself could be evaluated and run in a Node sandbox, using these wrapped service modules.
Infrastructure and quotas
Node runs in the App Engine flexible environment, so App engine could still be the underlying infrastructure, but moved from Java/Rhino to native Node. Better still, the Apps Script environment could instead be a cloud function called from your script, be packaged in a Docker container, be run locally on your own Node instance or indeed on any 3rd party infrastructure and therefore free of (non API imposed) quotas.
Modern and efficient environment
That would also open Apps Script, if exposed to the sandbox, to a multitude of Node modules already available, would enable the latest versions of JavaScript to be easily supported both in the engine (which would be Node) and in the IDE which could be updated to a newer version of CodeMirror.
HtmlService
Webapps/HTMLService could then be supported natively using Node server modules, which would also give more capability for routing, additional methods, more control of headers etc/etc.
Open sourced
Best of all, Apps Script could be open sourced to allow for faster development of features and sharing of useful stuff.
Proof of concept
This is of course a very simplistic initial analysis, but I wonder if this could happen? Perhaps a few of us could work on a proof of concept to see what kind of blockers there might be to making a partial Apps Script runtime environment on Node. What are your thoughts?
ahh .. it did finally happen – see clasp.