4 ms·
With dependent types, each `e.key` has it's own and separate type. So, if you have two `e`s, the type of the first e's key will not match the type of the second
by esarbe 5y ago
With dependent types, each `e.key` has it's own and separate type. So, if you have two `e`s, the type of the first e's key will not match the type of the second e's key.
So, with:
def process(p: Path, key: p.Key): Something = ???
this will not compile:
val p1: Path = ???
val p2: Path = ???
process(p1, p2.key) <- compile-time-error
- rnikander 5y agoInteresting. Thanks! I've been using a lot of Swift lately, and they have a generic type roadmap that talks about "existential types" and being able to "open" an existential. This looks very similar.
- esarbe 5y agoI don't know about in Swift, but in programming languages in general, existential types are usually a concept different from dependent types.[0] [0] https://stackoverflow.com/questions/292274/what-is-an-existential-type https://stackoverflow.com/questions/292274/what-is-an-existe...