emacs-devel
[Top][All Lists]
Advanced

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

Re: Distinguishing `consp` and `functionp`


From: Eli Zaretskii
Subject: Re: Distinguishing `consp` and `functionp`
Date: Mon, 29 Jan 2024 14:45:57 +0200

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: emacs-devel@gnu.org
> Date: Sun, 28 Jan 2024 16:27:27 -0500
> 
> > Maybe I'm missing something, but I always thought that having code and
> > data indistinguishable is one of the strong sides of Lisp.  Are we now
> > going to make this advantage smaller, by deprecating the use of lists
> > to represent functions?
> 
> A function *value* contains code in some representation that depends on
> lots of factors.  In practice most function values in most Lisp
> implementations are not just plain lists but are somewhat opaque data.
> This is also the case in ELisp where most function values are actually
> compiled either as bytecode or as native code: we do have tools to look
> inside, but they're definitely not plain old lists.
> 
> The "code and data indistinguishable" is something that usually refers
> to various things:
> 
> - the source code (which gives us powerful macros).
> - the availability of `read`able print representations of functions (tho
>   that doesn't apply to native-compiled functions, sadly).
> - the ability to embed any value (including a function) into source code
>   via `quote`.
> 
> Those three are mostly independent from each other (and are not affected
> by my patch).  And if you ask other people, they may give you different
> answers.
> 
> But looking inside a function *value* (i.e. what is returned at run time
> by the evaluation of `#'(lambda ...)`) with `car/cdr` is rarely
> supported in the Lisp world.

So your patch only affects "looking inside a function value"?

If so, what are the situations where a Lisp program in Emacs would
like or need to "look inside a function value"?



reply via email to

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