Open trans opened 7 years ago
cast
is going to be the trait for enabling conversions between types. as (Type)
is the identity function on Type
, so it just constrains the result, and it’s only necessary if the return type is ambiguous. For example, if foo
has type Float32 -> Float32
, then the type of cast
in 1.0 cast foo
is unambiguous, and no type annotation is necessary.
If cast as
becomes a pain point, we could add sugar for it, e.g., to (Type)
.
The reason it’s not postfix is that Kitten parses types differently from terms, so there needs to be an indicator to the compiler that it should switch from term to type. That could be relaxed at some point (e.g. #132).
Just read your "Lately in Kitten" article. Was wondering why you chose the verbose notation:
At the very least why not just
But probably more important, why not RPN form, e.g.