List Info

Thread: "ocaml_beginners"::[] warning message




"ocaml_beginners"::[] warning message
user name
2006-11-19 21:44:03

On Sun, 19 Nov 2006, drehman27 wrote:

> Hi,
> When I compile the following code I get a warning message that I don't
>; understand. What is wrong?

> Warning U: this match case is unused.

The message refers to this part:

> match h with
> (uid, rat) ->
>; output_binary_int movies_data (pack_user_rating uid rat);
>; write_user_ratings t movies_data
> | _ -> failwith "There is a mistake in the movies ratings!"

(uid, rat) is a pattern that will catch everything. This is why the
compiler warns you that the _ branch will never be reached.
That's because h is a pair and can't be anything else at the same time.
Since uid and rat are just names, (uid, rat) or (_, _) or _ are
equivalent here.

Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr

Ce message est confidentiel. Merci !
This message is confidential. Thanks!

__._,_.___
.

__,_._,___
"ocaml_beginners"::[] warning message
user name
2006-11-20 00:10:00

thanks Martin and Richard!

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )