Consider this code:
class Foo[T : Manifest](val id: String = manifest[T].erasure.getName)
I basically want to store an identifier in Foo, which is often just the class name.
Subclass which do not need a special identifier could then easily use the default value.
But this doesn't even compile, the error message is:
error: No Manifest available for T.
Is there another approach which will work?
EDIT:
Why does this work if the manifest isn't available until the primary constructor?
class Foo[T: Manifest](val name: String) {
def this() = this(manifest[T].erasure.getName)
}