Extend your app with a new language
Nowadays, more and more web apps need to provide an extension system for their web app. We need the clients to extend our systems, but we can’t trust the clients’ code. We need to prevent the clients from destroying or hacking the host system. It’s not safe, and we need an isolated environment on the web.
We have some solutions. Some apps run the extensions in the web workers. Some run them in the iframe. Even more, the WebAssembly, or using an interpreter in JS to provide an isolated environment.
They have their advantages and disadvantages. Some of them have terrible performances. Some of them are not entirely isolated. And the most annoying thing is it’s hard to use the same solution on some native apps (mobile).
The new language
I am introducing a new language named LichenScript. “Lichen” represents a thin layer. LichenScript is close to TypeScript. They have similar syntaxes and APIs.
LichenScript is statically typed, which is similar to TypeScript. The different thing is types help the code generation. When you compile LichenScript to C, the compiler uses the typing information in the product code to make the program faster. It’s is very difficult for the complex TypeScript to do this because it’s too flexible. Although performance is not the primary goal of LichenScript, we will try to make it as fast as possible.
You can try the language in the playground. Actually, it’s not hard to integrate the compiler into your app. Here we have a good example.
It’s a handy feature to solve complex logic. I hope you like it. To know more about this, you can read the documents.
LichenScript also borrows some concepts from OCaml and Rust. For example, `if` is an expression in LichenScript. Talk is cheap. How about downloading and trying it? 😉
We found that the binary’s size is quite small of LichenScript because the runtime is very small. A simple program that reads and writes JSON data uses only 100kb on macOS.
The goal of LichenScript is to be a practical and stable language. We will try to keep it small and simple. Aggressive syntaxes will not be introduced. It’s trying to be an excellent “glue” language.
LichenScript is a new language. It’s still a lot of work to do. And I have a lot of interesting things about this language to share. If you are interested, please join us. Submit issues or PRs.