[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[spr4691] behaviour of symbol-function



>> Is there any substitute for symbol-function and fdefinition which
>> will return (for user-defined functions) the code as in the previous
>> behavior of symbol-function?  I realize that you can pains-takingly
>> inspect for it but I would prefer a better way.  Thanks.

I'm not sure whether your message indicates you know about the change
in status on this matter, so here's the official position:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Allegro is in compliance with the X3J13 committee's work:

(1) (symbol-function 'foo) is required to return a function.
    (CLtLII page 119)

(2) A cons is never a function.
    (CLtLII page 36)

As it happens, there is no portable way in common lisp to retrieve the
source for a function, even if the function is interpreted.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

However, if you want to use an Allegro-specific mechanism, you can resort
to excl::fn_code (for interpreted functions), as in:

user(1): (defun foo (x) (car x))
foo
user(2): (excl::fn_code (symbol-function 'foo))
(lambda (x) (block foo (car x)))
user(3): 

The same applies to fdefinition.  Hope this helps!

						 George Jacob
					--------------------------------
					  INTERNET: georgej@franz.com
					  UUCP:     uunet!franz!georgej
					--------------------------------