From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: Dynamic loading progress Date: Sun, 04 Oct 2015 08:34:34 +0000 Message-ID: References: <87si7977rs.fsf@tromey.com> <55DB7C3D.4090106@cs.ucla.edu> <55DE75FD.8020308@cs.ucla.edu> <55F5DD8C.70506@dancol.org> <87fv2hzmw3.fsf@uwakimon.sk.tsukuba.ac.jp> <22025.61338.681227.470671@turnbull.sk.tsukuba.ac.jp> <560AFCE3.8090802@lanl.gov> <22027.31797.6292.498407@turnbull.sk.tsukuba.ac.jp> <560B8EB9.8030801@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1134c69cc6b481052143441d X-Trace: ger.gmane.org 1443947697 12131 80.91.229.3 (4 Oct 2015 08:34:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 4 Oct 2015 08:34:57 +0000 (UTC) Cc: Paul Eggert , Emacs development discussions , =?UTF-8?Q?Aur=C3=A9lien_Aptel?= , "Stephen J. Turnbull" , Tom Tromey , Stephen Leake To: Stefan Monnier , Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 04 10:34:55 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zieku-0002CX-CS for ged-emacs-devel@m.gmane.org; Sun, 04 Oct 2015 10:34:52 +0200 Original-Received: from localhost ([::1]:41646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ziekt-000787-H0 for ged-emacs-devel@m.gmane.org; Sun, 04 Oct 2015 04:34:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zieko-00077t-Ki for emacs-devel@gnu.org; Sun, 04 Oct 2015 04:34:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ziekn-00011p-2B for emacs-devel@gnu.org; Sun, 04 Oct 2015 04:34:46 -0400 Original-Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:38597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ziekm-00011g-PU for emacs-devel@gnu.org; Sun, 04 Oct 2015 04:34:44 -0400 Original-Received: by wiclk2 with SMTP id lk2so77511858wic.1 for ; Sun, 04 Oct 2015 01:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=/t5TdLUTPp5U+BdlVqw+ujhz6mryOso/IMIp9szBFbM=; b=G+Uv9kDk6+ms5POR2HrYmFahrDrJ7V0M8wzzjqbKsc3/BoNlymIiNBPu96ChAZAo5m QyO0FtekHuf0of3ap/DmzVL+0LTpXN/k8ctvTAcxvaU1r1TYlz2QL+AOsZF2YLVAXq5F POb31PfbjBuYbFgqZTvaIQ1/DzlytBMcm69OT0mqQsXmOBWI6g0rp/ucJdfkxIzuNpVB Zf0pKZPtFHbEknvMCoX2MTo/2t+WWj0TapMGHjqs9BvCCaOROZEQdClpU/GuP8asGsAd +wYAm3/X0m62j3YvL5+77N/974HBwDufYefNgG2MFM0Jd8n9E1/l04VTizrCMsbjUM7r fIFQ== X-Received: by 10.180.216.36 with SMTP id on4mr5813948wic.65.1443947683949; Sun, 04 Oct 2015 01:34:43 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:190855 Archived-At: --001a1134c69cc6b481052143441d Content-Type: text/plain; charset=UTF-8 Stefan Monnier schrieb am Mi., 30. Sep. 2015 um 10:52 Uhr: > BTW, all this discussion about C++ modules seems to miss the point: > Emacs's own API will be a C API. When you want to use it from a C++ > module, you'll have to convert it to a C++ API. True, and I think nobody expects otherwise. However, as with other interfaces, the Emacs module interface should use not all of C, but the intersection of C and C++ (which is pretty large compared to full C). > At that point, you > have various options: > > - do a minimalist binding which keeps using naked longjmp, and just > let the C++ code use explicit internal_condition_case wrappers where > it thinks it's needed. > This is currently impossible because the necessary code is not available to module authors (and partially does not even exist, as in the case of catch). > - do an "idiot-proof" binding which only provides a "safe_funcall" which > 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 first option, a module author has to know all of the following: - that Emacs uses longjmp for non-local exits in Lisp (currently an implementation detail_; - that longjmp is in general unsafe in C++ code; - which subset exactly of C++ is safe for longjmp; - how to 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 relatively straightforward; implementing the first option makes it much harder for module authors, with negligible benefit to the Emacs core. > - do an "idiot-resistant" binding which only provides a "safe_funcall" that > catches longjmps and turns them into C++ exceptions, and then back > into Elisp longjmps (and back-and-forth ad nauseum if needed when > doing nested mutual callbacks). > No, this is what a C++ binding to the module interface would have to provide. > I'm fine with any of those things, and AFAIK they can all be done on top > of the plain C API with the usual non-local exits. > All I care about at this point is the plain C API. > > Daniel has designed a great API in https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00960.html. Let's just implement this API as designed and check later if there's any need for the other options. --001a1134c69cc6b481052143441d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Stefan= Monnier <monnier@iro.umontr= eal.ca> schrieb am Mi., 30. Sep. 2015 um 10:52=C2=A0Uhr:
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.

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.


Daniel has designed a great API in https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00960.html= . Let's just implement this API as designed and check later if there= 9;s any need for the other options.=C2=A0
--001a1134c69cc6b481052143441d--