Design principles
Most of the language follows six ideas. When a part of Novis works in a way you did not expect, one of these is usually the reason.
One way for each job
Section titled “One way for each job”Each job has one syntax. You convert a value with as. You query a database with Core\Db. You
receive an uploaded file as a stream. Code from another team then looks like your own code, and a
security review has one pattern to check.
as is the only way to convert.
Safe by default
Section titled “Safe by default”The safe choice is the one you get when you write nothing. Text from a request is tainted until you check it. A form needs a valid CSRF token unless you turn the check off. A request has a memory limit, and so does every program it starts.
You can turn a check off when you have a reason. You have to write that in your code or in
nvs.toml, so a reviewer can see it.
Checked conversions
Section titled “Checked conversions”A conversion either gives the right value or throws an error. "12abc" as int throws an error.
It does not return 12. When a failed conversion is normal, write as ?int. Then the result is
null, and your code checks for it.
Read more in Syntax: as.
Read the full reasoning.
Errors you can read
Section titled “Errors you can read”An error message says what is wrong, where it is and what you can do about it. The compiler finds
most mistakes before the program runs: a wrong type, a missing method, a misspelled variable. Every
compiler error has a code, such as E0301. nvs agent show with that code prints a longer
explanation.
Read more in Syntax: error types.
No global state
Section titled “No global state”Novis has no global variables and no global keyword. There is no global time zone and no global
locale. A function that needs a time zone or a language gets it as an argument.
With global state, one part of a program can change the result of another part. Nothing in the code shows this. On a server, it can also carry a value from one request into the next. Read the full reasoning.
Extensions run in a sandbox
Section titled “Extensions run in a sandbox”Your program cannot load a C library into the running process. One bad write in native code can damage the memory of every request on the server. One crash in native code stops all of them.
Extensions run as sandboxed WebAssembly. An extension has its own memory, and it can use only what you allow. Read the full reasoning.
