next up previous
Next: Further Information Up: New Directions Previous: Revised Graphics Model

Formulas as Closures

One final area that requires some attention is the representation of statistical models. Currently there is no analogue to the formula data used in S [2]. Such a mechanism needs to be added. But there is a weakness to the S mechanism that should not be duplicated. S code for fitting models described by formulas contains rather awkward and brittle constructs to locate the data a formula refers to. Since formulas are typically created by a user in a context where the data are available, it seems natural to use the concept of lexical scope and make a formula capture the relevant portion of the environment in which it is created, thus acting like a closure. This environment would then provide the default data values for fitting functions.



Luke Tierney
5/27/1998