From: "Sanghyeon Seo" <sanxiyn@gmail.com>
To: caml-list@inria.fr
Subject: Static exception in lambda code
Date: Fri, 11 Apr 2008 19:04:25 +0900 [thread overview]
Message-ID: <5b0248170804110304q2a968b94uf0402cd3a54ad0df@mail.gmail.com> (raw)
Luc Maranget suggested that static exception mechanism in lambda code,
namely Lstaticcatch and Lstaticraise, could be used to implement break
and continue.
However, this doesn't work right now. In bytecomp/simplif.ml,
simplify_exits simplify
(catch (seq (exit 1) (assign a b)) with (1) unit) to
(seq unit (assign a b))
which is not appropriate.
The comment says: "simplify catch body with (i ...) handler ... if
(exit i ...) occurs exactly once in body, substitute it with handler".
simplify_exits suppress catch if no exit occurs in body, which is
nice, but this simplification is dangerous if one is to use this
mechanism to implement break and continue.
So, which is the case?
1. The simplification is not safe, so it should be removed.
2. The simplification is consistent with intended semantics of static
catch/raise, so static catch/raise is not directly useful to implement
break/continue or for that matter, return.
--
Seo Sanghyeon
next reply other threads:[~2008-04-11 10:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-11 10:04 Sanghyeon Seo [this message]
2008-04-11 12:22 ` [Caml-list] " Luc Maranget
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=5b0248170804110304q2a968b94uf0402cd3a54ad0df@mail.gmail.com \
--to=sanxiyn@gmail.com \
--cc=caml-list@inria.fr \
/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