Numbat – A programming language with physical dimensions as types

Numbat is a programming language that aims to simplify computations with physical units. It has a static type system where physical dimensions act as types. For example, the expression “3 months” has a type of Time. The language allows for easy conversion between units without changing type annotations. Explicit type annotations can help avoid mistakes in computations, as demonstrated in an example calculating the ratio of gravitational forces on Earth. Numbat uses the dimension keyword to define base dimensions and their combinations. The type system supports multiplication, division, and exponentiation, but addition and subtraction are only allowed for compatible types. The language also includes a const-evaluation mode for evaluating expressions involving exponents at compile time. Numbat allows for the creation of custom dimensions and units to improve readability and correctness.

https://numbat.dev/articles/intro.html

To top