This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
June 1987 (vol. 13 no. 6)
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.
Index Terms:
strictness, Call-by-need, functional programming, optimization, space
Citation:
F.W. Burton, D. Maurer, H.-G. Oberhauser, R. Wilhelm, "A Space-Efficient Optimization of Call-by-Need," IEEE Transactions on Software Engineering, vol. 13, no. 6, pp. 636-642, June 1987, doi:10.1109/TSE.1987.233474
Usage of this product signifies your acceptance of the Terms of Use.