Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article
Open access

Embedding continuations in procedural objects

Published: 01 October 1987 Publication History

Abstract

Continuations, when available as first-class objects, provide a general control abstraction in programming languages. They liberate the programmer from specific control structures, increasing programming language extensibility. Such continuations may be extended by embedding them in procedural objects. This technique is first used to restore a fluid environment when a continuation object is invoked. We then consider techniques for constraining the power of continuations in the interest of security and efficiency. Domain mechanisms, which create dynamic barriers for enclosing control, are implemented using fluids. Domains are then used to implement an unwind-protect facility in the presence of first-class continuations. Finally, we present two mechanisms, wind-unwind and dynamic-wind, that generalize unwind-protect.

References

[1]
BAKER, H. G., JR. Shallow binding in Lisp. 1.5 Commun. ACM 21, 7 (July 1978), 565-569.]]
[2]
BURGE, W.H. Recursiue Programming Techniques. Addison-Wesley, Reading, Mass., 1975.]]
[3]
DYBV1G, R.K. The Scheme Programming Language. Prentice-Hall, Englewood Cliffs, N.J., 1987.]]
[4]
FRIEDMAN, D. P., HAYNES, C. T., AND KOHLBECKER, E. Programming with continuations. In Program Transformation and Programming Environments, P. Pepper, Ed. Springer-Verlag, New York, 1984, 263-274.]]
[5]
HANSON, C., AND LAMPING, J. Dynamic binding in Scheme, Unpublished manuscript, 1984.]]
[6]
HAYNES, C.T. Logic continuations. J. Log. Program. 4, 2 (June 1987), 157-176.]]
[7]
HAYNES, C. T., AND FRIEDMAN, D. P. Abstracting timed preemption with engines. Comput. Lang. 12, 2 (1987), 109-121.]]
[8]
HAYNES, C. T., FRIEDMAN, D. P., AND WAND, M. Obtaining coroutines with continuations. Comput. Lang. 11, 3/4 (1986), 143-153.]]
[9]
HEWITT, C. Viewing control structures as patterns of passing messages. Artif Intell. 8, 3 (June 1977), 323-364. Also in Artificial Intelligence: An MIT Perspective. Winston and Brown, Eds. MIT Press, Cambridge, Mass., 1979.]]
[10]
KOHLBECKER, E., FRIEDMAN, D. P., FELLEISEN, M., AND DUBA, B. Hygienic macro expansion. In Conference Record of the 1986 ACM Symposium on Lisp and Functional Programming. (Cambridge, Mass., Aug. 4-6, 1986). ACM, New York, 1986, pp. 151-161. To appear in LISP and Symbolic Computation.]]
[11]
LANDIN, P. A correspondence between ALGOL 60 and Church's Lambda-Notation. Commun. ACM 8, 2-3 (Feb. and Mar. 1965), 89-101 and 158-165.]]
[12]
REES, J., AND CLINGER, W., EDS. Revised8 report on the algorithmic language Scheme. ACM SIGPLANNot. 21, 12 (Dec. 1986), 37-79.]]
[13]
REYNOLDS, J.C. GEDANKEN--A simple typeless language based on the principle of completeness and the reference concept. Commun. ACM 13, 5 (May 1970), 308-319.]]
[14]
REYNOLDS, J. Definitional interpreters for higher order programming languages. In Proceedings of the ACM Conference 1972 (Boston, Mass., Aug. 14-16, 1972). ACM, New York, 1972, pp. 717- 740.]]
[15]
STEELE, G. L., JR. Common Lisp: The Language. Digital Press, Bedford, Mass., 1984.]]
[16]
SUSSMAN, G. J., AND MCDERMOTT, D. V. From PLANNER to CONNIVER--A genetic approach. In Proceedings of the Fall Joint Computer Conference, vol. 41, part 2 (Anaheim, Calif., Dec. 5-7). AFIPS Press, Reston, Va., 1972, pp. 1171-1179.]]
[17]
SUSSMAN, G. J., AND STEELE, G. L., JR. Scheme: An interpreter for ex~ended lambda calculus. Artif. Intell. Memo 349. MIT, Cambridge, Mass., Dec. 1975.]]
[18]
WAND, M. Continuation-based multiprocessing. In Con/erence Record o/the 1980 Lisp Conference (Stanford, Calif., Aug. 25-27, 1980). ACM, New York, 1980, pp. 19-28.]]

Cited By

View all

Recommendations

Reviews

Ronald Thomas House

The idea of continuations is old and basically amounts to marking a point during program execution and returning to that state later in execution. The authors discuss first-class continuations, which can be treated like any other data object and freely passed to any point in the program. This facility requires heap-based storage. Using Scheme (a Lisp dialect with such continuations), they show how procedures can be created that implement regulated continuation-based control structures, of which the most ambitious is wind-unwind, which provides automatic execution of cleanup code (a postlude) on exit from an inner scope and similar execution of setup logic (a prelude) on reentry. This is a valuable contribution, since the unrestrained first-class continuation is undoubtedly beyond mastery by the average programmer. The logic presented for all the ideas discussed could be used by a Scheme programmer, but the main value of the paper is probably for language designers, who may be considering these structured features for inclusion in a language, and implementers, who should find the code to be an invaluable source of information. This is a comprehensive and useful paper.

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 9, Issue 4
Oct. 1987
213 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/29873
  • Editor:
  • Susan L. Graham
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 October 1987
Published in TOPLAS Volume 9, Issue 4

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)60
  • Downloads (Last 6 weeks)8
Reflects downloads up to 30 Aug 2024

Other Metrics

Citations

Cited By

View all

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media