Oi!
A language written by human(s?), for humans. More specifically, for humans who love programming.
Oi is a general purpose system language with a high emphasis on ergonomics.
It was designed such that the code you want to write is usually the code you actually write. Where other languages optimize for things like safety, perf, or simplicity, Oi optimizes for flow.
Its features [try to] encourage uninterrupted thought:
- expression oriented
- implicit returns
- leading literals
- trailing functions
- trailing records
- pipelines
- named returns
- zero values
- destructuring
- error handling
examples
Shape :: enum {
point
circle { radius: f64 }
rect { w: float, h: float }
triangle(f64, f64, f64)
}
area :: fn(s: Shape) f64 {
match s {
.circle(r) => 3.14159 * r * r,
.rect(w, h) => w * h,
else => 0.0,
}
}
Shape.rect(w = 3.0, h = 4.0)
|> area
|> assert($ == 12.0)
shape := Shape.triangle(3.0, 4.0, 5.0)
match shape {
.point => {
print("origin: {()}")
}
.circle(r) => {
print("circle: {(r,)}")
}
.rect(w, h) => {
print("rect: {(w h)}")
}
t @ .triangle(a, b, c) => {
print(t)
}
}