diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-06-07 15:44:04 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-06-08 15:32:46 +0200 |
commit | bc5f42f51982eb473075bbd2f474a5d628813031 (patch) | |
tree | a57578c5a21ced5ed38c1a098646fa95ea88f5c2 /src/reflect | |
parent | 07f7baa21c165d6c2302a8ea26c475968e7d775e (diff) | |
download | scala-bc5f42f51982eb473075bbd2f474a5d628813031.tar.gz scala-bc5f42f51982eb473075bbd2f474a5d628813031.tar.bz2 scala-bc5f42f51982eb473075bbd2f474a5d628813031.zip |
removes array tags
Before 2.10 we had a notion of ClassManifest that could be used to retain
erasures of abstract types (type parameters, abstract type members) for
being used at runtime.
With the advent of ClassManifest (and its subtype Manifest)
it became possible to write:
def mkGenericArray[T: Manifest] = Array[T]()
When compiling array instantiation, scalac would use a ClassManifest
implicit parameter from scope (in this case, provided by a context bound)
to remember Ts that have been passed to invoke mkGenericArray and
use that information to instantiate arrays at runtime (via Java reflection).
When redesigning manifests into what is now known as type tags, we decided
to explore a notion of ArrayTags that would stand for abstract and pure array
creators. Sure, ClassManifests were perfectly fine for this job, but they did
too much - technically speaking, one doesn't necessarily need a java.lang.Class
to create an array. Depending on a platform, e.g. within JavaScript runtime,
one would want to use a different mechanism.
As tempting as this idea was, it has also proven to be problematic.
First, it created an extra abstraction inside the compiler. Along with class tags
and type tags, we had a third flavor of tags - array tags. This has threaded the
additional complexity though implicits and typers.
Second, consequently, when redesigning tags multiple times over the course of
Scala 2.10.0 development, we had to carry this extra abstraction with us, which
exacerbated the overall feeling towards array tags.
Finally, array tags didn't fit into the naming scheme we had for tags.
Both class tags and type tags sound logical, because, they are descriptors for
the things they are supposed to tag, according to their names.
However array tags are the odd ones, because they don't actually tag any arrays.
As funny as it might sound, the naming problem was the last straw
that made us do away with the array tags. Hence this commit.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Definitions.scala | 2 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/StdNames.scala | 3 |
2 files changed, 1 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index a7c4c84e4a..e4a2623c31 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -467,7 +467,6 @@ trait Definitions extends api.StandardDefinitions { def ExprValue = if (ExprsClass != NoSymbol) getMemberMethod(ExprClass, nme.value) else NoSymbol lazy val ExprModule = if (ExprsClass != NoSymbol) getMemberModule(ExprsClass, nme.Expr) else NoSymbol - lazy val ArrayTagClass = requiredClass[scala.reflect.ArrayTag[_]] lazy val ClassTagModule = requiredModule[scala.reflect.ClassTag[_]] lazy val ClassTagClass = requiredClass[scala.reflect.ClassTag[_]] lazy val TypeTagsClass = requiredClass[scala.reflect.base.TypeTags] @@ -494,7 +493,6 @@ trait Definitions extends api.StandardDefinitions { def MacroContextReify = if (MacroContextClass != NoSymbol) getMemberMethod(MacroContextClass, nme.reify) else NoSymbol lazy val MacroImplAnnotation = requiredClass[scala.reflect.makro.internal.macroImpl] lazy val MacroInternalPackage = getPackageObject("scala.reflect.makro.internal") - def MacroInternal_materializeArrayTag = getMemberMethod(MacroInternalPackage, nme.materializeArrayTag) def MacroInternal_materializeClassTag = getMemberMethod(MacroInternalPackage, nme.materializeClassTag) def MacroInternal_materializeTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeTypeTag) def MacroInternal_materializeConcreteTypeTag = getMemberMethod(MacroInternalPackage, nme.materializeConcreteTypeTag) diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala index 6f68b8f63a..5ff02bab82 100644 --- a/src/reflect/scala/reflect/internal/StdNames.scala +++ b/src/reflect/scala/reflect/internal/StdNames.scala @@ -617,7 +617,6 @@ trait StdNames { val argv : NameType = "argv" val arrayClass: NameType = "arrayClass" val arrayElementClass: NameType = "arrayElementClass" - val arrayTagToClassManifest: NameType = "arrayTagToClassManifest" val arrayValue: NameType = "arrayValue" val array_apply : NameType = "array_apply" val array_clone : NameType = "array_clone" @@ -641,6 +640,7 @@ trait StdNames { val canEqual_ : NameType = "canEqual" val checkInitialized: NameType = "checkInitialized" val classOf: NameType = "classOf" + val classTagToClassManifest: NameType = "classTagToClassManifest" val clone_ : NameType = if (forMSIL) "MemberwiseClone" else "clone" // sn.OClone causes checkinit failure val concreteTypeTagToManifest: NameType = "concreteTypeTagToManifest" val conforms: NameType = "conforms" @@ -699,7 +699,6 @@ trait StdNames { val manifest: NameType = "manifest" val manifestToConcreteTypeTag: NameType = "manifestToConcreteTypeTag" val map: NameType = "map" - val materializeArrayTag: NameType = "materializeArrayTag" val materializeClassTag: NameType = "materializeClassTag" val materializeConcreteTypeTag: NameType = "materializeConcreteTypeTag" val materializeTypeTag: NameType = "materializeTypeTag" |