GNU bug report logs -
#12895
24.3.50; Replacement for flet
Previous Next
Reported by: Antoine Levitt <antoine.levitt <at> gmail.com>
Date: Thu, 15 Nov 2012 13:37:02 UTC
Severity: normal
Tags: notabug
Found in version 24.3.50
Done: Marcin Borkowski <mbork <at> mbork.pl>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 12895 <at> debbugs.gnu.org (full text, mbox):
11/15/2012 15:46, Stefan Monnier
>> (defun something ()
>> (message "hi"))
>> (letf ((message (lambda () (&rest args) nil)))
>> (something))
>> Is this because message is a built-in?
>
> No, it's because what you want is not a local function, but an override
> of an existing function.
Ah, sorry. Letf redirects to cl-letf, which says
Temporarily bind to PLACEs. This is the analogue of `let', but with
generalized variables
If it excludes overrides, I think it should say so explicitely. Right
now I'm led to think it's like let for functions, and I've been using
let for overriding just fine.
> Such override should be done with an advice.
Unless I'm missing something easier, using an advice would be cumbersome
(define the advice, activate it, run the function, then deactivate the
advice, protecting for errors). Would you consider un-obsoleting flet?
It isn't deprecated by either cl-flet or cl-letf.
This bug report was last modified 9 years and 106 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.