summaryrefslogtreecommitdiff
path: root/stdlib/int32.mli
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2016-11-07 17:11:35 +0100
committerDavid Allsopp <david.allsopp@metastack.com>2016-11-07 16:11:35 +0000
commit69263a989313ab334f85f68e7c53ba2ff0f049f3 (patch)
tree77e4f22f3a356da8f3ef71c391e8680325182305 /stdlib/int32.mli
parenta02958960640cba8f8058a7c7ca04af99a988097 (diff)
downloadocaml-69263a989313ab334f85f68e7c53ba2ff0f049f3.tar.gz
Option-returning variants of stdlib functions (#885)
Provide an xxx_opt alternative for functions raising Not_found and many instances of Failure/Invalid_arg. The only exception is the rarely used Buffer.add_substitute, where the [Not_found] can really be interpreted as an error condition. Most new functions are implemented directly (instead of wrapping the raising version). This is for performance reasons and also to avoid destroying the stacktrace (if the function is used in an exception handler). One could instead implement the raising versions on top of the new functions, but there might be a small penalty.
Diffstat (limited to 'stdlib/int32.mli')
-rw-r--r--stdlib/int32.mli5
1 files changed, 5 insertions, 0 deletions
diff --git a/stdlib/int32.mli b/stdlib/int32.mli
index 249fa23db3..19d7897a22 100644
--- a/stdlib/int32.mli
+++ b/stdlib/int32.mli
@@ -135,6 +135,11 @@ external of_string : string -> int32 = "caml_int32_of_string"
a valid representation of an integer, or if the integer represented
exceeds the range of integers representable in type [int32]. *)
+val of_string_opt: string -> int32 option
+(** Same as [of_string], but return [None] instead of raising.
+ @since 4.05 *)
+
+
val to_string : int32 -> string
(** Return the string representation of its argument, in signed decimal. *)