empirical-lang
empirical-lang copied to clipboard
First-class traits
Recursive functions require that the traits (and return type) be explicitly listed:
func factorial(n: Int64) pure, transform, linear -> Int64:
if n == 0:
return 1
end
return n * factorial(n - 1)
end
Traits will need to be identifiers the same way that types currently are.
The HIR will likely need TraitsKind
and ModeKind
to complement TypeKind
. This will eliminate the need for codegen's direct_repr
in most cases since higher-order items are preferable.