- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Illegal cyclic reference with type member appearing recursively
Wed, 2011-11-16, 19:40
hi,
i would like to do this
object Entry {
trait View[ Tx, Repr <: View[ Tx, Repr ]] {
def next( tx: Tx ) : Repr
}
}
object SetEntry {
type View[ Tx ] = Entry.View[ Tx, View[ Tx ]] // the SetEntry.View doesn't add anything to the plain Entry.View
}
but that is disallowed ("error: illegal cyclic reference involving type View"), so i have to declare a full trait:
object SetEntry {
trait View[ Tx ] extends Entry.View[ Tx, View[ Tx ]]
}
why is that? and why is the type cyclic and the trait not?
best, -sciss-