Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

Please, extend mJS to be more like v7

I wish Cesanta would stop pretending that mJS is somehow equivalent/superior to v7. Yes, mJS is actively developed*, and has a smaller compiled size; but it is such an extreme subset that is is barely the same language as mainline JS. Hell you don't even support the Math library — so unless you go digging though the code for the undocumented api for adding objects and functions — your only option is ffi. The problem with that for backfilling missing functionality is that the resulting environment is no longer a subset of JS.

Then you add functions like load()and die() with no way of disabling them aside from modifying the code. load() allows for code injection and thus could be a security hole. die() kills the interpreter which shouldn't alway be allowed in a running system. The integrator should have the option for what functions like that get added, and maybe not put them in the global namespace and risk collisions on them. Add an mJS object for non standard functions.

A better approach, to my mind at least, is what duktape does. Have a configuration tool that allows you to specify what features, libraries you want to include that then generates the .c and .h files to include in your project. That way whiners like myself could add in the functionality we need, and maybe even have a reason to pay for the commercial version. My company gave up on mJS because we would have had to extend/modify far too much to justify the resources.

Oh and document how to add objects and methods, this shouldn't be hidden. Ffi isn't alway the answer...

*: Though I have questions about how actively. I reported a somewhat serious parsing error back in June, and Cestana hasn't even commented on it in nearly six months (as I write this)

Sign In or Register to comment.