The Community for Technology Leaders
Green Image
Issue No. 06 - June (1987 vol. 13)
ISSN: 0098-5589
pp: 636-642
F.W. Burton , Department of Computer Science, University of Utah
Call-by-need is widely regarded as an optimal (to within a constant factor) parameter passing mechanism for functional programming languages. Except for certain special cases involving higher order functions, call-by-need is optimal with respect to time. However, call-by-need is far from optimal with respect to space. We examine some of the space problems which can arise with call-by-need and other parameter passing mechanisms. A simple optimizing technique, based on work by Mycroft [1], is proposed. If it can be determined both that an expression must be evaluated eventually and that the evaluation of the expression is likely to reduce the space required by the program, then the evaluation is performed as soon as possible. This optimization does not result in optimal space performance in all cases. However, in most of the common cases where call-by-need causes a problem the proposed optimization avoids the problem. Since our technique is not always optimal, it is likely to be of greatest advantage in situations where efficiency is important but not critical. For example, functional languages with call-by-name semantics are increasingly being used as specification languages. Since such a specification is runnable, it may be used as a prototype. This makes it possible to experiment with a program and refine the specification before the implementation in the target language is started.
strictness, Call-by-need, functional programming, optimization, space

H. Oberhauser, D. Maurer, F. Burton and R. Wilhelm, "A Space-Efficient Optimization of Call-by-Need," in IEEE Transactions on Software Engineering, vol. 13, no. , pp. 636-642, 1987.
92 ms
(Ver 3.3 (11022016))