caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: Jeremy Yallop <yallop@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Proposal: extend try to handle success
Date: Tue, 4 Feb 2014 14:29:12 -0500	[thread overview]
Message-ID: <CAP_800qPT6XTp70mQi6Otd-FRWQddtabCOyuKBWm4LT+02Lnhw@mail.gmail.com> (raw)
In-Reply-To: <CAP_800r28Oog-0ZTzA0JnTCEZzP7-UvTKyqTbBcSDuUAAAioLQ@mail.gmail.com>

Btw., I also agree with the postscript on the symmetric extension to
"match".  I think it would improve code clarity if developers could
use "try" to indicate that they expect an exception as a means of
control flow, whereas "exception"-branches in "match" clauses would be
more suitable for truly exceptional (as in "error") conditions.

On Tue, Feb 4, 2014 at 2:18 PM, Markus Mottl <markus.mottl@gmail.com> wrote:
> 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 <yallop@gmail.com> 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



-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com

  reply	other threads:[~2014-02-04 19:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-04 17:00 Jeremy Yallop
2014-02-04 17:14 ` Simon Cruanes
2014-02-04 18:09   ` Jeremy Yallop
2014-02-04 19:05     ` Gabriel Scherer
2014-02-04 19:18 ` Markus Mottl
2014-02-04 19:29   ` Markus Mottl [this message]
2014-02-04 19:42     ` Yaron Minsky
2014-02-05 16:04       ` Jesper Louis Andersen
2014-02-06 10:58 ` Goswin von Brederlow
2014-02-06 11:10   ` Ben Millwood
2014-02-10  8:47     ` Goswin von Brederlow
2014-02-10  9:23       ` Ben Millwood
2014-02-10 14:39         ` Alain Frisch
2014-02-06 11:36   ` Jeremy Yallop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_800qPT6XTp70mQi6Otd-FRWQddtabCOyuKBWm4LT+02Lnhw@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=yallop@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).