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 9D9D77F7C2 for ; Tue, 4 Feb 2014 20:18:41 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of markus.mottl@gmail.com) identity=pra; client-ip=209.85.216.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="markus.mottl@gmail.com"; x-sender="markus.mottl@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of markus.mottl@gmail.com designates 209.85.216.169 as permitted sender) identity=mailfrom; client-ip=209.85.216.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="markus.mottl@gmail.com"; x-sender="markus.mottl@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-f169.google.com) identity=helo; client-ip=209.85.216.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="markus.mottl@gmail.com"; x-sender="postmaster@mail-qc0-f169.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjYDACo88VLRVdiplGdsb2JhbABZg0RLDKpSk0iBBggWDgEBAQEHCwsJEiqCJQEBBUABFAcSCwEDDAYFCw0NISEBAREBBQEKEgYTEodeAQMRDaBCjF2DCZNrChknAwpkiCoRAQUMjFSCFQeEOASJSYx2gWyBMossg1YYKYR3Hg X-IPAS-Result: AjYDACo88VLRVdiplGdsb2JhbABZg0RLDKpSk0iBBggWDgEBAQEHCwsJEiqCJQEBBUABFAcSCwEDDAYFCw0NISEBAREBBQEKEgYTEodeAQMRDaBCjF2DCZNrChknAwpkiCoRAQUMjFSCFQeEOASJSYx2gWyBMossg1YYKYR3Hg X-IronPort-AV: E=Sophos;i="4.95,781,1384297200"; d="scan'208";a="56865028" Received: from mail-qc0-f169.google.com ([209.85.216.169]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Feb 2014 20:18:41 +0100 Received: by mail-qc0-f169.google.com with SMTP id w7so14512701qcr.14 for ; Tue, 04 Feb 2014 11:18:39 -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; bh=WWxuLtvbBhEUUfyArv6StuzcCHCId6tIMRrP2fEkLMg=; b=VENPatDQFgTN+cp3jGOuISYg0irHPlWRn65Riaq+P5Z/SFLAxYYd11r1VLyX8JGsYU WR/Ny74yfYfR3EDpXPaiiMhTQFT11iQ13Th8/Mg9QrW6UE6iAYJja2DcpsIYBLFhrSh7 FE3yci+jKeDqHZ4Fj0mbR3w7MbbDGCLdONP+1T4NWoavjcdpBwOw7BOaaaVPJNHyzLTH OQxCVfwiKTsAg+4vIKP2ORIdtEU9bjTnbrTVU89PYZixV2dFllAE4ck3xnDwOloNTpa2 bP+IcxWJSPbsp+zsU/f8dRXLCOBzmg/27f83jKm2fj3XLGLDE3MoRwqdc9136MKnrsBv VTng== MIME-Version: 1.0 X-Received: by 10.140.43.3 with SMTP id d3mr64323366qga.70.1391541510356; Tue, 04 Feb 2014 11:18:30 -0800 (PST) Received: by 10.140.90.70 with HTTP; Tue, 4 Feb 2014 11:18:30 -0800 (PST) In-Reply-To: References: Date: Tue, 4 Feb 2014 14:18:30 -0500 Message-ID: From: Markus Mottl To: Jeremy Yallop Cc: Caml List Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Proposal: extend try to handle success Nice! I've always hated the "option"-workaround required to maintain tail-recursion with exception handlers. The required syntax change seems quite benign, too, and the feature might improve performance a bit, assuming the code generator has a special case for it rather than internally rewriting the code to use the "option"-workaround. Doesn't sound difficult to do either. Regards, Markus On Tue, Feb 4, 2014 at 12:00 PM, Jeremy Yallop wrote: > The recent thread about the representation of options highlighted a > shortcoming in the "try" construct: there isn't a convenient way to > express code that should run when the body of the "try" doesn't raise > an exception. > > 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! > > Jeremy > > -- > 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 -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com