Browse thread
[OSR] Exceptionless error management, take 2
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Olivier Andrieu <oandrieu@n...> |
| Subject: | Re: [Caml-list] [OSR] Exceptionless error management, take 2 |
On Feb 7, 2008 4:52 PM, David Teller <David.Teller@univ-orleans.fr> wrote: > For instance, let's consider the following extract: > > val parse_int : string -> (int, [`Syntax | `Overflow]) may_fail > > match result (parse_int "523.5") with > | Success i -> (*...*) > | Error `IncorrectSyntax -> (*...*) > | _ as e -> throw e > > This code is perfectly legitimate. Err no, it's not, you'll get a type error since the variant is closed in the signature of parse_int: This pattern matches values of type (int, [> `IncorrectSyntax ]) may_fail but is here used to match values of type (int, [ `Overflow | `Syntax ]) may_fail The second variant type does not allow tag(s) `IncorrectSyntax -- Olivier