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 modules: MODULE_HANDLE_SIGNALS etc. Date: Sat, 28 Nov 2015 10:58:44 +0000 Message-ID: References: <83mvu1x6t3.fsf@gnu.org> <565779CD.80405@cs.ucla.edu> <83io4nuc68.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=089e0102def4b2e376052597b135 X-Trace: ger.gmane.org 1448708345 13979 80.91.229.3 (28 Nov 2015 10:59:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Nov 2015 10:59:05 +0000 (UTC) Cc: aurelien.aptel+emacs@gmail.com, tzz@lifelogs.com, dancol@dancol.org, emacs-devel@gnu.org To: Eli Zaretskii , Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 28 11:59:02 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 1a2dDY-0001j5-ID for ged-emacs-devel@m.gmane.org; Sat, 28 Nov 2015 11:59:00 +0100 Original-Received: from localhost ([::1]:60340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2dDb-0002ZQ-RV for ged-emacs-devel@m.gmane.org; Sat, 28 Nov 2015 05:59:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2dDX-0002ZA-CO for emacs-devel@gnu.org; Sat, 28 Nov 2015 05:59:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2dDW-000241-4J for emacs-devel@gnu.org; Sat, 28 Nov 2015 05:58:59 -0500 Original-Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:32801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2dDT-00023Q-Nb; Sat, 28 Nov 2015 05:58:56 -0500 Original-Received: by wmec201 with SMTP id c201so97174691wme.0; Sat, 28 Nov 2015 02:58:55 -0800 (PST) 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=sc4SLGGMNP2WXdcPMYyLowM1Uq4KuakFW3hzAa8ECuI=; b=Lxtayg3PI0cSI/SHWWJZ1csKmlDXaoS18YjGl9/t08R7q5Pkgv/JMxCSQy/MZUZHyX zcuc0Jd5JfNqC/VeDj4/lXjL83/SVlysLaTD8vxpMTI1WoQf0sVdD11rB3/R5Mm2qqiQ 45SQ2dxQIlSjx8yXcg22qG2LkIfuouRx0T8xw08Zqze0LnE5Gy5xkLrCy8RkGMEg79Fb LeztTAAkUWSJgLqJRAEX7SfLiy4GsNzf/GNkH6Ef9Cs6JzopXp+jNQ9mEeteu9q2DRvH lSvYs14w0jfHmf+msFzAqAaWhqG6sKo9rM9ORIZKGPo87U2glhPYLyKTcVM1rJ8UkcBM IUgw== X-Received: by 10.194.87.39 with SMTP id u7mr61574675wjz.11.1448708335108; Sat, 28 Nov 2015 02:58:55 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::235 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:195451 Archived-At: --089e0102def4b2e376052597b135 Content-Type: multipart/alternative; boundary=089e0102def4b2e371052597b133 --089e0102def4b2e371052597b133 Content-Type: text/plain; charset=UTF-8 Philipp Stephani schrieb am Fr., 27. Nov. 2015 um 20:19 Uhr: > Eli Zaretskii schrieb am Fr., 27. Nov. 2015 um 08:36 Uhr: > >> > Cc: emacs-devel@gnu.org >> > From: Paul Eggert >> > Date: Thu, 26 Nov 2015 13:29:49 -0800 >> > >> > Eli Zaretskii wrote: >> > > it would be a maintenance burden to have to >> > > analyze upon each such change whether emacs-module.c needs some >> > > augmentation. >> > >> > While that's true in general, I think some exceptions are OK. E.g., >> it's OK if >> > emacs-module.c assumes that ASIZE is a simple access function or macro >> that >> > doesn't throw signals. If we actually changed ASIZE to throw signals, >> there's a >> > boatload of other code we'd need to change as well, and changing >> emacs-module.c >> > wouldn't add much more to the maintenance burden. >> >> So what are the rules here, exactly? I'd like to write them down in >> the commentary to emacs-module.c, so that any future changes there >> will have lower probability of breaking things. >> >> E.g., can make_number signal an error? What about make_float or >> make_string? And what about accessors like XFLOAT_DATA or AREF? >> >> > Are there any established rules? If not we should probably be conservative > and assume that everything signals. If we figure out that this introduces > an unacceptably high overhead in some situations we can reconsider later. > I would propose three exceptions: free_global_ref, is_not_nil, eq. > free_global_ref cannot fail in Daniel's design, and implementing it that > way would be consistent with other resource deallocation functions such as > free(3). is_not_nil and eq seem so fundamental that I cannot imagine a > situation where they could ever fail. Documenting that these three cannot > fail would free module authors from the need to check for errors after > calling these functions. > For now I've attached a patch to replace the initial setup of most environment functions with a single macro. --089e0102def4b2e371052597b133 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Philip= p Stephani <p.stephani2@gmail.c= om> schrieb am Fr., 27. Nov. 2015 um 20:19=C2=A0Uhr:
Eli Zaretskii <eliz@gnu.org> schrieb am Fr., 27. Nov. 2015 um 08:36=C2=A0Uhr:
> Cc: emacs-devel@gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Thu, 26 Nov 2015 13:29:49 -0800
>
> Eli Zaretskii wrote:
> > it would be a maintenance burden to have to
> >=C2=A0 =C2=A0 =C2=A0 analyze upon each such change whether emacs-m= odule.c needs some
> >=C2=A0 =C2=A0 =C2=A0 augmentation.
>
> While that's true in general, I think some exceptions are OK.=C2= =A0 E.g., it's OK if
> emacs-module.c assumes that ASIZE is a simple access function or macro= that
> doesn't throw signals.=C2=A0 If we actually changed ASIZE to throw= signals, there's a
> boatload of other code we'd need to change as well, and changing e= macs-module.c
> wouldn't add much more to the maintenance burden.

So what are the rules here, exactly?=C2=A0 I'd like to write them down = in
the commentary to emacs-module.c, so that any future changes there
will have lower probability of breaking things.

E.g., can make_number signal an error?=C2=A0 What about make_float or
make_string?=C2=A0 And what about accessors like XFLOAT_DATA or AREF?


Are there any established rules? If not we should probabl= y be conservative and =C2=A0assume that everything signals. If we figure ou= t that this introduces an unacceptably high overhead in some situations we = can reconsider later.
I would propose three exceptions: free_glob= al_ref, is_not_nil, eq. free_global_ref cannot fail in Daniel's design,= and implementing it that way would be consistent with other resource deall= ocation functions such as free(3). is_not_nil and eq seem so fundamental th= at I cannot imagine a situation where they could ever fail. Documenting tha= t these three cannot fail would free module authors from the need to check = for errors after calling these functions.

For now I've attached a patch to replace the initial s= etup of most environment functions with a single macro.=C2=A0
--089e0102def4b2e371052597b133-- --089e0102def4b2e376052597b135 Content-Type: application/octet-stream; name="0001-Create-and-use-a-macro-MODULE_FUNCTION_BEGIN.patch" Content-Disposition: attachment; filename="0001-Create-and-use-a-macro-MODULE_FUNCTION_BEGIN.patch" Content-Transfer-Encoding: base64 Content-ID: <1514dbeb5ad7fc962a11> X-Attachment-Id: 1514dbeb5ad7fc962a11 RnJvbSAxYzMwZGI1NTg3MDg1NzU2MzU5MDVjNDhhZTJjNmZjNTY0OWY4ZWE4IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXBwIFN0ZXBoYW5pIDxwaHN0QGdvb2dsZS5jb20+CkRh dGU6IFNhdCwgMjggTm92IDIwMTUgMTE6NTU6MDIgKzAxMDAKU3Viam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