From: "Sanghyeon Seo" <sanxiyn@gmail.com>
To: caml-list@inria.fr
Subject: Non-tail return
Date: Tue, 15 Apr 2008 23:07:06 +0900 [thread overview]
Message-ID: <5b0248170804150707x4b204441x2ee5b7d0aaf39540@mail.gmail.com> (raw)
Richard Jones suggested that type-safe return statement which
immediately returns from the innermost function would be useful. So I
developed an implementation. His sample code (from Extlib) works
as-is.
http://sparcs.kaist.ac.kr/~tinuviel/devel/ocaml/
Some notes:
* This depends on nontail exit patch I did as a part of break/continue
patch. break-continue-v2 was broken to break-continue-v3 and
nontail-exit-v1.
* A stack of function's return type is maintained. "return e" causes
unification of "e" and return type on the top of the stack. "return e"
itself is typed as unit.
* Function is translated with implicit catch around body, and return
is translated to raise. Simplification removes implicit catch when no
return is used, so existing codes should compile same.
--
Seo Sanghyeon
reply other threads:[~2008-04-15 14:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=5b0248170804150707x4b204441x2ee5b7d0aaf39540@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;
as well as URLs for NNTP newsgroup(s).