emacs-devel
[Top][All Lists]
Advanced

[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: Tue, 24 Nov 2015 22:49:07 +0200

> From: Tom Tromey <address@hidden>
> Cc: Philipp Stephani <address@hidden>,  address@hidden,  address@hidden,  
> address@hidden,  address@hidden
> Date: Tue, 24 Nov 2015 13:12:30 -0700
> 
> What I did in my module is do an error check after every call in to
> Emacs, returning early when one is seen.  Then eventually control
> returns to Fmodule_call, which handles translating this to a Lisp
> signal.

Thanks.  However, this is highly non-obvious, and IMO quite error
prone.  The consequences of failing to conform to this paradigm are
dire: the error goes unreported, and instead an unrelated assertion
blows up.

Perhaps we should remove these assertions, or at least make them
conditional on something that isn't ENABLE_CHECKING, since it seems
they were added for debugging emacs-module.c, not for catching errors
in modules.

Btw, using this method the module code becomes very tedious, something
like

  intmax_t a = env->extract_integer (env, args[0]);
  if (env->non_local_exit_check (env) != emacs_funcall_exit_return)
    return NULL;
  intmax_t b = env->extract_integer (env, args[1]);
  if (env->non_local_exit_check (env) != emacs_funcall_exit_return)
    return NULL;

etc.



reply via email to

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