On Wed, 13 Oct 2004, Gerhard Schellhorn wrote:

> > How do you do that check? Please do not tell me you stack such checks one 
> > onto another to generate essentially a compiled linear search if you add 
> > more and more rewrite rules.
> 
> No, basically I have implemented pattern matching for
> the left hand sides of rewrite rules (like compilers for 
> functional languages with pattern matching do).

Oh, that's very nice indeed!

> > (funcall (symbol-function ...)). As this is machine-generated 
> > code anyway, you will not have to type it every time
> 
> Typing it is not the point. For debugging purposes
> I can just pretty print the current code. 
> Replacing all calls to functions with
> funcall's to the symbol-value would make it much
> harder to read, and I would have to find

Hm, how about a corresponding "symcall" defmacro? You cannot entirely get 
rid of it, I fear, but this is perhaps the best you can get - unless you 
start defining your own language which is compiled to lisp first, then to 
machine code.

> all the many places in the code which just call a function
> to change them. That wouldn't be much fun on code
> that runs without problems since many years and
> with many Lisps (Lucid, Allegro, Clisp, Lispworks).

The fact that it runs on many Lisp systems does not mean it's Lisp. There 
is code which compiles perfectly well with gcc (and even icc), but it's 
not C, it's gcc-language.

I won't call this an intrinsically bad thing - at least, the Linux kernel 
to my understanding isn't C as well, but GCC-language, and I must admit to 
occasionally write CMUCL code instead of Lisp code. But you must be well 
aware when you write Lisp code and when not.

> > (defun f (funcall (symbol-value 'f)))
> 
> This should be
> 
> (defun f (x) (funcall (symbol-value 'f) x))

Sure. Got me. :-)

> and your proposal means that one call to (symbol-function 'f)
> is replaced by two successive calls to (symbol-function 'f) and
> to (symbol-value 'f)?

My proposal is to put the run-time-compiled function in the symbol's 
SYMBOL-VALUE slot, and define the corresponding function in such a way 
that it just evaluates the symbol-value value. That way, you can at 
least still use (f x) at the command line, with very minimal overhead.

I would still generate (funcall (symbol-value ...)) code.

-- 
regards,               [EMAIL PROTECTED]              (o_
 Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)

Reply via email to