diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-12 12:55:39 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-14 13:29:48 +0200 |
commit | f4a722d20547a5b4ffe47405d122b34b586c17c3 (patch) | |
tree | 513b54a5738fbe2d93596461f706eb14f696f404 /src/compiler/scala/tools/nsc/typechecker/Tags.scala | |
parent | 524c90d09f2fb4687b312f2c7597393978d50b6a (diff) | |
download | scala-f4a722d20547a5b4ffe47405d122b34b586c17c3.tar.gz scala-f4a722d20547a5b4ffe47405d122b34b586c17c3.tar.bz2 scala-f4a722d20547a5b4ffe47405d122b34b586c17c3.zip |
SI-6310 AbsTypeTag => WeakTypeTag
The new name for AbsTypeTag was a matter of a lengthy discussion:
http://groups.google.com/group/scala-internals/browse_thread/thread/fb2007e61b505c4d
I couldn't decide until having fixed SI-6323 today, which is about
trying to reflect against a local class using typeOf.
The problem with local classes is that they aren't pickled, so their metadata
isn't preserved between Scala compilation runs. Sure, we can restore some of
that metadata with Java reflection, but you get the idea.
Before today typeOf of a local class created a free type, a synthetic symbol,
with a bunch of synthetic children that remember the metadata, effectively
creating a mini symbol table. That might be useful at time, but the problem is
that this free type cannot be reflected, because the global symbol table of
Scala reflection doesn't know about its mini symbol table.
And then it struck me. It's not the presence of abs types (type parameters and
abs type members) that differentiates arbitrary type tags from good type tags.
It's the presence of types that don't map well on the runtime world - ones that
can't be used to instantiate values, ones that can't be reflected.
So we just need a name for these types. Phantom types are compile-time only
concept, whereas our types can have partial correspondence with the runtime.
"Weak types" sound more or less okish, so let's try them out.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Tags.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Tags.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Tags.scala b/src/compiler/scala/tools/nsc/typechecker/Tags.scala index f82e009be8..167bf5c857 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Tags.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Tags.scala @@ -26,7 +26,7 @@ trait Tags { /** Finds in scope or materializes a ClassTag. * Should be used instead of ClassManifest every time compiler needs to persist an erasure. * - * Once upon a time, we had an `ErasureTag` which was to `ClassTag` the same that `AbsTypeTag` is for `TypeTag`. + * Once upon a time, we had an `ErasureTag` which was to `ClassTag` the same that `WeakTypeTag` is for `TypeTag`. * However we found out that we don't really need this concept, so it got removed. * * @param pos Position for error reporting. Please, provide meaningful value. @@ -43,7 +43,7 @@ trait Tags { resolveTag(pos, taggedTp, allowMaterialization) } - /** Finds in scope or materializes an AbsTypeTag (if `concrete` is false) or a TypeTag (if `concrete` is true). + /** Finds in scope or materializes an WeakTypeTag (if `concrete` is false) or a TypeTag (if `concrete` is true). * * @param pos Position for error reporting. Please, provide meaningful value. * @param pre Prefix that represents a universe this type tag will be bound to. @@ -60,7 +60,7 @@ trait Tags { * EmptyTree if `allowMaterialization` is false, and there is no array tag in scope. */ def resolveTypeTag(pos: Position, pre: Type, tp: Type, concrete: Boolean, allowMaterialization: Boolean = true): Tree = { - val tagSym = if (concrete) TypeTagClass else AbsTypeTagClass + val tagSym = if (concrete) TypeTagClass else WeakTypeTagClass val tagTp = if (pre == NoType) TypeRef(BaseUniverseClass.toTypeConstructor, tagSym, List(tp)) else singleType(pre, pre member tagSym.name) val taggedTp = appliedType(tagTp, List(tp)) resolveTag(pos, taggedTp, allowMaterialization) |