Repository navigation
Discussion: dependent types #357
Replies: 9 comments
|
I think this would be a superb idea. It would future-proof the CLR even if these features don't immediately make it into C#. |
|
I think porting Idris into CLR would be easier... |
|
What are dependent types? What would they look like in C#? |
|
The book βThe Little Typerβ is on my reading list to learn about dependent types. |
|
Is there any need for dependant types in the CLR? Aren't they a compile time feature? |
|
@YairHalberstadt depends on how far you're willing to go with them. Java's generics are a compile-time feature, CLR generics have runtime support. Dependent types can also be encoded as attributes or as CLR metadata. |
|
In F* for example, dependant types are done purely at compile time. The final program is OCaml, F#, or c, so clearly compile time dependant types are quite powerful. I would suggest it would be worth doing a research project adding dependant types purely at compile time. That should indicate if I think without that, any work on the runtime is unlikely to happen. |
|
Dependant types work best in functional languages, where objects are immutable. However mutable objects make it almost impossible for a type checker to be able to prove anything about the state of an object. Take a look at this paper: It implements a subset of dependant types in a mutable object oriented language. However it does so by keeping track of aliases, and using move semantics. As such the approach seems more suitable to Rust than to C#. Do you know of any approach that could merge dependant types with a language like C#? |
|
C# with dependent types? Hmm.... |
Uh oh!
There was an error while loading. Please reload this page.
If CLR is ever to be updated (#317) to include higher-kinded generics (#339), why not update it to support dependent types as well? It will be easier to do both at the same time.
A lot of work has been done by the F* team (https://fstar-lang.org/), but reification of dependent types into the CTS is not in their scope.
All reactions