Types within Scala are referred to via two mechanisms: One is called 'path-dependent type'(.),and other is 'type projection'(#).
What is the difference between two?
Types within Scala are referred to via two mechanisms: One is called 'path-dependent type'(.),and other is 'type projection'(#).
What is the difference between two?
Let me try to demonstrate it with examples.
scala> class A {
| type B = Int
| }
defined class A
scala> implicitly[Int =:= A#B]
res1: Int =:= Int = <function1>
scala> val a = new A
a: A = A@20864cd1
scala> implicitly[Int =:= a.B]
res2: Int =:= a.B = <function1>
scala> implicitly[Int =:= a#B]
<console>:12: error: not found: type a
implicitly[Int =:= a#B]
^
scala> implicitly[Int =:= A.B]
<console>:12: error: not found: value A
implicitly[Int =:= A.B]
^