help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [External] : Re: Why is defun not executed during load-file?


From: Marcin Borkowski
Subject: Re: [External] : Re: Why is defun not executed during load-file?
Date: Mon, 31 May 2021 22:09:04 +0200
User-agent: mu4e 1.1.0; emacs 28.0.50

On 2021-05-31, at 21:47, Stefan Monnier via Users list for the GNU Emacs text 
editor <help-gnu-emacs@gnu.org> wrote:

>> Hm ... interesting. Yeah, maybe we should start do that more?
>
> Not really: it's better to avoid macros when you can.
> But it's better to use macros than to use `eval`.
>
>> What kind of things or problems could or should you solve
>> with macros?
>
> Whenever you find yourself forced to use `eval` ?

Or when you lack some syntactical construct you could find useful, like
anaphoric-if.  Or if what you need is closer to a "special form" than to
a function.  A typical case is when you need a construct which will be
able to evaluate something or not, depending on the circumstances.  Or
when you need a construct which will evaluate some form(s) /after/ doing
something (remember that when a function gets its arguments, they are
all evaluated before even the first form of a function is evaluated!).
Here (shameless plug!) is an example of something you couldn't achieve
with functions alone (unless you wanted to wrap some code in `(lambda ()
...)', which would be rather ugly):
http://mbork.pl/2016-04-24_The_conditional-save-excursion_macro

Hth,

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]