JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
88 stars 4 forks source link

Specify vectors are non-empty at compile time? #453

Open JSAbrahams opened 1 year ago

JSAbrahams commented 1 year ago

Summary of current issue

So I'd been wondering whether there was a way that we can specify that a vector always contains at least one element. Found a cool wrapper which guarantees this at compile time.

Proposed change

If we use this in as many places as possible, then we can guarantee a lot of extra properties at compile time. This prevents us from implementing superfluous logic for syntax errors in the

This should also greatly reduce the amount of unreachable branches in the current implementation.