[Prev][Next][Index][Thread]
Re: Why Prolog and CBV?
Date: Wed, 13 Nov 91 10:34:08 GMT
X-Comment1: #############################################################
X-Comment2: # uk.ac.glasgow.cs has changed to uk.ac.glasgow.dcs #
X-Comment3: # If this address does not work please ask your mail #
X-Comment4: # administrator to update your NRS & mailer tables. #
X-Comment5: #############################################################
... suggests that there is no complete deterministic
strategy for lambda calculus. There is: call-by-name. But
hardly anybody really uses it. ... (John Mitchell)
Ahem!
Quite a few of us use this strategy. It is the basis of Haskell, which
has separate implementations at Glasgow, Yale, Chalmers, and Oxford,
and of Miranda, a commercial product. (Miranda's so commercial that I
am obliged to say it is a trademark of Research Software Limited.)
The best compilers for lazy languages produce code that compares in
speed with code from the best compilers for Standard ML, Scheme, or C.
This is not meant to inspire a debate about benchmarks, but simply to
counter the canard that lazy languages are hopelessly inefficient.
It seems to me that the main justification for Standard ML and Scheme
to use the call-by-value strategy is that this fits better with an
occasional use of `impure' operations, such as assignment, exception
handling, or call-with-current-continuation. It is these that are
incompatible with call-by-name, not the desire for efficiency.
Some of my recent research has concerned the use of monads to integrate
such features into pure call-by-name languages. See "Comprehending
monads" in Lisp & FP '90, or "The essence of functional programming"
in POPL '92. But this is very much work in progress.
For the time being, those with a hankering for assignment or exceptions
should stick to Standard ML; otherwise, Haskell should suit you well.
Cheers, -- Phil
-----------------------------------------------------------------------
Philip Wadler wadler@dcs.glasgow.ac.uk
Department of Computing Science tel: +44 41 330 4966
University of Glasgow fax: +44 41 330 4913
Glasgow G12 8QQ, SCOTLAND