What is meant by Scala's path-dependent types?
I've heard that Scala has path-dependent types. It's something to do with inner-classes but what does this actually mean and why do I care? ...
I've heard that Scala has path-dependent types. It's something to do with inner-classes but what does this actually mean and why do I care? ...
Warning: I'm cross-posting from #scala The book Programming in Scala states that path-dependent types are different depending on the exact instance of the path in question. If so, I don't understand why all the following predicates return true: class Outer { val in = new Inner class Inner } val o1 = new Outer val o2 = new Outer o...
Does anyone know what's going on here with this compiler error? The error goes away if I don't extend INode. trait AbsTypes { type TKey type TValue } trait INode extends AbsTypes { def get(key : TKey) : TValue def set(key : TKey, v : TValue) : INode } class ANode[TKey,TValue]( val akey : TKey, val aval : TValue ) e...
Couple of questions on scala abstract types. Do I have to use parameterized [] types if I want to use the type in a constructor value? ie. is it possible to have a class with abstract constructor parameter types? If I get rid of [T1,T2] and use INode#TKey and INode#TValue as the constructor parameter types, what am I doing? I get confu...
I'm trying to define a generic residue class ring in Scala. A residue class ring is defined by some base ring (e.g. the integers) and a modulus (e.g. two), which is a value from the base ring. Both rings and their elements are objects, hence the type of the modulus would normally be a dependent type, depending on the base ring. I underst...