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 7C5BE7F7C2 for ; Tue, 4 Feb 2014 20:06:03 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.41; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.41 as permitted sender) identity=mailfrom; client-ip=209.85.214.41; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.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@mail-bk0-f41.google.com) identity=helo; client-ip=209.85.214.41; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-bk0-f41.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjUDAPo48VLRVdYplWdsb2JhbABZg0RXqlKTSIEGCBYOAQEBAQcNCQkSKoIlAQEFJxkBGxIEBwEDDAYFCw0NISEBAREBBQEKEgYTCAqHXgEDEQ2gRIxdgwmTawoZJwMKZIgqEQEFDIxUgWIzB4Q4AQOWP4FsgTKLLINWGCmEWjs X-IPAS-Result: AjUDAPo48VLRVdYplWdsb2JhbABZg0RXqlKTSIEGCBYOAQEBAQcNCQkSKoIlAQEFJxkBGxIEBwEDDAYFCw0NISEBAREBBQEKEgYTCAqHXgEDEQ2gRIxdgwmTawoZJwMKZIgqEQEFDIxUgWIzB4Q4AQOWP4FsgTKLLINWGCmEWjs X-IronPort-AV: E=Sophos;i="4.95,781,1384297200"; d="scan'208";a="47798790" Received: from mail-bk0-f41.google.com ([209.85.214.41]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Feb 2014 20:06:02 +0100 Received: by mail-bk0-f41.google.com with SMTP id na10so3455500bkb.14 for ; Tue, 04 Feb 2014 11:06:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=GwVvK6g77mQrT6jZCBO+hdnJFBSDgsmNX53AYCPh3fk=; b=od5bBtZ+xoPHbYFMh4vd8abw45fg3x3BaIWXBj3qWdaL1RUx1tZaDGoIRLrIbpApOH eKB9XSJ3HM5FFDXktLZqFT4i6t7mXjJHDxFMFvle9dAiA/YH3aLF42sg7o+BRprpYiY0 4XyRXJLesSqzR69BjO/E/kn89tsKflQRn4cmWTBB9YFE0CAAtxZQfPOvcTGCfz5nlnmt oPEvzmh7pm2+1pQTxh3aJxI+9eFkUX6dC5PrDRDDplTZAqvCFqE2KBdavZoADYFdub7E Dum/HhL1Ei9jB7UTx0VCGbxjybOfBQVN/hYS9deGeqwUKznbjCgoWHYT2sEPFv5waMWv srCQ== X-Received: by 10.204.26.69 with SMTP id d5mr38084bkc.47.1391540762259; Tue, 04 Feb 2014 11:06:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.205.45.5 with HTTP; Tue, 4 Feb 2014 11:05:22 -0800 (PST) In-Reply-To: References: <20140204171435.GD11278@emmental.inria.fr> From: Gabriel Scherer Date: Tue, 4 Feb 2014 20:05:22 +0100 Message-ID: To: Jeremy Yallop Cc: Simon Cruanes , Caml List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Proposal: extend try to handle success This proposal lifts my only (and surprisingly blocking) reservation with "let-try", namely the fact that I have no idea which of "let-try in with " or "let-try with in " is the right syntax in the general case. With this proposal, value-return-handlers and exception-handlers can be ordered at will by the user. (Thank you for mentioning the relation to the effect-handler work. I distinctly remember having the realization that this syntax would solve our problem in a discussion with you, Sam Lindley and Ohad Kammar after their HOPE talk in Copenhagen. Could this research improve OCaml as a... side-effect?) On Tue, Feb 4, 2014 at 7:09 PM, Jeremy Yallop wrote: > On 4 February 2014 17:14, Simon Cruanes wrot= e: >> Le Tue, 04 Feb 2014, Jeremy Yallop a =E9crit : >>> 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 :) > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs