all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pascal Bourguignon <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: is this a bug?
Date: Fri, 28 Mar 2008 23:10:19 +0100	[thread overview]
Message-ID: <87tziqpkj8.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: ur6du1quj.fsf@tiscali.co.uk

David Roderick <angel_ov_north@tiscali.co.uk> writes:

> 9.2.4 Symbol Function Indirection
> ---------------------------------
>
>  -- Function: indirect-function function &optional noerror
>      This function returns the meaning of FUNCTION as a function.  If
>      FUNCTION is a symbol, then it finds FUNCTION's function definition
>      and starts over with that value.  If FUNCTION is not a symbol,
>      then it returns FUNCTION itself.
>
>      This function signals a `void-function' error if the final symbol
>      is unbound and optional argument NOERROR is `nil' or omitted.
>      Otherwise, if NOERROR is non-`nil', it returns `nil' if the final
>      symbol is unbound.
>
>      It signals a `cyclic-function-indirection' error if there is a
>      loop in the chain of symbols.
>
>      Here is how you could define `indirect-function' in Lisp:
>
>           (defun indirect-function (function)
>             (if (symbolp function)
>                 (indirect-function (symbol-function function))
>               function))
>
>
> shouldn't this be? 
>
>           (defun indirect-function (function)
>             (if (symbolp function)
>                 (symbol-function function)

That wouldn't be the same thing.

(setf (symbol-function 'c) (symbol-function 'car)
      (symbol-function 'b) (symbol-function 'c)
      (symbol-function 'a) (symbol-function 'b))

(indirect-function 'a) --> #<subr car> ; is more usefull than b

>               (function))

Is invalid, function is a special operator that takes one argument, a
symbol or a lambda form.


Note that in emacs lisp, function == quote, but is a hint for the
compiler that the argument of function shall be compiled.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

HANDLE WITH EXTREME CARE: This product contains minute electrically
charged particles moving at velocities in excess of five hundred
million miles per hour.


  reply	other threads:[~2008-03-28 22:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-28 21:27 is this a bug? David Roderick
2008-03-28 22:10 ` Pascal Bourguignon [this message]
2008-03-29  3:02 ` Barry Margolin
2008-04-07 20:18 ` is this incorrect code in elisp manual? David Roderick
  -- strict thread matches above, loose matches on Subject: below --
2009-09-16 22:31 Is this a bug? Leo
2012-09-27  9:36 Is this a bug ? horse_rivers
2012-09-27 17:12 ` Eli Zaretskii
2012-09-28  0:27   ` horse_rivers
2012-09-28  7:30     ` Eli Zaretskii
2013-12-02 13:51 Is this a bug? Perry Smith
2013-12-03  8:46 ` Tassilo Horn
2013-12-03  9:16 ` Tassilo Horn
2022-06-17 17:16 hput

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tziqpkj8.fsf@thalassa.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.