A fast little scripting language, with fancy types.
Vole is a statically typed, JIT-compiled language built on Cranelift. It has structural typing, generics, first-class functions, iterators, generators, async tasks, and a module system with a standard library.
Status: Extremely Alpha
Note:
interface Scorable {
func score() -> i64
func label() -> string
}
class Player {
name: string,
wins: i64,
losses: i64,
}
extend Player with Scorable {
func score() -> i64 { return self.wins * 3 - self.losses }
func label() -> string { return "{self.name}: {self.score()} pts" }
}
// Works with any type that implements Scorable
func leaderboard<T: Scorable>(players: [T]) -> [string] {
return players
.filter(p => p.score() > 0)
.map(p => p.label())
.collect()
}
func main() {
let squad = [
Player { name: "Alice", wins: 10, losses: 2 },
Player { name: "Bob", wins: 4, losses: 8 },
Player { name: "Carol", wins: 7, losses: 1 },
]
for line in leaderboard(squad) {
println(line)
}
}
See docs/install.md for download and build instructions.
The language documentation lives in docs/language/:
- Cheatsheet -- single-page syntax reference
- Types -- primitives, arrays, optionals, unions
- Functions -- lambdas, closures, higher-order
- Classes & Records -- methods, statics
- Interfaces -- structural typing, constraints
- Generics -- type parameters
- Error Handling -- typed errors, fallible functions
- Iterators -- lazy sequences, generators
- Modules -- imports, standard library
- Concurrency -- async tasks, channels
- Testing -- test blocks, assertions
Requires Rust (stable) and just.
git clone https://github.com/pprice/vole.git
cd vole
cargo build --release
./target/release/vole run hello.vole