From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id B7F017EE25 for ; Sun, 27 Oct 2013 19:47:11 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of yminsky@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="yminsky@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of yminsky@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="yminsky@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUCALBebVImacjlnGdsb2JhbABZgz9Uvl+BFB4OAQEBAQEGFgk8giUBAQUnGQEBNwEPCwcEDS4iEgEFARwGE4gHAwKZbYsNhFMBBY4rBo9VB4QsmA2QGxgphG0 X-IPAS-Result: AgUCALBebVImacjlnGdsb2JhbABZgz9Uvl+BFB4OAQEBAQEGFgk8giUBAQUnGQEBNwEPCwcEDS4iEgEFARwGE4gHAwKZbYsNhFMBBY4rBo9VB4QsmA2QGxgphG0 X-IronPort-AV: E=Sophos;i="4.93,581,1378850400"; d="scan'208";a="32100072" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 Oct 2013 19:47:10 +0100 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1VaVMj-0008Mc-0J for caml-list@inria.fr; Sun, 27 Oct 2013 14:47:09 -0400 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VaVMi-0007GO-Vm for caml-list@inria.fr; Sun, 27 Oct 2013 14:47:08 -0400 Received: from mail-ee0-f53.google.com ([74.125.83.53]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1VaVMi-0005Nf-Qt for caml-list@inria.fr; Sun, 27 Oct 2013 14:47:08 -0400 Received: by mail-ee0-f53.google.com with SMTP id e51so1016451eek.12 for ; Sun, 27 Oct 2013 11:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=1OP+bfA9eYmF5LHF6wvSfq3Xl0AAUdI9xQwSxcWE8pA=; b=ZuiX5FaiKtcSiIpD1IcInxZM08yNttGmauQyVczst9ByMnigPLSBibHaq5jIgYtucT cfgdPO97J40/YyL/g76uyHUl5tKYQcIVCQkCWZHLfDMzjJ+jq+o3LruEc1mjsDRfxZjN AelGUJmykGd4ZfH1oyu1RsmyF3qwiqhvp61Tk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=1OP+bfA9eYmF5LHF6wvSfq3Xl0AAUdI9xQwSxcWE8pA=; b=NVQSiJ3gA0Lw3OqriPNOO+4KsRHlpFA9OAds2Y4AZ0oP6VygiNRQeZV73WdeiYg1Ga Hen0jnSo/WR92rJ8uKX1ZmJwUeZbqgRunlNMlXTSxYExyRtkTOoZAPRF6KFzDQf9dlao KwNzbwqnaowWH0b9iguw9IlTPfHw8eOoddWG1GYIASNcBYCiXJHfSsFECVK/QQ5uycQP fUwb9pYUXv7APxUtAt4b4pSCADlr5ZP7kgJWrs4IYFqXB5ToEoCqTHQPI3Khrf8SlgIm 2UZYmDhoJuFQj4QsvKeE6mrbYrMvD3DhDjtFpxefw3UTuwuCxQLlB7RBZ/af3IpiMwbH esgA== X-Gm-Message-State: ALoCoQlYi2Ddvb7gzW4knrYyws9wfDvlLfNUtT5/fs4/1I4blpnVx9l0Lcha/hd3TS62+cfzKRfpBOLVysRQf7QAKDLq5ykzTO4JCYmaxFC73c/pE19nVoI3ZblN61IFn7RjhtwBDjhQ9rTpHDKA/1qoInNcImGZJQ== X-Received: by 10.14.88.132 with SMTP id a4mr76529eef.60.1382899628183; Sun, 27 Oct 2013 11:47:08 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.14.88.132 with SMTP id a4mr76525eef.60.1382899628070; Sun, 27 Oct 2013 11:47:08 -0700 (PDT) Received: by 10.223.180.138 with HTTP; Sun, 27 Oct 2013 11:47:07 -0700 (PDT) In-Reply-To: <526D5AF9.9030303@coherentgraphics.co.uk> References: <526D5AF9.9030303@coherentgraphics.co.uk> Date: Sun, 27 Oct 2013 14:47:07 -0400 Message-ID: From: Yaron Minsky To: John Whitington Cc: "caml-list@inria.fr" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Should -strict-sequence become the default? There are cases that the warning doesn't catch but should. Here's an example of a case that you'd like to catch. # let z f = f (); 3;; val z : (unit -> 'a) -> int = With strict-sequence, this will instead compile to: # let z f = f (); 3;; val z : (unit -> unit) -> int = I think the strict-sequence behavior is strictly preferable. y On Sun, Oct 27, 2013 at 2:27 PM, John Whitington wrote: > Hi, > > > Yaron Minsky wrote: >> >> Back in 3.12.1, a flag, -strict-sequence, was added that require that >> the left-hand side of a sequence returns unit. I suspect there's >> broad agreement that -strict-sequence is the better default, but that >> the old behavior has been left in place by default for compatibility >> reasons. I wonder if in the next major release, it would make sense >> to make -strict-sequence the default, and have a flag for enabling the >> old behavior. >> >> To say the obvious, such a change would be of no value to experienced >> people and organizations that know how to set up the compiler to their >> liking, but can be of real value to newcomers to the language. > > > Isn't this covered (as a warning not an error) by warnings 5 & 10, both of > which are default? > > Although the manual does say, rather ominously... > > "Note that warnings 5 and 10 are not always triggered, depending on the > internals of the type checker." > > Does that caveat also apply to -strict-sequence? If not, why not, and could > its implementation be back-ported to fix up warnings 5 and/or 10? > > feast:~ john$ ocaml -strict-sequence > OCaml version 4.01.0 > > # let f x = x + 1;; > val f : int -> int = > # f 1; 0;; > Error: This expression has type int but an expression was expected of type > unit > > feast:~ john$ ocaml > OCaml version 4.01.0 > > # let f x = x + 1;; > val f : int -> int = > # f 1; 0;; > Warning 10: this expression should have type unit. > - : int = 0 > > The warning text for warning 10 could be changed to: > > "Warning 10: this expression should have type unit. If this is intended, > consider using the 'ignore' function." > > Cheers, > > -- > John Whitington > Director, Coherent Graphics Ltd > http://www.coherentpdf.com/ >