Documents | Contributing Guidelines
A tasty language for building efficient software.
Note: Still work in progress and experimental. Contributions are welcome.
-- reverses an array in place
reverse(mut arr) => {
len = arr^.len;
for i in [0 .< len // 2] {
mut elem = &arr^[i];
mut opposite = &arr^[len - i - 1];
elem^, opposite^ <- >opposite^, >elem^;
}
}
Butter is a personal and experimental language that seeks balance for these aspects:
Note: Being an experimental language, these are all subject to change
Concise: The language constructs should be simple and have a feel of scripting language.- Unambiguous: There should be little-to-no ambiguity syntax-wise nor semantic-wise.
- High-level: Low-level concepts that are hard to understand should be abstracted.
- Efficient: The added runtime code for compiled programs should be minimal both in size and runtime impact.
- Safe: Detectable errors should be caught on compile-time.
I also to want to experiment with novel features deemed necessary for these goals such refinement types.
Note: These are subject to change
Features to be implemented
- Hindley-Milner type inference and checking
- Structural typing with row polymorphism
- Mix of ownership systems and automatic reference counting — variables with
shareare reference counted unless cloning it is cheaper. All other values are owned. - Reference types with "no shared mutable" rule
- Mutability/Shareability polymorphism of references
- Lifetime inference and analysis
- Refinement types
Features to be implemented later on
- Type annotation and type aliases
- Traits or type classes
- Module and visibility system
newtypefor nominally typed record types- Shareable and interiorly mutable containers — this is an escape hatch for "no shared mutable" rule of reference types
- Code generation heuristics — as an example, the compiler will try to infer if such array can be just a stack array or if it needs to be allocated on heap. Refinement type is used to check if such array exceeds certain capacity
