[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:34:38 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
>>> If I purposefully use a local dynamic variable as in:
>> Use (defvar my-counter) at the file's top-level to indicate that this
>> variable is used in a way that relies on dynamic scoping.
> Is that preferable to putting the defvar inside the function definition
> where the variable is used dynamically?
Depends, but usually I recommend you put the defvar at top-level,
otherwise you have to put it at various places (everywhere it's
let-bound and everywhere where it's referenced).
Also, I strongly recommend those dynamically-scoped vars use a package
prefix, just like global variables (since they are fundamentally global
variables).
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
Message not availableRe: Declaring a local dynamic variable?, Barry Margolin, 2013/09/27
Re: Declaring a local dynamic variable?, Andreas Röhler, 2013/09/27