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

Accessing type parameter of a type parameter?

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

hi,

more type questions.... is there any way to reduce the number of type parameters in A from two to one?

trait Rate
trait B[ R <: Rate ]
trait A[ R <: Rate, C <: B[ R ]] {
def x : A[ R, B[ R ]]
}

like

trait Rate
trait B[ R <: Rate ] {
type Ra = R
}
trait A[ C <: B[ _ <: Rate ]] {
def x : A[ B[ C.Ra ]] // C.Ra not possible :(
}

only that C.Ra doesn't work, as C is a type and not an object.

that is, is there no way to refer to a type parameter of a type?

thanks, -sciss-

Michael
Joined: 2009-02-23,
User offline. Last seen 20 weeks 1 day ago.
Re: Accessing type parameter of a type parameter?

> trait A[ C <: B[ _ <: Rate ]] {
> def x : A[ B[ C.Ra ]] // C.Ra not possible :(
> }

C#Ra should work.

Michael

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