-
Notifications
You must be signed in to change notification settings - Fork 1
Philosophy
- Minimize Language Constructs
- Minimize Heap Allocation
- Enforce Data Thread Locality
- Cross Platform
SJ is very frugal with its syntax. With a single modified version of a function, SJ implements classes & functions.
syntax(
isFun() { true }
) { this }
question : syntax()
question.isFun()
Stack allocations are an order of magnitude faster than heap allocation, but it can be really hard to figure out which to use in a given program. SJ analyzes the code to determine how to maximize stack allocations without breaking the logic. SJ uses several tricks to minimize the need to heap allocation, like allocating return values in the calling function.
It is nearly impossible to design an object that can be safely used from multiple threads. Even if you manage to accomplish this, it will come at the cost of locks. In SJ, an object can only live in one thread. If it is sent to another thread then it is copied. The only way to communicate between threads is through messages similar to web workers or the actor pattern.
SJ currently transpiles to C99 standard code. This code can be compiled to native code using MSVC, GCC, or CLANG. It can also be compiled to WebAssembly or asm.js using emscripten. SJ can be run on Windows, Linux, OS X, or in a browser using WebAssembly.