summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2016-03-14 17:55:03 -0400
committerSeth Tisue <seth@tisue.net>2016-03-14 17:55:03 -0400
commit5ebae12875be19ddc98520b21d98af19b7c7b2da (patch)
tree2eab37cf8775c6d3b82c0f7b129f79209f4d828e /src/library
parent9f95f746aa80a954240178a2afd7bdf6440bcaea (diff)
parent525102dca81303a9549337f0fe5b714eb7b6fab1 (diff)
downloadscala-5ebae12875be19ddc98520b21d98af19b7c7b2da.tar.gz
scala-5ebae12875be19ddc98520b21d98af19b7c7b2da.tar.bz2
scala-5ebae12875be19ddc98520b21d98af19b7c7b2da.zip
Merge pull request #5018 from janekdb/topic/2.12.x-scaladoc-advertise-deprecated-read-methods-less-Predef
Remove mention of deprecated I/O methods from Predef main comment
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/Predef.scala36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 6f3fd1ba23..9cd2a2b8de 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -28,13 +28,11 @@ import scala.io.StdIn
* constructors ([[scala.collection.immutable.::]] and
* [[scala.collection.immutable.Nil]]).
*
- * === Console I/O ===
- * Predef provides a number of simple functions for console I/O, such as
- * `print`, `println`, `readLine`, `readInt`, etc. These functions are all
- * aliases of the functions provided by [[scala.Console]].
+ * === Console Output ===
+ * For basic console output, `Predef` provides convenience methods [[print(x:Any* print]] and [[println(x:Any* println]],
+ * which are aliases of the methods in the object [[scala.Console]].
*
* === Assertions ===
- *
* A set of `assert` functions are provided for use as a way to document
* and dynamically check invariants in code. Invocations of `assert` can be elided
* at compile time by providing the command line option `-Xdisable-assertions`,
@@ -304,9 +302,37 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef {
// printing -----------------------------------------------------------
+ /** Prints an object to `out` using its `toString` method.
+ *
+ * @param x the object to print; may be null.
+ */
def print(x: Any) = Console.print(x)
+
+ /** Prints a newline character on the default output.
+ */
def println() = Console.println()
+
+ /** Prints out an object to the default output, followed by a newline character.
+ *
+ * @param x the object to print.
+ */
def println(x: Any) = Console.println(x)
+
+ /** Prints its arguments as a formatted string to the default output,
+ * based on a string pattern (in a fashion similar to printf in C).
+ *
+ * The interpretation of the formatting patterns is described in
+ * <a href="" target="contentFrame" class="java/util/Formatter">
+ * `java.util.Formatter`</a>.
+ *
+ * Consider using the [[scala.StringContext.f f interpolator]] as more type safe and idiomatic.
+ *
+ * @param text the pattern for formatting the arguments.
+ * @param args the arguments used to instantiating the pattern.
+ * @throws java.lang.IllegalArgumentException if there was a problem with the format string or arguments
+ *
+ * @see [[scala.StringContext.f StringContext.f]]
+ */
def printf(text: String, xs: Any*) = Console.print(text.format(xs: _*))
// views --------------------------------------------------------------