kers@hplb.CSNET (Christopher Dollin) (09/16/87)
Hi I am afraid that Eric Lee Green has become confused, mostly (I suspect) by some of Lisp's more obscure design decisions. Eric is correct in saying that evaluating a symbol with a procedure value (ie a procedure as its value) should return the value of the data cell of the symbol; indeed, in both Scheme and Vulgar Lisp, this is exactly what happens (the difference is just in the way those values are obtained). Eric then goes on to say: But wait, how do we actually execute the procedure! Lisp does this with hand-waving and head-nodding, by making programs consist of lists, the first element of which is always assumed to be a procedure which needs executing. In other words, we are introducing "syntactic sugar" to work around the problem of having to explicitly indicate what we wish to be executed. Well ... NO. Irrespective of language (by and large), we need some way of indicating that a (procedure) value is to be APPLIED rather than just USED (eg passed as an argument, delivered as a result). The Lisp convention is to represent programs as lists (for the inconvenience of the user) and apply the value found at the head of such a list be applied to the arguments which are the values found in the rest of the list. This is NOT syntactic sugar; syntactic sugar means constructs which are nice to write but can be re-expressed within the language without the construct, and Lisp has precious few of them. It is true that (defun urgh (junk foo) (blah1) (blah2)) and (+ a b) have the same form, although in the "defun" the arguments are literal data and in the "+" they are expressions to be evaluated. That's because the "defun" is SYNTAX; it defines the shape of the language, and is interpreted at compile-time (loosely speaking) where the values being manipulated are parse-trees. The fact that they look the same is a consequence of a Lisp design decision that application (whether of a run-time procedure or a syntactic processor) is indicated in the same way, viz, by the list notation. So, to answer the questions ... Can this dichotomy between value and execution be mended for procedure-objects without hand-waving? Yes. The distinction between syntactic processing (== compile-time == pre-process time) and execution (== evaluation == run-time) is not hand-waving, and has little to do with procedure values. Would requiring literal data to be quoted be too big an imposition upon the programmer, and would it be worth the gain in expressiveness? (just imagine macros without the mess). Yes it would, and it wouldn't work; you can't express quote without drawing the distinction between compile-time and run-time. No gain in expressiveness would result. [It wouldn't make macros any less horrible, either]. The kludgy scheme doesn't help, either. For example, it requires the system to know which symbols are procedure names in advance - the very thing that the Lisp syntax avoids (although Vulgar Lisp persists in using the bizzare two-value system for symbols). In fact Scheme does NOT distinguish the evaluation of a procedure-valued symbol from that of a non-procedure-valued object. What is DOES distinguish is the use of an apparantly function-calling form, viz (f x1 x2 ... xn) where the symbol "f" is one of its built-in syntactic constructs (or a macro in those Schemes with macros in them). And this, as I implied above, is ESSENTIAL - in any language. Hope this helps, Regards, Kers PS Wow - a whole reply on this topic and I haven't said how much nicer Pop is than Lisp! (Using KMail 10-Apr-87 (Kers))