Browse thread
is this a bug ?
[
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: | Christophe Raffalli <christophe.raffalli@u...> |
| Subject: | Re: [Caml-list] is this a bug ? |
Samuel Mimram a écrit : > Hi, > > Christophe Raffalli wrote: > >>-------------------------------- >>let f b l = match l with >> [] | [_] -> 1 >>| [a;_] | [_;a] when a = b-> 2 >>| _ -> 3 >> >>let _ = >> print_int (f 1 [1;2]); >> print_int (f 1 [2;1]); >> print_newline () >>-------------------------------- >> >>Do you think this code should have a useless pattern warning and print >>"23" instead of "22" ? >> >>If someone tell me this is a bug then I fill a bug report ... > > > I guess that the priorities says that you should "read" the third line as > > | [a;_] | ( [_;a] when a = b ) -> 2 > but the you should be allowed to write | ([a;_] when a = b) | ( [_;a] when a = b ) -> 2 but this results in a syntax error ... > This would justify the warning and explain the behaviour... > > Cheers, > > Samuel. -- Christophe Raffalli Université de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tél: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution can check this signature. The public key is stored on www.keyserver.net ---------------------------------------------