Add structured coroutines and explicit error handling

This commit is contained in:
pavel 2026-08-27 16:26:40 +02:00
commit fe62e81152
31 changed files with 1701 additions and 325 deletions

18
examples/results.gt Normal file
View file

@ -0,0 +1,18 @@
package main
import strconv
import os
fun parse(value: String): Result<Int, Error> {
return strconv.atoi(value)
}
fun changeDirectory(path: String): Result<Unit, Error> {
return os.chdir(path)
}
fun main() {
println(parse("42").unwrap())
println(parse("invalid").unwrapOr(0))
changeDirectory(".").unwrap()
}