help-gnu-emacs
[Top][All Lists]
Advanced

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

Lambdas for beginners broken - help, please


From: Eduardo Ochs
Subject: Lambdas for beginners broken - help, please
Date: Wed, 24 Jul 2024 05:43:38 -0300

Hi all,

I always present Emacs to beginners starting by Lisp, with this
approach:

  http://anggtwu.net/eev-intros/find-eev-quick-intro.html#2
  http://anggtwu.net/eev-intros/find-eev-quick-intro.html#3

and when I show Emacs to friends who are programmers - in some sense -
and they like it, I usually tell them to read my short tutorial on
elisp as soon as possible, and try its examples:

  http://anggtwu.net/eev-intros/find-elisp-intro.html

But one or two days ago I compiled a current Emacs from git, and I saw
that many functions in eev don't work anymore. Apparently the problem
is here:

  (info "(elisp)Function Cells")
  https://www.gnu.org/software/emacs/manual/html_node/elisp/Function-Cells

Now the htmlized version of the manual says this,

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> (lambda (n) (+ n 2))

the current info manual says this,

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> #f(lambda (n) [t] (+ n 2))

and if I run the code myself(*) I get this:

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> #[(n) ((+ n 2)) nil]

I have lots of code and lots of tutorials that rely on the idea that
when lexical binding is nil then after a

  (defun bar (n) (+ n 2))

the value of

  (symbol-function 'bar)

will be a lambda expression in this sense,

  (info "(elisp)Lambda Expressions")
  http://www.gnu.org/software/emacs/manual/html_node/elisp/Lambda-Expressions

_as a list_, not as a "function object that is not a list".

What do I need to read to learn how to adapt my code to the new
behavior of Emacs?

  Thanks in advance...
    Eduardo Ochs
    http://anggtwu.net/#eev


(*): I tried both the standard `C-x C-e' and my favorite way of
calling it, that uses the key `M-e' and `(eval <obj> t)'.



reply via email to

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