[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51695: 29.0.50; lexical scope closure, interactive spec byte compile
From: |
Emanuel Berg |
Subject: |
bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue |
Date: |
Wed, 10 Nov 2021 05:13:25 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>> #+begin_src emacs-lisp
>> (let* ((data-item 1)
>> (more-data 2))
>> (defalias 'echo-data--interactive
>> (lambda ()
>> (list (read-number "number: " (or data-item more-data)))))
>> (declare-function echo-data--interactive test) ;defun was not top-level
>> (defun echo-data (&optional data)
>> (interactive (echo-data--interactive))
>> (message "data: %s" (or data data-item)) ))
>> #+end_src
>
> Thanks, I wrote this to illustrate the situation but
> interesting nonetheless, I don't think I've seen `defalias'
> to a `lambda' before and also didn't think of putting
> `declare-function' within the `let' body ... practical.
It works.
Both the aliases and the functions have to be
`declare-function'ed for the byte compiler.
`defalias' and `lambda' BTW, isn't that an anonymous function
with a name ... maybe an ordinary function makes more sense
there, especially since `declare-function' has to be used?
Or why a lambda?
--
underground experts united
https://dataswamp.org/~incal
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue, Emanuel Berg, 2021/11/08
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue, Eli Zaretskii, 2021/11/09
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue, Stefan Monnier, 2021/11/09
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue, Michael Heerdegen, 2021/11/09
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue, Emanuel Berg, 2021/11/09
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue,
Emanuel Berg <=
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue, Michael Heerdegen, 2021/11/10
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue, Emanuel Berg, 2021/11/10
- bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue, Michael Heerdegen, 2021/11/10