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
Re: [Caml-list] 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:56)
From: David Allsopp <dra-news@m...>
Subject: Re: [Caml-list] warning on value shadowing
> On Wednesday 21 February 2007 20:41, Sam Steingold wrote:
> > Proposal:
> > When both foo.ml and bar.ml define zot and quux.ml opens both Foo and
> > Bar, there should be a warning (when compiling quux) about Foo.zot being
> > shadowed by Bar.zot (or vice versa, depending on the order of the open
> > statements).
> I think this is such a common style (I use shadowing deliberately all the 
> time) that it would be very annoying to be warned about it.

I agree --- local shadowing is too useful a programming style to have
warnings issued. Though redefining a value at global level is possibly worth
having a warning about.

IMHO Pervasives is the only module that should be opened --- renaming a
module with "module Foo = SomeVeryLongModuleNameYouDontWantToTypeLots" is
better (makes clearer code) than "open ... ". But that's just another