From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id A6EB8BB84 for ; Wed, 13 Aug 2008 12:32:03 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvwAAMRUokhC+Vqymmdsb2JhbACROD4BAQEBAQgFCAcRA507h1MBAg X-IronPort-AV: E=Sophos;i="4.32,201,1217800800"; d="scan'208";a="28189515" Received: from ik-out-1112.google.com ([66.249.90.178]) by mail4-smtp-sop.national.inria.fr with ESMTP; 13 Aug 2008 12:32:03 +0200 Received: by ik-out-1112.google.com with SMTP id c30so5124064ika.3 for ; Wed, 13 Aug 2008 03:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=HIMnAthpjmxyAxeHPygBbSJQKpxQzaE66kx/RPX/UYk=; b=r4BWNLJpyB1X3/Xh5gariFh/L9tdB1CkSAGDm/40vyEDI+jm+QkTz8LW+e8jDwoIOa RDl1l5GwtU1hYSJew9hgVe4PXj2TzHDsRYYEJGZXcvKNIf00z97IJeQy/QByZgrkVZ/A tW7P6PlBAV8JWO9VmSTHtzVs4oHQOPPrpqtA0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=flLl6Cz/gE45E92kotqSYqkeXBh6uk0+OfufzO7em8Jh5g1/etveqiWDD3XK5snLIv KsJcPSWRtImZghIbBRkHaUKQNJXIL8bgvJhLUrNjgeoj4lzsiq22iUzeWMDRJSKPyeAH QRvb1qkyYvunC5ZW2cQXpq7yT+wNGaPzxADBs= Received: by 10.210.21.6 with SMTP id 6mr11656824ebu.162.1218623522420; Wed, 13 Aug 2008 03:32:02 -0700 (PDT) Received: from corvus.office.mcom ( [91.84.38.65]) by mx.google.com with ESMTPS id t2sm102344gve.9.2008.08.13.03.32.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 13 Aug 2008 03:32:01 -0700 (PDT) Date: Wed, 13 Aug 2008 11:33:23 +0100 From: Jim Farrand To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Value shadowing Message-ID: <20080813113323.7897b9b3@corvus.office.mcom> In-Reply-To: <7C6C7ADD-910D-4C62-92FF-E286F0817FA1@cs.berkeley.edu> References: <9E2C98C8798A487DAE77F20A9DC4F1E8@countertenor> <7C6C7ADD-910D-4C62-92FF-E286F0817FA1@cs.berkeley.edu> X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; compiler:01 syntax:01 wrote:01 caml-list:01 short:01 output:02 slightly:03 warnings:03 warnings:03 let:03 let:03 berkeley:04 usefulness:04 types:05 problem:05 On Wed, 13 Aug 2008 02:15:53 -0700 Brighten Godfrey wrote: > I also find that style useful. Sometimes the type changes, but I > can recall useful cases where the type doesn't change, e.g., a > sequence of various operations on a list. Mock-up: > > let lst = generate_list_somehow () in > let lst = List.filter (fun x -> x > 0) in > let lst = List.sort compare lst in Agreed. I have a slightly different proposal than using return types: short pragmas for switching off specific instances of a warning. I always want as many warnings as possible switched on because I find them really useful. The problem is they are warnings for a reason: They don't ALWAYS represent errors. Once my code has a warning in it, the usefulness of warnings is greatly reduced as I'm less likely to spot the addition of another warning in the compiler output. If I could disable specific instances of a warning, which I've looked at and decided to ignore, I'd get the best of both worlds. > (* @disableshadowwarning *) > let lst = generate_list_somehow () in > let lst = List.filter (fun x -> x > 0) in > let lst = List.sort compare lst in > (* @enableshadowwarning *) No doubt, someone can think of a better syntax Regards, Jim