[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Declaring a local dynamic variable?
From: |
Joost Kremers |
Subject: |
Declaring a local dynamic variable? |
Date: |
20 Sep 2013 09:52:17 GMT |
User-agent: |
slrn/pre1.0.0-18 (Linux) |
Hi,
If I purposefully use a local dynamic variable as in:
(defun foo ()
(let* ((my-counter 0)
(var (or (bar 'one)
(bar 'two)
(bar 'three))))
(do-something-with var)
(issue-a-message-depending-on-the-value-of my-counter)))
(defun bar (arg)
(setq my-counter (1+ my-counter))
(do-something-with arg)
(and-return-result))
the byte compiler will issue a warning about referring to a free
variable in `bar'. What is the proper way of letting the byte compiler
know that it shouldn't worry about this particular variable, without
silencing it completely? I don't want to disable all warnings, or even
just the warnings about free variables.
Right now, I'm using a `(defvar my-counter)' inside the function
definition of `bar', but that looks a bit strange. Is there a better or
"more proper" way of doing this?
TIA
Joost
--
Joost Kremers joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
- Declaring a local dynamic variable?,
Joost Kremers <=
- Re: Declaring a local dynamic variable?, Stefan Monnier, 2013/09/20
- Re: Declaring a local dynamic variable?, Andreas Röhler, 2013/09/20
- Message not available
- Re: Declaring a local dynamic variable?, Barry Margolin, 2013/09/20
- Re: Declaring a local dynamic variable?, Andreas Röhler, 2013/09/20
- Message not available
- Re: Declaring a local dynamic variable?, Barry Margolin, 2013/09/20
- Re: Declaring a local dynamic variable?, Andreas Röhler, 2013/09/21
- Message not available
- Re: Declaring a local dynamic variable?, Barry Margolin, 2013/09/21
- Re: Declaring a local dynamic variable?, Andreas Röhler, 2013/09/21
- Message not available
- Re: Declaring a local dynamic variable?, Barry Margolin, 2013/09/21
- Re: Declaring a local dynamic variable?, Joost Kremers, 2013/09/23