[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#52063: 28.0.60; Confusing presentation of lambda
From: |
Stefan Monnier |
Subject: |
bug#52063: 28.0.60; Confusing presentation of lambda |
Date: |
Wed, 24 Nov 2021 14:06:37 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>> >> > But perhaps others have other opinions here?
>> >> Compile your code and the problem goes away (because you'll never see
>> >> (lambda ...) or (closure ...) values, they'll all be
>> >> byte-code-functions instead ;-)
>> > I don't want to compile my .emacs.
>> > Any other words of wisdom before I write this off as another annoyance
>> > of lexical-binding, and take care to disable that wherever I can?
>> The other word of wisdom is:
>> Don't add lambdas to hook. Always name those functions.
> So this issue is specific to hooks?
No, but in 99% of the cases you won't actually *see* a function value
(unless you specifically go looking for it, e.g. with `symbol-function`).
One of the cases where you are more likely to see one is if you look at
the value of a hook.
> I thought add-hook is just a fancy way of consing a list,
It is.
> but you seem to say that it has some side effects that other
> constructs don't?
Not really, no.
> IOW, would manually consing a list with a lambda-function produce the
> same results,
Yes.
> or would it leave the lambda-function intact?
No. A *value* of the form (lambda ARGS . BODY) is a (non-compiled)
dynamically-scoped function. Non-compiled statically-scoped function
values use the form (closure ENV ARGS . BODY...).
So you'll only get a value of the form (lambda ARGS . BODY) if you use
the dynamically scoped dialect of ELisp (or if you manually create such
a list, e.g. with '(lambda ...) or `(lambda ...) or (list 'lambda ...),
etc...).
Stefan
- bug#52063: 28.0.60; Confusing presentation of lambda, (continued)
- bug#52063: 28.0.60; Confusing presentation of lambda, Eli Zaretskii, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Lars Ingebrigtsen, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Eli Zaretskii, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Lars Ingebrigtsen, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Eli Zaretskii, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Lars Ingebrigtsen, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Stefan Monnier, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Eli Zaretskii, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Stefan Monnier, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Eli Zaretskii, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda,
Stefan Monnier <=
- bug#52063: 28.0.60; Confusing presentation of lambda, Eli Zaretskii, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Stefan Monnier, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Eli Zaretskii, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Stefan Monnier, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Jim Porter, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Jim Porter, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Eduardo Ochs, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Filipp Gunbin, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Stefan Monnier, 2021/11/24
- bug#52063: 28.0.60; Confusing presentation of lambda, Filipp Gunbin, 2021/11/24