Incomplete Object prototype + other gotchas #361
Replies: 4 comments
-
Posted at 2015-04-20 by @gfwilliams Ok, just added a bug for those: espruino/Espruino#522 and espruino/Espruino#523 However, I've got to wonder what you're trying to do on Espruino where you need this? Unfortunately I think at the moment implementation of more JS language features has to take a back seat to fixing problems that users are encountering when they're trying to use it for controlling hardware. As far as RegEx, I'd like to implement it, but it's a matter of finding a compact RegEx library that implements RegExes per the JS standard and also has a suitable license. I did have a quick look but didn't find one. The small ones I did find managed to fit into maybe 5k - which would be ok on the Pico, but more of a struggle on the original board. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-20 by WebReflection
You have, as example, an opened bug about a comment weird behavior where the user coded via ES3 regular "classes" ... that code contains syntax usable since about ever and it would work everywhere. I have a simple little module that brings better looking and more semantic classes in and when you deal with hardware you might want to use these patterns too (like the other user did). Accordingly, having The missing RegExp should at least be mentioned on top of Espruino capabilities (if not already, couldn't find it) ... I often give them for granted, so I might lazily check About that, I wonder what's the process to submit a module to the list of already available one in espruino, in case a working NPM solution would take long time. Thank you |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-20 by WebReflection P.S. you've probably checked it already, but this would be already a great thing to have. It's MIT Style License, it's deployed in micro controllers, and it's a subset for RegExp, a 1.5 subset. It's called ure: http://docs.micropython.org/en/latest/library/ure.html#module-ure Here the module used in micro python: and here the folder with the lib: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-20 by @gfwilliams Definitely a bug in Thanks for the pointer to URE - it looks good. As far as submitting modules, there's a page on it here: http://www.espruino.com/Writing+Modules Including a way of writing them that tends to minimize well and work efficiently with Espruino. You basically just issue a pull request - at the moment the volume of contributions is low enough that it actually works pretty well. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-19 by WebReflection
I wouldn't expect
toLocaleString
to be part of theObject.prototype
since there's no local in Espruino, but I found it weirdpropertyIsEnumerable
andisPrototypeOf
are not implemented.A quick and dirty solution would be the following:
However,
instanceof
is also broken in Espruino. Above code uses theconstructor
but a proper check would be the equivalent of the following:Latter check is false but it should be true. Ideally,
isPrototypeOf
andpropertyIsEnumerable
should be implemented natively.Last question for now, I'v enoticed that
RegExp
and in general regular expression /syntax/ is not implemented. Is that too big to bring in natively or it's something planned already?Thanks
Beta Was this translation helpful? Give feedback.
All reactions