Beyond static and dynamic scope

Traditional treatment of scoping in programming languages considers two opposite semantics: static scoping, where the scope of a binding is a block of program text, and dynamic scoping, where a binding is in effect during the whole reduction of an expression to a value. Static scoping and dynamic scoping are however but two points in the design space of scoping mechanisms. As a result, most proposed language mechanisms that rely on some notion of scoping, such as variable bindings of course, but also more exotic ones like aspects and mixin layers, adopt either one or the other semantics. As it turns out, these two semantics are sometimes too extreme, and a mixture of both is needed. To achieve this, language designers and/or programmers have to resort to ad hoc solutions. We present a general scoping model that simply expresses static and dynamic scoping, and that goes further by allowing fine-grained exploration of the design space of scoping. The model, called scoping strategies, gives precise control over propagation and activation of language mechanisms. While we have already studied it for aspects, we hereby show that the model is not restricted to aspects, by treating in depth its application to the most standard kind of adaptation: variable bindings. We also briefly discuss its application to mixin layers, and program monitoring. We believe that research in programming language constructs can benefit from a more flexible notion of scoping that goes beyond the static/dynamic dichotomy.

[1]  Mitchell Wand,et al.  Reification: Reflection without metaphysics , 1984, LFP '84.

[2]  Brian Cantwell Smith,et al.  Reflection and semantics in LISP , 1984, POPL.

[3]  Matthias Felleisen,et al.  The theory and practice of first-class prompts , 1988, POPL '88.

[4]  Matthias Felleisen,et al.  On the Expressive Power of Programming Languages , 1990, European Symposium on Programming.

[5]  Martín Abadi,et al.  Explicit substitutions , 1989, POPL '90.

[6]  Luc Moreau,et al.  A Syntactic Theory of Dynamic Binding , 1997, High. Order Symb. Comput..

[7]  Cristina V. Lopes,et al.  Aspect-oriented programming , 1999, ECOOP Workshops.

[8]  William G. Griswold,et al.  An Overview of AspectJ , 2001, ECOOP.

[9]  Mitchell Wand A Semantics for Advice and Dynamic Join Points in Aspect-Oriented Programming , 2001, SAIG.

[10]  Hidehiko Masuhara,et al.  A Compilation and Optimization Model for Aspect-Oriented Programs , 2003, CC.

[11]  Alexandre Bergel,et al.  Classboxes: A Minimal Module Model Supporting Local Rebinding , 2003, JMLC.

[12]  James Gosling,et al.  The Java Language Specification, 3rd Edition , 2005 .

[13]  Robert Hirschfeld,et al.  Language constructs for context-oriented programming: an overview of ContextL , 2005, DLS '05.

[14]  Shriram Krishnamurthi,et al.  Semantics and scoping of aspects in higher-order languages , 2006, Sci. Comput. Program..

[15]  Todd D. Millstein,et al.  Statically scoped object adaptation with expanders , 2006, OOPSLA '06.

[16]  Amr Sabry,et al.  Delimited dynamic binding , 2006, ICFP '06.

[17]  Mira Mezini,et al.  An Overview of CaesarJ , 2006, LNCS Trans. Aspect Oriented Softw. Dev..

[18]  Éric Tanter,et al.  Processing , 1988 .

[19]  Gang Yu,et al.  Adding delimited and composable control to a production programming environment , 2007, ICFP '07.

[20]  Oscar Nierstrasz,et al.  A Calculus of Evolving Objects , 2008, Sci. Ann. Comput. Sci..

[21]  Éric Tanter Expressive scoping of dynamically-deployed aspects , 2008, AOSD.

[22]  Rémi Douence,et al.  Expressive scoping of distributed aspects , 2009, AOSD '09.

[23]  Éric Tanter,et al.  Back to the Future: Omniscient Debugging , 2009, IEEE Software.

[24]  Dave Clarke,et al.  How should context-escaping closures proceed? , 2009, COP@ECOOP.