diff options
Diffstat (limited to 'src/cldc-library/scala/Symbol.scala')
-rw-r--r-- | src/cldc-library/scala/Symbol.scala | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/cldc-library/scala/Symbol.scala b/src/cldc-library/scala/Symbol.scala new file mode 100644 index 0000000000..3af5172406 --- /dev/null +++ b/src/cldc-library/scala/Symbol.scala @@ -0,0 +1,48 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + + +package scala + +/** <p> + * Instances of <code>Symbol</code> can be created easily with + * Scala's built-in quote mechanism. + * </p> + * <p> + * For instance, the <a href="http://scala-lang.org/" target="_top">Scala</a> + * term <code>'mysym</code> will invoke the constructor of the + * <code>Symbol</code> class in the following way: + * <code>new Symbol("mysym")</code>. + * </p> + * + * @author Martin Odersky + * @version 1.7, 08/12/2003 + */ +final case class Symbol(name: String) { + + /** Converts this symbol to a string. + */ + override def toString(): String = { + "'" + name + } + + /** <p> + * Makes this symbol into a unique reference. + * </p> + * <p> + * If two interened symbols are equal (i.e. they have the same name) + * then they must be identical (wrt reference equality). + * </p> + * + * @return the unique reference to this symbol. + */ + def intern: Symbol = this + +} |