gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] Re: tertium non datur: ANSI help


From: jeff
Subject: Re: [Gcl-devel] Re: tertium non datur: ANSI help
Date: Thu, 13 Apr 2006 17:12:26 +0100
User-agent: Internet Messaging Program (IMP) H3 (4.0.4)

Quoting Camm Maguire <address@hidden>:

Greetings!

Robert Boyer <address@hidden> writes:

Can you explain to me what the ANSI standard is talking
about here?

   A call is a safe call if each of the following is either safe code
or system code (other than system code that results from macro expansion of
   programmer code):

   * the call.
   * the definition of the function being called.
   * the point of functional evaluation

Just an idea -- perhaps the last here means safely extracting the
function from the function designator, e.g. 'foo, #'foo. '(setf foo),

http://www.lisp.org/HyperSpec/Body/glo_f.html#functional_evaluation

 functional evaluation n. the process of extracting a functional value
 from a function name or a lambda expression. The evaluator performs
 functional evaluation implicitly when it encounters a function name
 or a lambda expression in the car of a compound form, or explicitly
 when it encounters a function special form. Neither a use of a symbol
 as a function designator nor a use of the function symbol-function
 to extract the functional value of a symbol is considered a functional
 evaluation.

So maybe this is an example:

 (flet ((f () 1))  ; definition
    (let ((a #'f)) ; functional evaluation
      (funcall a))); call

Or, if you don't like a funcall as the call:

 (flet ((f () 1))  ; definition
   (setf (symbol-function 'g) #'f) ; functional eval of f

 (g) ; call

The reason for including the functional evaluation is probably
that the FUNCTION special form is allowed to construct a
function object.  That is, it doesn't have to simply retrieve
an existing object.

When I looked for information on this issue, one thing that
turned up was my own list of "Common Lisp pitfalls" written
years ago, though for some reason my own copy isn't the ref
google produced.  Anyway see

 http://www.aiai.ed.ac.uk/~jeff/lisp/cl-pitfalls

the section on "Function vs eq".

I said there that

 A FUNCTION special form may construct a new function object each
 time it's evaluated, and therefore even (flet ((f ...)) (eq #'f #'f))
 can return false.

The reason I mention this is that (according to what I wrote
then) the evidence for this is fairly obscure: one sentence
in CLtL and "e-mail discussion within X3J13", rather than
anything in the standard.

-- Jeff





reply via email to

[Prev in Thread] Current Thread [Next in Thread]