summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2015-11-29 15:00:20 +0100
committerGabriel Scherer <gabriel.scherer@gmail.com>2015-11-29 15:00:20 +0100
commit42ebc0469bd89b89c33a2e0fcf758c9f1c654113 (patch)
treed99a76aa0339a47287086848fb6a48c255cf3a94
parent894d76d2f1d0b0a01a4e835fa04bd3e5894cb4f9 (diff)
parentf86b78c34e9dc5155fa68e76e02ec20ef703c3e2 (diff)
downloadocaml-42ebc0469bd89b89c33a2e0fcf758c9f1c654113.tar.gz
Merge pull request #318 from Octachron/manual_deprecated_fix
Manual: fix uses of deprecated functions
-rw-r--r--manual/manual/tutorials/advexamples.etex14
-rw-r--r--manual/manual/tutorials/coreexamples.etex6
2 files changed, 10 insertions, 10 deletions
diff --git a/manual/manual/tutorials/advexamples.etex b/manual/manual/tutorials/advexamples.etex
index 8d3933224b..fff3f10836 100644
--- a/manual/manual/tutorials/advexamples.etex
+++ b/manual/manual/tutorials/advexamples.etex
@@ -315,12 +315,12 @@ class ostring s =
object
method get n = String.get s n
method print = print_string s
- method copy = new ostring (String.copy s)
+ method escaped = new ostring (String.escaped s)
end;;
\end{caml_example}
-However, the method "copy" returns an object of the class "ostring",
+However, the method "escaped" returns an object of the class "ostring",
and not an object of the current class. Hence, if the class is further
-extended, the method "copy" will only return an object of the parent
+extended, the method "escaped" will only return an object of the parent
class.
\begin{caml_example}
class sub_string s =
@@ -338,11 +338,11 @@ class better_string s =
val repr = s
method get n = String.get repr n
method print = print_string repr
- method copy = {< repr = String.copy repr >}
- method sub start len = {< repr = String.sub s start len >}
+ method escaped = {< repr = String.escaped repr >}
+ method sub start len = {< repr = String.sub s start len >}
end;;
\end{caml_example}
-As shown in the inferred type, the methods "copy" and "sub" now return
+As shown in the inferred type, the methods "escaped" and "sub" now return
objects of the same type as the one of the class.
Another difficulty is the implementation of the method "concat".
@@ -357,7 +357,7 @@ class ostring s =
method repr = repr
method get n = String.get repr n
method print = print_string repr
- method copy = {< repr = String.copy repr >}
+ method escaped = {< repr = String.escaped repr >}
method sub start len = {< repr = String.sub s start len >}
method concat (t : 'mytype) = {< repr = repr ^ t#repr >}
end;;
diff --git a/manual/manual/tutorials/coreexamples.etex b/manual/manual/tutorials/coreexamples.etex
index 839e02f5c0..fcc60dce95 100644
--- a/manual/manual/tutorials/coreexamples.etex
+++ b/manual/manual/tutorials/coreexamples.etex
@@ -54,7 +54,7 @@ fib 10;;
\pdfsection{Data types}
In addition to integers and floating-point numbers, OCaml offers the
-usual basic data types: booleans, characters, and character strings.
+usual basic data types: booleans, characters, and immutable character strings.
\begin{caml_example}
(1 < 2) = false;;
'a';;
@@ -243,13 +243,13 @@ Though all examples so far were written in purely applicative style,
OCaml is also equipped with full imperative features. This includes the
usual "while" and "for" loops, as well as mutable data structures such
as arrays. Arrays are either given in extension between "[|" and "|]"
-brackets, or allocated and initialized with the "Array.create"
+brackets, or allocated and initialized with the "Array.make"
function, then filled up later by assignments. For instance, the
function below sums two vectors (represented as float arrays) componentwise.
\begin{caml_example}
let add_vect v1 v2 =
let len = min (Array.length v1) (Array.length v2) in
- let res = Array.create len 0.0 in
+ let res = Array.make len 0.0 in
for i = 0 to len - 1 do
res.(i) <- v1.(i) +. v2.(i)
done;