From 614ba1f785ef4fcee023babf379af9e3b1f7ce04 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Fri, 19 Jun 2009 15:47:18 +0000 Subject: Support for specialization on explicit types. class Foo[@specialized("Int, Double") T] .. --- src/library/scala/specialized.scala | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/library') diff --git a/src/library/scala/specialized.scala b/src/library/scala/specialized.scala index 8e30261333..fcc1c4b5da 100644 --- a/src/library/scala/specialized.scala +++ b/src/library/scala/specialized.scala @@ -3,7 +3,22 @@ package scala /** Annotate type parameters on which code should be automatically * specialized. For example: * - * class MyList[T @specialized] ... + * class MyList[@specialized T] ... * + * + * Type T can be specialized on a subset of the primitive types by + * specifying a comma-separated string argument: + * + * + * class MyList[@specialized("Int, Double, Boolean") T] .. + * + * Only primitive types are supported and no name resolution is currently + * done on the string arguments (meaning imports and type aliases are + * not resolved). */ -class specialized extends StaticAnnotation +class specialized(types: String) extends StaticAnnotation { + def this() { + this("Boolean, Byte, Short, Char, Int, Long, Float, Double") + } +} + -- cgit v1.2.3