[Top][All Lists]

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

Re: Dynamic modules: emacs-module.c and signaling errors

From: Eli Zaretskii
Subject: Re: Dynamic modules: emacs-module.c and signaling errors
Date: Fri, 27 Nov 2015 16:44:04 +0200

> Date: Fri, 27 Nov 2015 13:25:26 +0100
> From: Aurélien Aptel <address@hidden>
> Cc: Paul Eggert <address@hidden>, Stefan Monnier <address@hidden>, 
>       Emacs development discussions <address@hidden>
> As tedious as it sounds, checking for errors after every API call is
> the safest way to go.

With the latest emacs-25 branch, we no longer do.  Which is a Good
Thing, IMO.  Writing an Emacs module isn't supposed to be such an
unpleasant exercise.

> We have to remind ourselves we're extending an editor in
> C. Crashing/aborting can make someone loose work.

Who said anything about crashing?  The current code doesn't crash, but
doesn't require error checking in the module code after each call to
an Emacs function.  Please take a look.

Btw, if we are talking about crashing, I think the massive use of
eassert in emacs-module.c is a much more probable cause of losing work
than anything else.  eassert is for things that "should never happen",
not for catching programmer's mistakes.  An assertion that is violated
_really_ crashes Emacs and risks losing valuable work.  Doing that
because some module has a bug is simply unacceptable.

> As ignorant as it will sound, working on the dynamic modules feature
> made me realize how Emacs core might leak memory everytime a call
> signals in the middle a function if you're not careful. I find this
> very error-prone.

You will have to explain that to us, because we do this in Emacs all
the time, and there are no leaks caused by that.

reply via email to

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