Oryn
→ An experimental, embeddable programming language with static typing. It explores a small syntax, value-oriented semantics, and explicit handling of optional values and errors.
trait Living(health: Int) {
alive(.) -> Bool {
<- .health > 0;
}
damage(~., amount: Int) {
.health -= amount;
}
}
struct Player: Living {
name: Str,
health: Int,
title: Str?,
}
player :~ Player {
name: "Alice",
health: 100,
title: Option.None,
};
player.damage(20);
match player.title {
Option.Some(title) -> print(title),
Option.None -> print(player.name),
}