Dynamic variables

D. R. Hanson, T. A. Proebsting

Research output: Contribution to conferencePaper

9 Scopus citations

Abstract

Most programming languages use static scope rules for associating uses of identifiers with their declarations. Static scope helps catch errors at compile time, and it can be implemented efficiently. Some popular languages-Perl, Tcl, TeX, and Postscript-offer dynamic scope, because dynamic scope works well for variables that "customize" the execution environment, for example. Programmers must simulate dynamic scope to implement this kind of usage in statically scoped languages. This paper describes the design and implementation of imperative language constructs for introducing and referencing dynamically scoped variables-dynamic variables for short. The design is a minimalist one, because dynamic variables are best used sparingly, much like exceptions. The facility does, however, cater to the typical uses for dynamic scope, and it provides a cleaner mechanism for so-called thread-local variables. A particularly simple implementation suffices for languages without exception handling. For language s with exception handling, a more efficient implementation builds on existing compiler infrastructure. Exception handling can be viewed as a control construct with dynamic scope. Likewise, dynamic variables are a data construct with dynamic scope.

Original languageEnglish (US)
Pages264-273
Number of pages10
DOIs
StatePublished - Jan 1 2001
EventACM SIGPLAN'01 Conference on Programming Language Design and Implementation (PLDI) - Snowbird, UT, United States
Duration: Jun 20 2001Jun 22 2001

Other

OtherACM SIGPLAN'01 Conference on Programming Language Design and Implementation (PLDI)
CountryUnited States
CitySnowbird, UT
Period6/20/016/22/01

ASJC Scopus subject areas

  • Software

Fingerprint Dive into the research topics of 'Dynamic variables'. Together they form a unique fingerprint.

  • Cite this

    Hanson, D. R., & Proebsting, T. A. (2001). Dynamic variables. 264-273. Paper presented at ACM SIGPLAN'01 Conference on Programming Language Design and Implementation (PLDI), Snowbird, UT, United States. https://doi.org/10.1145/378795.378857