[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Declaring a local dynamic variable?
From: |
Stefan Monnier |
Subject: |
Re: Declaring a local dynamic variable? |
Date: |
Tue, 24 Sep 2013 17:40:41 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> CL has the (declare (special var…)) declaration for that.
And cl.el does provide some support for it, indeed.
> (defun f ()
> (declare (special var))
> (print var))
Since Elisp's `defun' macro also supports `declare', we could provide
support for the above, tho you can just as well write it as
(defun f ()
(defvar var)
(print var))
> (let ((var 42))
> (declare (special var))
> (f)))
Supporting for byte-compiled files would be fairly easy, but when
interpreting code it it would be very costly, so Elisp does not
support this. With Emacs-24.3's eager macro-expansion the cost would be
a lot more reasonable, but I still don't find it worth the trouble.
Instead you have to write:
(defvar var)
(let ((var 42))
(f)))
-- Stefan
- Re: Declaring a local dynamic variable?, (continued)
- Re: Declaring a local dynamic variable?, Joost Kremers, 2013/09/23
- Message not available
- Re: Declaring a local dynamic variable?, Joost Kremers, 2013/09/23
- Re: Declaring a local dynamic variable?, Barry Margolin, 2013/09/23
- Re: Declaring a local dynamic variable?, Joost Kremers, 2013/09/23
- Re: Declaring a local dynamic variable?, Barry Margolin, 2013/09/23
- Re: Declaring a local dynamic variable?, Joost Kremers, 2013/09/25
Re: Declaring a local dynamic variable?, Pascal J. Bourguignon, 2013/09/22
Message not available
- Re: Declaring a local dynamic variable?, Joost Kremers, 2013/09/23
- Re: Declaring a local dynamic variable?, Joost Kremers, 2013/09/25
- Re: Declaring a local dynamic variable?, Stefan Monnier, 2013/09/25
- Message not available
- Re: Declaring a local dynamic variable?, Barry Margolin, 2013/09/25
- Re: Declaring a local dynamic variable?, Stefan Monnier, 2013/09/25
- Re: Declaring a local dynamic variable?, Andreas Röhler, 2013/09/27
- Re: Declaring a local dynamic variable?, Stefan Monnier, 2013/09/27