Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] Non-tail return

2 views
Skip to first unread message

Sanghyeon Seo

unread,
Apr 15, 2008, 10:07:23 AM4/15/08
to caml...@inria.fr
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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

0 new messages