BTW, all this discussion about C++ modules see=
ms to miss the point:
Emacs's own API will be a C API.=C2=A0 When you want to use it from a C=
++
module, you'll have to convert it to a C++ API.=
div>
True, and I think nobody expects otherwise. However, as with other=
interfaces, the Emacs module interface should use not all of C, but the in=
tersection of C and C++ (which is pretty large compared to full C).
=C2=A0=C2=A0 At that point, you
have various options:
- do a minimalist binding which keeps using naked longjmp, and just
=C2=A0 let the C++ code use explicit internal_condition_case wrappers where=
=C2=A0 it thinks it's needed.
This =
is currently impossible because the necessary code is not available to modu=
le authors (and partially does not even exist, as in the case of catch).
=C2=A0
- do an "idiot-proof" binding which only provides a "safe_fu=
ncall" which
=C2=A0 catches longjmps and turns them into local exits.
This is what Daniel and I prefer, however I'd like to=
avoid the negative spin of the word "idiot" here. To use the fir=
st option, a module author has to know all of the following:
- th=
at Emacs uses longjmp for non-local exits in Lisp (currently an implementat=
ion detail_;
- that longjmp is in general unsafe in C++ code;
- which subset exactly of C++ is safe for longjmp;
- how t=
o correctly set up the necessary traps to reliably catch all longjmps.
I think it's a stretch to call everyone who doesn't know all =
of these things an "idiot". Implementing this option is relativel=
y straightforward; implementing the first option makes it much harder for m=
odule authors, with negligible benefit to the Emacs core.
=C2=A0<=
/div>
- do an "idiot-resistant" binding which only provides a "saf=
e_funcall" that
=C2=A0 catches longjmps and turns them into C++ exceptions, and then back
=C2=A0 into Elisp longjmps (and back-and-forth ad nauseum if needed when
=C2=A0 doing nested mutual callbacks).
=
No, this is what a C++ binding to the module interface would have to provid=
e.
=C2=A0
I'm fine with any of those things, and AFAIK they can all be done on to=
p
of the plain C API with the usual non-local exits.
All I care about at this point is the plain C API.
--001a1134c69cc6b481052143441d--