diff options
author | michelou <michelou@epfl.ch> | 2007-01-31 14:54:45 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-01-31 14:54:45 +0000 |
commit | e566c7126ce2a593e9d5711784667a25bc92d514 (patch) | |
tree | f080fd5b2dbd65d33a49c6e496eeea119f38b03e /src/library | |
parent | 32e3f2cafbd146528a03a60dac26575114226db1 (diff) | |
download | scala-e566c7126ce2a593e9d5711784667a25bc92d514.tar.gz scala-e566c7126ce2a593e9d5711784667a25bc92d514.tar.bz2 scala-e566c7126ce2a593e9d5711784667a25bc92d514.zip |
uncurried Console.printf
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Console.scala | 33 | ||||
-rw-r--r-- | src/library/scala/Symbol.scala | 33 |
2 files changed, 45 insertions, 21 deletions
diff --git a/src/library/scala/Console.scala b/src/library/scala/Console.scala index 7cc8e9d4e9..3a4842232b 100644 --- a/src/library/scala/Console.scala +++ b/src/library/scala/Console.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -160,18 +160,31 @@ object Console { */ def println(x: Any): Unit = out.println(x) - /** Format and print out some text (in a fashion similar to printf in C). - * The format of the text to print is specified by the parameter - * <code>text</code>. The arguments that are inserted into specific - * locations in <code>text</code> are provided with parameter - * <code>args</code>. See class <code>java.text.MessageFormat</code> - * for a full specification of the format syntax. + /** <p> + * Format and print out some text (in a fashion similar to printf in C or + * <code>printf</code> in Java 6). + * </p> + * <p> + * The format of the text to print is specified by the parameter + * <code>text</code>. The arguments that are inserted into specific + * locations in <code>text</code> are provided with parameter + * <code>args</code>. See class <a href="" target="contentFrame" + * class="java_text_MessageFormat"><code>java.text.MessageFormat</code></a> + * for a full specification of the <a href="#syntax" target="contentFrame" + * class="java_util_Formatter">format syntax</a>. + * </p> * * @param text the format of the text to print out. * @param args the parameters used to instantiate the format. + * @throws java.lang.IllegalArgumentException */ - // todo: Uncurry - def printf(text: String)(args: Any*): Unit = + def printf(text: String, args: Any*): Unit = format(text, args) + + /** + * @see <a href="#printf(java.lang.String,scala.Any*)" + * target="contentFrame">Console.printf</a>. + */ + def format(text: String, args: Any*): Unit = out.print( if (text eq null) "null" else MessageFormat.format(text, textParams(args)) diff --git a/src/library/scala/Symbol.scala b/src/library/scala/Symbol.scala index 4d30ef0fd6..9bc195dce6 100644 --- a/src/library/scala/Symbol.scala +++ b/src/library/scala/Symbol.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -9,17 +9,22 @@ // $Id$ -package scala; +package scala import collection.jcl.WeakHashMap private[scala] object internedSymbols extends WeakHashMap[String, Symbol] -/** Instances of <code>Symbol</code> can be created easily with - * Scala's built-in quote mechanism. For instance, the Scala term - * <code>'mysym</code> will invoke the constructor of the - * <code>Symbol</code> class in the following way: - * <code>new Symbol("mysym")</code>. . +/** <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 @@ -32,9 +37,15 @@ final case class Symbol(name: String) { "'" + name } - /** Makes this symbol into a unique reference. - * If two interened symbols are equal (i.e. they have the same name) - * then they must be identical (wrt reference equality) + /** <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 = internedSymbols get name match { case Some(sym) => |