caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Jeremy Yallop <yallop@gmail.com>
Cc: Simon Cruanes <simon.cruanes.2007@m4x.org>,
	Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Proposal: extend try to handle success
Date: Tue, 4 Feb 2014 20:05:22 +0100	[thread overview]
Message-ID: <CAPFanBH6UeUvxrVWGUKz_NndgUmgpCF0o9_h9wFWEbcPzVV6YQ@mail.gmail.com> (raw)
In-Reply-To: <CAAxsn=E4v=ZQmovPbYQYgYgeo4FuhMkh3FcBFxLfkQgkxtGwEw@mail.gmail.com>

This proposal lifts my only (and surprisingly blocking) reservation
with "let-try", namely the fact that I have no idea which of "let-try
<decl> in <expr> with <handler>" or "let-try <decl> with <handler> in
<expr>" 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 <yallop@gmail.com> wrote:
> On 4 February 2014 17:14, Simon Cruanes <simon.cruanes.2007@m4x.org> wrote:
>> Le Tue, 04 Feb 2014, Jeremy Yallop a écrit :
>>> 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

  reply	other threads:[~2014-02-04 19:06 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 [this message]
2014-02-04 19:18 ` Markus Mottl
2014-02-04 19:29   ` Markus Mottl
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=CAPFanBH6UeUvxrVWGUKz_NndgUmgpCF0o9_h9wFWEbcPzVV6YQ@mail.gmail.com \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=simon.cruanes.2007@m4x.org \
    --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).