Dependent method types, which used to be an experimental feature before, has now been enabled by default in the trunk, and apparently this seems to have created some excitem
trait Graph {
type Node
type Edge
def end1(e: Edge): Node
def end2(e: Edge): Node
def nodes: Set[Node]
def edges: Set[Edge]
}
Somewhere else we can statically guarantee that we aren't mixing up nodes from two different graphs, e.g.:
def shortestPath(g: Graph)(n1: g.Node, n2: g.Node) = ...
Of course, this already worked if defined inside Graph, but say we can't modify Graph and are writing a "pimp my library" extension for it.
About the second question: types enabled by this feature are far weaker than complete dependent types (See Dependently Typed Programming in Agda for a flavor of that.) I don't think I've seen an analogy before.