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

manifests

No replies
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

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.

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