next up previous contents
Next: Introspection and Transparent Functions Up: Methods Previous: Configuring methods

Methods as functions

We mentioned at the beginning of § 2.3 that methods can be conceived of as functions the parameters of which are passed by labels. In particular we can consider that functions work upon an array of parameters where subterms are selected by numeric positions in that array. The feature term representation of methods is like what are extendable records compared to static arrays. Namely, instead of selecting subterms by numeric position we use labels (called feature names), and instead of having a fixed number subterms, we can introduce new subterms simply introducing a new feature name with a subterm (a value reference or a method for that feature). Finally, in order to express references (variable binding) we use path references.

This representation offers several advantages. First, evaluation is not strict, since parameters can be passed in any order to a method by means of adding a feature when refining a method. This same process supports partial evaluation of methods in a similar way currying does for functions. Lambda abstraction is also achieved in refinement when introducing a path reference to a new label. For instance, Example 2.9 is equivalent to a lambda abstraction since it introduces a new named variable person that is to be bound later. Function application is usually a term that binds its free variables followed by a reduction process. In Noos methods this process is separated in two processes. First, free variables can be bound separately and in any order by means of one or several refinement steps. Second, when a method description is refined in a position where it is the method of a feature--indicated by the double parenthesis--we say the method is closed and the reduction process can take place. In summary, refinement plays the role of introducing and bounding variables and only closed methods can be evaluated. Chapter 3 examines this issue at a deeper level.




next up previous contents
Next: Introspection and Transparent Functions Up: Methods Previous: Configuring methods

Enric Plaza
Thu Jan 23 11:36:28 MET 1997