Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Static exception in lambda code
@ 2008-04-11 10:04 Sanghyeon Seo
  2008-04-11 12:22 ` [Caml-list] " Luc Maranget
  0 siblings, 1 reply; 2+ messages in thread
From: Sanghyeon Seo @ 2008-04-11 10:04 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-11 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-11 10:04 Static exception in lambda code Sanghyeon Seo
2008-04-11 12:22 ` [Caml-list] " Luc Maranget

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox