English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
warning on value shadowing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-21 (22:13)
From: David Brown <caml-list2@d...>
Subject: Re: [Caml-list] Re: warning on value shadowing
Sam Steingold wrote:

>> The problem with this as a warning, is that outside of multiple
>> modules, this scenario is fairly common:
>>   let x = ...
>>   let x = ... x ...

> 3 shadow a global value with a local one (warning)
> 4 redefine a local value as in your example (no warning)

I guess my example was a little ambiguous.  Those were meant to be
top-level bindings.  I've seen this construct fairly commonly.  It is
especially useful when making something that wraps around another
call, adding a bit more functionality.