This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Illegal cyclic reference with type member appearing recursively

No replies
Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.

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-

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland