Version française
Home     About     Download     Resources     Contact us    
Browse thread
Value shadowing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Value shadowing
On Wed, Aug 13, 2008 at 09:54:36AM +0100, David Allsopp wrote:
> Suppose I have this piece of code:
> 
> let foo xs =
>   match xs with
>     x::xs -> if x
>              then xs (* Return the tail of the list *)
>              else xs (* Return the entire list *)
>   | []    -> raise Exit

I'd find it very counter-intuitive if OCaml behaved like this, and
annoying if it gave a warning.  Just name the variables to be
different!

Rich.

-- 
Richard Jones
Red Hat