[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: flet, cl-flet, cl-letf in 24.3
From: |
ndemmel |
Subject: |
Re: flet, cl-flet, cl-letf in 24.3 |
Date: |
Sat, 27 Apr 2013 04:16:02 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Monday, April 22, 2013 3:32:05 PM UTC+2, Stefan Monnier wrote:
> > as reported here [5], this documentation does not really tell me what to do
>
> > if I want to keep relying on the dynamic scoping of flet. A brief google
>
> > search [6] leads me to believe that
>
>
>
> > (cl-letf (((symbol-function 'foo) #'(lambda (...) ...))) ...)
>
>
>
> > is the suggested solution,
>
>
>
> That's the case.
Thanks!
>
> > Does that always have dynamic scope?
>
> How could it not?
>
I'm not sure. What makes you say that? I can see how a lexical binding to a
generalized place (not a variable) would not neccessarily make sense; is that
what you mean? Otoh cl-flet does exactly that, for the special case of
(symbol-function ...), or is that not how I should view it?
>
> > however I wanted to make sure that is the case.
>
>
>
> Even better in most cases is:
>
>
>
> (defvar my-enable-foo-advice nil)
>
> (defadvice foo (...)
>
> (if my-enable-foo-advice ... ...))
>
>
>
> and then replace (flet ((foo ...)) ...)
>
> with (let ((my-enable-foo-advice t)) ...)
>
I see. In my case I was concerned with keeping legacy code working without
changing much.
Thanks!
Niko
- flet, cl-flet, cl-letf in 24.3, ndemmel, 2013/04/21
- RE: flet, cl-flet, cl-letf in 24.3, Drew Adams, 2013/04/21
- Message not available
- Re: flet, cl-flet, cl-letf in 24.3, ndemmel, 2013/04/21
- RE: flet, cl-flet, cl-letf in 24.3, Drew Adams, 2013/04/21
- Re: flet, cl-flet, cl-letf in 24.3, Stefan Monnier, 2013/04/22
- Re: flet, cl-flet, cl-letf in 24.3, Andreas Röhler, 2013/04/22
- Message not available
- Re: flet, cl-flet, cl-letf in 24.3,
ndemmel <=
- Re: flet, cl-flet, cl-letf in 24.3, Pascal J. Bourguignon, 2013/04/27
- Re: flet, cl-flet, cl-letf in 24.3, Stefan Monnier, 2013/04/27