Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decvax.UUCP Path: utzoo!linus!security!genrad!decvax!betz From: betz@decvax.UUCP (David Betz) Newsgroups: net.lang.lisp Subject: LISP evaluator question Message-ID: <281@decvax.UUCP> Date: Tue, 15-Nov-83 17:48:24 EST Article-I.D.: decvax.281 Posted: Tue Nov 15 17:48:24 1983 Date-Received: Wed, 16-Nov-83 01:38:28 EST Organization: DEC UNIX Engineering Group Lines: 45 Does anyone know the reasoning behind why LISP keeps a separate function value cell for each atom? Why isn't the normal value cell used to store function values? If the normal value cell were used, the evaluator could just 'eval' the first element of a form in order to find the function being applied. I used this approach in my XLISP language. The reason that I needed to 'eval' the first element of a form was that I wanted to be able to handle normal function application and object oriented message passing in a form. For instance: (fun arg1 arg2) ; call function 'fun' with arguments 'arg1' ; and 'arg2' (obj msg arg1 arg2) ; send 'obj' the message 'msg' with arguments ; 'arg1' and 'arg2' The problem comes when the object in a message is itself an expression: ((obj1 msg1 arg1) msg2 arg2) ; first send the 'obj1' the message 'msg1' ; with argument 'arg1'. ; then take the value of that expression ; and send it the message 'msg2' with ; argument 'arg2' If 'eval' doesn't evaluate the first element of a form, the (obj1 msg1 arg1) message is never evaluated. I solved this problem by storing the function value of an atom in the same place as the normal value. Then whenever I evaluate a form, I first evaluate the first element to find out if it is a function or an object. If it is a function, I do a normal function call. If it is an object, I send the object a message. What I am wondering is whether I have violated a basic principle of LISP in changing the evaluator to work in this way. Why is it important to keep function values separate from normal values? Is this convention just historical? If the answer to this question is obvious, please forgive my ignorance. Thanks, David Betz decvax!betz