What version of JS does Espruno implement? (ES5/ES6) #6186
Replies: 1 comment
-
Posted at 2017-08-31 by @gfwilliams Just to clarify this: Espruino isn't 100% of any JavaScript spec (for instance no Regular Expressions at the moment), but it's pretty much ES5, with some ES6 features (arrow functions, template strings, binary literals, forEach/etc on ArrayBuffers) where it makes sense. Functionality gets added all the time though - see http://www.espruino.com/Features for an up to date list Posted at 2017-08-31 by @allObjects @gfwilliams, is there a lint-like thing for Espruino that a JS source can be pitted against and will return 'passed' or 'failed'? Posted at 2017-08-31 by @gfwilliams No, afraid not. I've tweaked the Espruino IDE linter a little, but it's not 100%. Also some devices like ESP8266 cut out features like arrow functions to save some flash memory I believe. Posted at 2019-09-09 by user102526 Do arrow functions save more memory than normal functions? at least on the ESP8266??? @gfwilliams Posted at 2019-09-09 by @gfwilliams
Yes and no - they use less characters so that's less bytes for the actual code. However when they're defined they often use 2 more variables since they have to store If you're using the The actual memory used should be the same on all platforms though. Posted at 2019-09-09 by @fanoush this pretokenise flag is still effective just for code in RAM,right? Recently there appeared some beta flag "Pretokenise code before upload (BETA)" in web IDE - minification section. I tried it but it doesn't look like it did change anything to code size stored in flash. Is it supposed to work with flash memory? Couldn't espruino pretokenize the file while saving it into storage .bootcde file? if I processed the file on the device and replaced just all occurrences of 'function' or 'this' (which may be the longest and most frequent ones) by correct byte token would it work including the rest of file which is not tokenised? Posted at 2019-09-09 by @gfwilliams
The flag itself is, yes. However the I just looked into this and annoyingly it does it only when uploading to RAM, which kind of defies the point. The issue was just to do with the ordering of the various transforms that are applied to the code and I've now fixed it, but right now it's only live on |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-08-30 by MobiTech
Hello, I did not find any reliable information on the website. Which ECMAScript Version is interpreted by Espruino? Is it ECMAScript 6 (also known as ECMAScript 2015) or a newer version?
Beta Was this translation helpful? Give feedback.
All reactions