From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Chris Gregory Newsgroups: gmane.emacs.devel Subject: Re: Define progn_ignore to run Fprogn and ignore output Date: Tue, 27 Dec 2016 10:28:48 -0600 Message-ID: References: <871swum82w.fsf@CzipperZag.i-did-not-set--mail-host-address--so-tickle-me> <20161227154947.GA2324@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11402b243067850544a65b78 X-Trace: blaine.gmane.org 1482856263 25029 195.159.176.226 (27 Dec 2016 16:31:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Dec 2016 16:31:03 +0000 (UTC) Cc: Emacs Development Mailing List To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 27 17:30:57 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLueM-0005SR-ML for ged-emacs-devel@m.gmane.org; Tue, 27 Dec 2016 17:30:54 +0100 Original-Received: from localhost ([::1]:54890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLueR-0006Fx-HP for ged-emacs-devel@m.gmane.org; Tue, 27 Dec 2016 11:30:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLud1-0005IC-2S for emacs-devel@gnu.org; Tue, 27 Dec 2016 11:29:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLucz-0001no-FS for emacs-devel@gnu.org; Tue, 27 Dec 2016 11:29:31 -0500 Original-Received: from mail-io0-x236.google.com ([2607:f8b0:4001:c06::236]:33803) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cLucz-0001me-9X for emacs-devel@gnu.org; Tue, 27 Dec 2016 11:29:29 -0500 Original-Received: by mail-io0-x236.google.com with SMTP id p42so316453552ioo.1 for ; Tue, 27 Dec 2016 08:29:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4T8OuxPU4gkvIszJF7q4QVwXPGB+hfDfpLeYxxUifCA=; b=M48wpjy3mowz9xMDlSUm60GkvG0Bocy6QrQ7jIo2ez93KzxBSTpdCJ4KMrMUXRwQ+W hqlJgpgVM++AzXC9Qzj00YlSRVezdSYchRxGWmA7kjFwx5iLBiTJeLpbjA0LFl7kc7Th /EUIl1ITIXoxUiNwYIMow33thDEioXl2VwVXRpCGdtMRW6E7dgmBEDSCqRAmt/2fKu3s SODKYUYKtJSgqvgyPfypSVxAMG8retaCzXSV5xCS2rsti1ZIVnQrpcqc1BSFe+dDMPku wrdajHCRbtl1m1hsGHWGiOKyLSCKPPEhKN0s8Ux+SOl8VmDmTZOZ2LTMwQsemSXNSQsy b6gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4T8OuxPU4gkvIszJF7q4QVwXPGB+hfDfpLeYxxUifCA=; b=fEBbCnFIuMBR96I4E0XgAGzndPyJ4+q9SNQhFtTTQZCUFUL3UmntbzkNhFyaF9FNju tToAnXIoeM/5IA8X11aWw/vARPthKzrsnAz+4oxHqP0plbcm05JVuLOLaphRt1z4b5ZZ GW9qkK4vZ8VETT0HqxxEn6CWp4lEcmwCnKtyFI5Vp1rT22VbamGF2RkH2rOtvPPG+qfk zZ9aoMPIBpSE2LZ+49KiKfP7RFUdRR6MO7is+naqwid0Qmw0LQRPZxfErAhm0/VpSZip tglCoGSyPnCfXxnTV5mCcNxAvtKV7DCtMfdeI6aOsdQRTz8qSKG1JFz2KV/uLVX5+Y7i Pgxw== X-Gm-Message-State: AIkVDXJCmya9M10WfHKTdMhVuJoGX/P6qhkaKZS8FG9qSRViYaATV3pGDbPIRzdqOPAB4R5/9H9CBwehDB/NBQ== X-Received: by 10.107.34.139 with SMTP id i133mr28937327ioi.229.1482856168705; Tue, 27 Dec 2016 08:29:28 -0800 (PST) Original-Received: by 10.50.191.197 with HTTP; Tue, 27 Dec 2016 08:28:48 -0800 (PST) In-Reply-To: <20161227154947.GA2324@acm.fritz.box> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:210845 Archived-At: --001a11402b243067850544a65b78 Content-Type: text/plain; charset=UTF-8 Oh yes you are correct. That's my bad. Sincerely, Chris Gregory On Tue, Dec 27, 2016 at 9:49 AM, Alan Mackenzie wrote: > Hello, Chris. > > Just a small point about your proposed patch. > > On Mon, Dec 26, 2016 at 08:14:47PM -0600, Chris Gregory wrote: > > This patch defines progn_ignore to do Fprogn but not return a result. > > This will minorly speed up all operations using `unwind_body'. It also > > simplifies the code for `Fprog1' without sacrificing performance. > > > diff --git a/src/eval.c b/src/eval.c > > index ddcccc2..7e02838 100644 > > --- a/src/eval.c > > +++ b/src/eval.c > > @@ -456,10 +456,17 @@ usage: (progn BODY...) */) > > /* Evaluate BODY sequentially, discarding its value. Suitable for > > record_unwind_protect. */ > > > +static void > > +progn_ignore (Lisp_Object body) > > +{ > > + while (CONSP (body)) > > + eval_sub (XCAR (body)); > > +} > > + > > Doesn't the above code up an infinite loop? `body' appears not to be > changed between iterations of the while. > > > void > > unwind_body (Lisp_Object body) > > { > > - Fprogn (body); > > + progn_ignore (body); > > } > > > DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0, > > @@ -470,15 +477,8 @@ usage: (prog1 FIRST BODY...) */) > > (Lisp_Object args) > > { > > Lisp_Object val; > > - Lisp_Object args_left; > > - > > - args_left = args; > > - val = args; > > - > > - val = eval_sub (XCAR (args_left)); > > - while (CONSP (args_left = XCDR (args_left))) > > - eval_sub (XCAR (args_left)); > > - > > + val = eval_sub (XCAR (args)); > > + progn_ignore (XCDR (args)); > > return val; > > } > > -- > Alan Mackenzie (Nuremberg, Germany). > --001a11402b243067850544a65b78 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Oh yes you are correct. T= hat's my bad.

=
Sincerely,

Chris Gregory

On Tue, Dec 27, 2016 at 9:49 AM, Alan Macken= zie <a= cm@muc.de> wrote:
Hello, C= hris.

Just a small point about your proposed patch.

On Mon, Dec 26, 2016 at 08:14:47PM -0600, Chris Gregory wrote:
> This patch defines progn_ignore to do Fprogn but not return a result.<= br> > This will minorly speed up all operations using `unwind_body'.=C2= =A0 It also
> simplifies the code for `Fprog1' without sacrificing performance.<= br>
> diff --git a/src/eval.c b/src/eval.c
> index ddcccc2..7e02838 100644
> --- a/src/eval.c
> +++ b/src/eval.c
> @@ -456,10 +456,17 @@ usage: (progn BODY...)=C2=A0 */)
>=C2=A0 /* Evaluate BODY sequentially, discarding its value.=C2=A0 Suita= ble for
>=C2=A0 =C2=A0 =C2=A0record_unwind_protect.=C2=A0 */

> +static void
> +progn_ignore (Lisp_Object body)
> +{
> +=C2=A0 while (CONSP (body))
> +=C2=A0 =C2=A0 eval_sub (XCAR (body));
> +}
> +

Doesn't the above code up an infinite loop?=C2=A0 `body' app= ears not to be
changed between iterations of the while.

>=C2=A0 void
>=C2=A0 unwind_body (Lisp_Object body)
>=C2=A0 {
> -=C2=A0 Fprogn (body);
> +=C2=A0 progn_ignore (body);
>=C2=A0 }

>=C2=A0 DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0,
> @@ -470,15 +477,8 @@ usage: (prog1 FIRST BODY...)=C2=A0 */)
>=C2=A0 =C2=A0 (Lisp_Object args)
>=C2=A0 {
>=C2=A0 =C2=A0 Lisp_Object val;
> -=C2=A0 Lisp_Object args_left;
> -
> -=C2=A0 args_left =3D args;
> -=C2=A0 val =3D args;
> -
> -=C2=A0 val =3D eval_sub (XCAR (args_left));
> -=C2=A0 while (CONSP (args_left =3D XCDR (args_left)))
> -=C2=A0 =C2=A0 eval_sub (XCAR (args_left));
> -
> +=C2=A0 val =3D eval_sub (XCAR (args));
> +=C2=A0 progn_ignore (XCDR (args));
>=C2=A0 =C2=A0 return val;
>=C2=A0 }

--
Alan Mackenzie (Nuremberg, Germany).

--001a11402b243067850544a65b78--