- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
manifests
Wed, 2009-12-09, 18:22
I just checked in a patch which has manifests mostly working. I did
manage to check it in 30 seconds before the test suite finished, only to
watch a test fail in the final 30 seconds. In terms of what I did, the
test case says it all (and are all these assertions as they ought to
be?)
http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk/test/files/run/manife...
Is there a good place to put type utility methods in trunk? Seems like
some things will keep coming up, like:
object SubtypeRelationship extends Enumeration {
val NONE, SAME, SUB, SUPER = Value
}
import SubtypeRelationship.{ NONE, SAME, SUB, SUPER }
def typeCompare[T, U](implicit ev1: Manifest[T], ev2: Manifest[U]) = (ev1 <:< ev2, ev2 <:< ev1) match {
case (true, true) => SAME
case (true, false) => SUB
case (false, true) => SUPER
case (false, false) => NONE
}
It looks like what I broke is that manifest[Unit] once serialized and
unserialized doesn't equal itself. I only have a passing knowlege of
serialization but as I understand it that means I need to write a method
which maintains the singleton property on unserialization. I will do
this shortly unless someone else wants to volunteer.