Origins of Jsi
Although not much of the original source code remains (Jsi is about 5 times larger) ancestry can be seen in the parser, eval-engine and test suite.
Jsi is a C-centric, byte-code interpreted focused on embedded development.
This makes it very different from Node-js, a C++-centric compiler that is non-trivial to embed.
Internally Jsi is modelled after Tcl.
A Glue Language
Like Tcl, Jsi is meant to be a glue language.
This means that time/space critical functionality is implemented in C, which scripting glues together:
- Scripting used where appropriate because coding is faster, more compact and more resilient than C.
- Major functionality implements as extensions, designed for gluing together with script.
- Software integrity is achieved by hardening C-extensions.
- In addition, a Lite C-API supports C-only development.
Testing is one example where efficiency is less important (eg. Sqlite Testing) and glue code can be helpful.
Jsi implements most of Ecma-script 262, version 5.1.
Following are the known omissions:
- Semicolons are never auto-inserted.
- Array elements can not be empty.
- typeof Array is "array", instead of "object".
- A return inside of a try/catch does not execute finally.
- Date is unimplemented (alternative is strftime/strptime).
- Error is unimplemented.
- UTF is not supported.
- Support for Array iterator for (var X of Y) (as in Ecma-script 6).
- Function parameters with types and defaults (enhancement).
Following are the primary goals of Jsi:
- Support embedded development using plain C (C99).
- Compiles as C++ using gnu g++ (ie. with no extern C).
- Have as few dependencies as possible..
- Pass sanitize, being free of value/object/memory leaks.
- Provide simple application integration .
- Have a C-only Lite version.
- Provide a Debugger.
- Support Web applications, particularly with database and websockets.
- Support standalone applications via self-mounting .zip.
- Package and extension support.
Note: C-integration is the main priority, not script execution speed. The C++ compile option is mostly for integrity checking.
Following is a partial list of things that are either incomplete or unimplemented:
- Creation of a complete test suite for code-coverage.
- Run applications directly from fossil.
- Improved and more accurate error/warning messages.
- A PostgreSql extension.
- UTF support.
- Non-external implementations of httpd and/or websocket.
- Extension for libmicrohttpd for use in post.
- Desktop applications are held hostage by their user interface, be it QT, GTK, IOS or .NET.
- Increasingly web browsers are becoming the GUI, usually over the Internet.
- Moderately complex applications often end up requiring some form of script support, eg. Lua.
- Time, energy and resources can be saved by using the same language on both ends.
- In fact, the same scripts can even be run in both the browser and the app.
- JSON provides seamless data interchange, thus avoiding data structure compatibility issues.