skip to main content
10.1145/1016850.1016864acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Multi-return function call

Published:19 September 2004Publication History

ABSTRACT

It is possible to extend the basic notion of "function call" to allow functions to have multiple return points. This turns out to be a surprisingly useful mechanism. This paper conducts a fairly wide-ranging tour of such a feature: a formal semantics for a minimal λ -calculus capturing the mechanism; a motivating example; a static type system; useful transformations; implementation concerns and experience with an implementation; and comparison to related mechanisms, such as exceptions, sum-types and explicit continuations. We conclude that multiple-return function call is not only a useful and expressive mechanism, both at the source-code and intermediate-representation level, but is also quite inexpensive to implement.

References

  1. Andrew W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Henk Barendregt. The Lambda Calculus. North Holland, revised edition, 1984.Google ScholarGoogle Scholar
  3. F. DeRemer and T. Pennello. Efficient Computation of LALR(1) Look-Ahead Set. TOPLAS, vol. 4,no. 4, October 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. C. Fisher and R. LeBlanc. Crafting a Compiler. Benjamin Cummings, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Andrzej Filinksi. Declarative Continuations and Categorical Duality. Master's thesis, Computer Science Department, University of Copenhagen (August 1989). DIKU Report 89/11.Google ScholarGoogle Scholar
  6. C. Flanagan, A. Sabry, B. Duba and M. Felleisen. The essence of compiling with continuations. Proceedings of the SIG-PLAN 1993 Conference on Programming Language Design and Implementation, 1993, 237--247. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. American National Standard Programming Language FOR-TRAN. X3.9-1978, American National Standards Institute, Inc., April, 1978. Available at http://www.fortran.com/F77_std/rjcnf.htmlGoogle ScholarGoogle Scholar
  8. S. C. Johnson. Yacc-yet another compiler compiler. Tech report CSTR-32, AT&T Bell Laboratories, Murray Hill, NJ.Google ScholarGoogle Scholar
  9. David Kranz, et al. ORBIT: An optimizing compiler for Scheme. In Proceedings of the SIGPLAN '86 Symposium on Compiler Construction, published as SIGPLAN Notices 21(7), pages 219--233. Association for Computing Machinery, July 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348--375, August 1978.Google ScholarGoogle ScholarCross RefCross Ref
  11. R. Milner, M. Tofte, R. Harper, D. MacQueen. The Definition of Standard ML (Revised) MIT Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. G. Morrisett, D. Tarditi, P. Cheng, C. Stone, R. Harper, and P. Lee. TIL: A type-directed optimizing compiler for ML. 1996 SIGPLAN Conference on Programming Language Design and Implementation, pages 181--192, Philadelphia, May 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Thomas J. Pennello. Very fast LR parsing. In Proceedings of the SIGPLAN '86 Symposium on Compiler Construction, pages 145--151, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Norman Ramsey and Simon Peyton Jones. A single intermediate language that supports multiple implementations of exceptions. Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 35(5):285--298, June 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Zhong Shao, John H. Reppy, and Andrew W. Appel. Unrolling Lists. In Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, Orlando, Florida, pages 185--195, June 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Olin Shivers. SRFI-32: Sort libraries. Scheme Request for Implementation 32, available at URL http://srfi.schemers.org/. Forthcoming.Google ScholarGoogle Scholar
  17. Guy L. Steele Jr. RABBIT: A Compiler for SCHEME. Technical Report 474, MIT AI Lab, May 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Mitchell Wand. Complete type inference for simple objects, In Proceedings of the Second Symposium on Logic in Computer Science, Ithaca, New York, pages 37--44, June 1987.Google ScholarGoogle Scholar

Index Terms

  1. Multi-return function call

                    Recommendations

                    Comments

                    Login options

                    Check if you have access through your login credentials or your institution to get full access on this article.

                    Sign in
                    • Published in

                      cover image ACM Conferences
                      ICFP '04: Proceedings of the ninth ACM SIGPLAN international conference on Functional programming
                      September 2004
                      264 pages
                      ISBN:1581139055
                      DOI:10.1145/1016850
                      • cover image ACM SIGPLAN Notices
                        ACM SIGPLAN Notices  Volume 39, Issue 9
                        ICFP '04
                        September 2004
                        254 pages
                        ISSN:0362-1340
                        EISSN:1558-1160
                        DOI:10.1145/1016848
                        Issue’s Table of Contents

                      Copyright © 2004 ACM

                      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                      Publisher

                      Association for Computing Machinery

                      New York, NY, United States

                      Publication History

                      • Published: 19 September 2004

                      Permissions

                      Request permissions about this article.

                      Request Permissions

                      Check for updates

                      Qualifiers

                      • Article

                      Acceptance Rates

                      Overall Acceptance Rate333of1,064submissions,31%

                      Upcoming Conference

                      ICFP '24

                    PDF Format

                    View or Download as a PDF file.

                    PDF

                    eReader

                    View online with eReader.

                    eReader