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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 9D92F7F7C2 for ; Tue, 4 Feb 2014 19:09:14 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of yallop@gmail.com) identity=pra; client-ip=209.85.216.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of yallop@gmail.com designates 209.85.216.175 as permitted sender) identity=mailfrom; client-ip=209.85.216.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qc0-f175.google.com) identity=helo; client-ip=209.85.216.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="postmaster@mail-qc0-f175.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjUDAMcr8VLRVdivlGdsb2JhbABZg0RXgwG7GYEGCBYOAQEBAQcLCwkSKoIlAQEEASMEGQEbHQEDAQsGBQsNAgImAgIiAREBBQEcBhMIh2gBAwkIDaA+jApTgwmTbgoZJw1kiE8RAQUMgR2NGTMHgm+BSQSYK4EyjwIYKYRZPA X-IPAS-Result: AjUDAMcr8VLRVdivlGdsb2JhbABZg0RXgwG7GYEGCBYOAQEBAQcLCwkSKoIlAQEEASMEGQEbHQEDAQsGBQsNAgImAgIiAREBBQEcBhMIh2gBAwkIDaA+jApTgwmTbgoZJw1kiE8RAQUMgR2NGTMHgm+BSQSYK4EyjwIYKYRZPA X-IronPort-AV: E=Sophos;i="4.95,781,1384297200"; d="scan'208";a="56858615" Received: from mail-qc0-f175.google.com ([209.85.216.175]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Feb 2014 19:09:14 +0100 Received: by mail-qc0-f175.google.com with SMTP id x13so14082893qcv.6 for ; Tue, 04 Feb 2014 10:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ijDuvhU9ZAkfzPFTCAPKJzs6PEamQNhRUxXoP9wmax0=; b=VxBWS6myjofTcRWvhE2WmBmeIOUvaYjPh8qlFDvrvnxbpAVgwtXA57EKILOox/2u+5 irAhS1IWDf2pQ/c6GQcF2v/GtN25cqptF99n3C9RtCyBC+5FrPxYUjrMWJwT8EJcprZ1 iQcwQWVTnKN/UZIz1I6AcDTNx7OaWtF31z0PMzC3AeVlc46veEdt59KauXiE4Lnd5BR0 inOUdmgf5p/l9JCODBU8rR2h3W8jIAUyiZLpkOrk3kY2i2dGQwx5LEWzsDM4LCeG7xO0 rT2vjU2ehFLfWzFz3XSkM+lA0/+ai9Q8NdGnY/OlwuuTdlIsKsDtujX+Bgb1RFR4jVK3 6X3A== MIME-Version: 1.0 X-Received: by 10.140.81.74 with SMTP id e68mr64523803qgd.99.1391537352994; Tue, 04 Feb 2014 10:09:12 -0800 (PST) Received: by 10.229.231.73 with HTTP; Tue, 4 Feb 2014 10:09:12 -0800 (PST) In-Reply-To: <20140204171435.GD11278@emmental.inria.fr> References: <20140204171435.GD11278@emmental.inria.fr> Date: Tue, 4 Feb 2014 18:09:12 +0000 Message-ID: From: Jeremy Yallop To: Simon Cruanes Cc: Caml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Proposal: extend try to handle success On 4 February 2014 17:14, Simon Cruanes wrote: > Le Tue, 04 Feb 2014, Jeremy Yallop a =C3=A9crit : >> I'd like to propose extending OCaml with a design once suggested by >> Christophe Raffalli which elegantly handles this case. The details, >> along with an implementation that you can try out, are in the >> following blog post: >> >> http://ocamllabs.github.io/compiler-hacking/2014/02/04/handler-case.= html >> >> Feedback welcome! > > This is very nice and detailed, but I'm not sure to follow how this is > supposed to help in some cases you mention. Namely, the > > match (try Some (foo) with End_of_foo -> None) with > | Some x -> a > | None -> b > > transformation is used to preserve tail-call. Would the new > > try foo with > | End_of_foo -> b > | val x -> a > > present the same behavior w.r.t tail-call? Yes, 'a' is in tail position in both snippets. > If the answer is yes, then I find it very interesting :)