Birb is a programming language. It is designed and implemented by Vivian Huang (vivianh) and Ariel Davis (azdavis). Its source code is available on GitHub.
A function must statically declare all of the effects that it may use. If a caller calls a function that uses effects that the caller itself does not have access to, the compiler rejects the code before it runs.
Pre-conditions and post-conditions can be added to a function with requires
and ensures
, respectively. These contracts are checked dynamically at runtime, and execution is halted if they are not satisfied.
Birb permits writing function calls like f(x)
or g(a, b, c)
. But Birb also supports a "method call" syntactic sugar. Thus the following are exactly equivalent:
x.f()
and f(x)
a.g(b, c)
and g(a, b, c)
And so on.
Birb has some built-in types. Nat is the type of natural numbers, and Str is the type of strings.
Birb allows for user-definable structs (product types) and enums (sum types). It also has tuples (anonymous products types).
Birb supports generic types and functions via parametric polymorphism.