|
|
|
|
|
by norir
543 days ago
|
|
There is a simpler solution than type inference to removing type annotations while retaining types: remove the distinction between variable and type names. The way that you handle multiple instances of a type is to define an alias for the type. In pseudocode it might look like: type Divisor Number
def divide(Number, Divisor) = Number / Divisor
As compared to: def divide(number: Number, divisor: Number) = number / Divisor
I have implemented a compiler for a language that does this with different (less familiar) syntax. It's a bit more complicated than described above to handle local variables but it works very well for me. |
|
This doesn't remove them, it just moves them.