SP-Lang language designยค
Propertiesยค
- Declarative language
- Functional language
- Strongly typed language
- Type inference
- Syntax is based on YAML
๐ Declarativeยค
Most computer languages are imperative. This means that most of the code goes towards explaining to the computer how to execute some task. SP-Lang, on the other hand, is declarative. The maker describes โwhatโ they want their logic to do, not exactly โhowโ or โwhenโ it is to be done. Then the compiler will figure out how to do it. This allows the compiler to heavily optimize by deferring work until needed, pre-fetching and reusing cached data, etc.
๐ Functionalยค
SP-Lang favors pure functions without side effects. This results in logic, which is easier to understand and gives the compiler the most freedom to optimize.
๐ Statelessยค
There is no state to modify, and therefore are no variables, just constants. You pass data through various expressions to build the final result.
More information
๐ Strongly typedยค
The types of all the values are known at compile time. This allows for the early detection of errors and reinforce optimizations.
๐ก Type inferenceยค
Types are derived from their use without being declared. For example, setting a variable to a number results in that variable's type being established as a number. This further reduces a complexity for a maker without any performance sacrifice known from interpreted languages.
For advanced users who require more control over the type system, the SP-Lang provide mechanisms to explicitly specify types or interact with the type system when necessary. This flexibility allows advanced users to fine-tune their code for maximum performance and reliability, while still benefiting from the convenience of type inference.
๐Turing completenessยค
SP-Lang is designed to be Turing complete.