SOFTWARE
See Also
Embedthis Ejscript™ Overview
Ejscript is an enhanced implementation of the JavaScript language for use in embedded applications such as web servers, embedded and mobile devices. It is especially suited for Server-Side JavaScript web applications.
Ejscript is a dynamic, interpreted, object-oriented scripting language that supports classes, objects, exceptions, statements, expressions and a powerful suite of data types.
Standards Based
Ejscript fully supports and complies with the standardized version of JavaScript known as ECMAScript Edition 3 (ECMA-262-3). Ejscript also implements the ECMAScript E4X for XML (ECMA-357) specification.
The Ejscript development community is also actively participating in the various JavaScript standards efforts including:
- ECMAScript Harmony — The next generation JavaScript language standards effort.
- ServerJS — An effort to create standardized Server-Side JavaScript libraries.
Ejscript Components
Ejscript provides a complete Ejscript programming environment that includes:
- An embeddable and highly configurable JavaScript Virtual Machine engine
- Stand-alone or integrated compiler
- Compact high level byte code
- Extensive documentation and samples
- API documentation generation tool
- Symbolic assembler listing generator
- Composite native class interface
- JavaScript language extensions
- Extensive system class library with classes for Events, Timers, File I/O, Streams, Sockets, HTTP
- Model / View / Controller based Web Framework
Ejscript Design Goals
The goal of Ejscript is to create a standards-based JavaScript implementation that is ideally suited for running outside the browser in embedded applications and devices such as for Server-Side JavaScript web frameworks.
Embedded applications typically require small and efficient memory utilization and modest CPU requirements. However, most JavaScript implementations are designed for use inside a browser on the PC desktop. They have large memory footprints, typically more than 4MB and often larger than 64MB — too large for many embedded applications.
By contrast, Ejscript, requires from 200K of code and has minimal memory requirements to execute (from 400K). To do this, Ejscript sheds browser baggage and prioritizes design trade-offs toward memory efficiency.
Why Enhance JavaScript?
JavaScript is now one of the most popular programming languages in the world. However, JavaScript was written many years ago during the height of the browser wars. It was written in a hurry and under corporate pressure. As a result, the language has some glaring weaknesses that impact the security of programs and the programming experience of users — especially when used outside the browser and as programs become larger.
Some of the more major issues are:
- JavaScript stores all top-level variables from all source files together in one global object.
- JavaScript fails to provide a scalable module scheme to package and isolate program components and ensure names don't conflict.
- JavaScript does not provide real block scope
- JavaScript allows multiple variable declarations of the same name so variable declarations can silently collide.
- Assignments to undeclared variables in JavaScript functions will often create unwanted global variables.
Ejscript Language Enhancements
Credit where credit is due. Ejscript has learned from the ongoing JavaScript research and standardization efforts and from Adobe's ActionScript. For the Ejscript web framework, Ruby on Rails has provided many good patterns.
Ejscript adds the following language enhancements:
- Block and file scope
- Module and namespace directives
- Let variable declarations
- Variable visibility controls
- Optional type annotations
- Bound methods that capture the this object
- Function rest arguments
- Class, extends, super and interface directives
- Extended language library: Http, File I/O, Sockets, Stream I/O, XML, Eventing
- E4X XML support
- Iterators and Generators
- Automatic type conversion for function arguments
- Extended try / catch syntax
- Cast, is operators
- Reflection
- Use pragmas
- Assertions
- Conditional compilation
You can choose to take advantage of the enhancements offered by Ejscript for a more secure, scalable and pleasant programming experience or you can can use it in strict ECMAScript compliant mode and utilize only standard features.
Ejscript History
Early versions of Ejscript have been used in the Embedthis Appweb embedded web server for years and is now embedded in millions of devices. The new VM based version has also been used in a range of mobile devices to empower widget-style applications.
Open Source and Free
Ejscript software products are created using an Open Source development model where a
community of developers contribute enhancements and fixes. Products are licensed under the GNU GPL open
source license and are provided with full source code. Embedthis Software has generously provided
infrastructure, developers and funding to make this possible and is also providing commercial support and
licenses for Ejscript.
See http://www.embedthis.com for details.