GNU bug report logs - #12895
24.3.50; Replacement for flet

Previous Next

Package: emacs;

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 #16 received at control <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Antoine Levitt <antoine.levitt <at> gmail.com>
Cc: 12895 <at> debbugs.gnu.org
Subject: Re: bug#12895: 24.3.50; Replacement for flet
Date: Thu, 15 Nov 2012 13:35:34 -0500
tags 12895 notabug
thanks

>   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.

letf and cl-letf do not exclude overrides: it only does overrides
(well, pretty much, except if PLACE is a variable, in which case it's
just like a let).

But, indeed, the docstring of cl-flet was wrong since it said "Make
temporary function definitions" whereas these are not temporarily but local.
I just fixed it now, thank you.

>> 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.

Overriding a function is bad.  It can mess things up and throw you
majorly off-course when debugging the problem.  So it's good if
it's cumbersome.

Check my recent patch to js.el to see how I replaced flet with advices.


        Stefan




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.