empirical-lang icon indicating copy to clipboard operation
empirical-lang copied to clipboard

First-class traits

Open chrisaycock opened this issue 4 years ago • 1 comments

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.

chrisaycock avatar Jul 28 '20 02:07 chrisaycock

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.

chrisaycock avatar Aug 16 '20 23:08 chrisaycock