[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: run-with-timer does not display message
From: |
Stefan Monnier |
Subject: |
Re: run-with-timer does not display message |
Date: |
Mon, 21 Jul 2014 09:26:32 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> This specific behaviour is what makes lexical binding special: Capturing
> *lexical variables* in closures, as opposed to capturing values (by
> backquotes)
While this is used occasionally, most uses of lexical-scoping don't care
about this "feature". E.g. *all* uses of lexical scoping in the ML
family of languages (which don't have the equivalent of `setq').
> or just using dynamic variables. You cannot easily and
> efficiently emulated this behaviour with macros and backquotes.
As mentioned in another message, the byte-compiler faces the same
problem. And the way it solves it can be applied to backquoted lambdas
just as easily: just replace the variable with a cons cell whose `car'
contains the value.
IOW the byte-compiler will generate almost 100% exactly the same code for
(let ((i 10))
(setq f-lexical (lambda () i))
(setq i 20))
as for
(let ((i (list 10)))
(setq f-lexical (lambda () (car i)))
(setcar i 20))
and of course you can get the same result with backquote:
(let ((i (list 10)))
(setq f-lexical `(lambda () (car ',i)))
(setcar i 20))
-- Stefan
- Re: run-with-timer does not display message, (continued)
- Re: run-with-timer does not display message, Stefan Monnier, 2014/07/18
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/18
- Re: run-with-timer does not display message, Sebastian Wiesner, 2014/07/19
- Re: run-with-timer does not display message, Eli Zaretskii, 2014/07/19
- Re: run-with-timer does not display message, Stefan Monnier, 2014/07/19
- RE: run-with-timer does not display message, Drew Adams, 2014/07/19
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/19
- Re: run-with-timer does not display message, Stefan Monnier, 2014/07/19
- Lexical and Dynamic Scope, Robert Thorpe, 2014/07/19
- Re: run-with-timer does not display message, Sebastian Wiesner, 2014/07/20
- Re: run-with-timer does not display message,
Stefan Monnier <=
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/20
- Re: run-with-timer does not display message, Stefan Monnier, 2014/07/21
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/21
- Re: run-with-timer does not display message, Stefan Monnier, 2014/07/24
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/20
- RE: run-with-timer does not display message, Drew Adams, 2014/07/20
- Message not available
- dynamic and lexical scope, attempted summary with example (was: Re: run-with-timer does not display message), Emanuel Berg, 2014/07/20
- Re: dynamic and lexical scope, attempted summary with example, Thien-Thi Nguyen, 2014/07/21
- Re: dynamic and lexical scope, attempted summary with example, Thorsten Jolitz, 2014/07/21
- Message not available
- Re: dynamic and lexical scope, attempted summary with example, Emanuel Berg, 2014/07/21