GNU logs - #24102, boring messages


Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
Resent-From: "Glenn Michaels" <gmichaels@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Fri, 29 Jul 2016 09:23:02 +0000
Resent-Message-ID: <handler.24102.B.146978414012071 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: 
To: 24102 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-guile@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.146978414012071
          (code B ref -1); Fri, 29 Jul 2016 09:23:02 +0000
Received: (at submit) by debbugs.gnu.org; 29 Jul 2016 09:22:20 +0000
Received: from localhost ([127.0.0.1]:49960 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bT3zn-00038d-LH
	for submit <at> debbugs.gnu.org; Fri, 29 Jul 2016 05:22:19 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51251)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gmichaels@HIDDEN>) id 1bT3zk-00038N-45
 for submit <at> debbugs.gnu.org; Fri, 29 Jul 2016 05:22:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <gmichaels@HIDDEN>) id 1bT3ze-0005my-1b
 for submit <at> debbugs.gnu.org; Fri, 29 Jul 2016 05:22:10 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:60122)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <gmichaels@HIDDEN>) id 1bT3zd-0005mj-Ug
 for submit <at> debbugs.gnu.org; Fri, 29 Jul 2016 05:22:09 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42208)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <gmichaels@HIDDEN>) id 1bT3zb-0003ro-O7
 for bug-guile@HIDDEN; Fri, 29 Jul 2016 05:22:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <gmichaels@HIDDEN>) id 1bT3zY-0005lx-CZ
 for bug-guile@HIDDEN; Fri, 29 Jul 2016 05:22:07 -0400
Received: from www.safe-mail.net ([212.29.227.81]:55968
 helo=orange.safe-mail.net) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <gmichaels@HIDDEN>) id 1bT3zY-0005kS-4k
 for bug-guile@HIDDEN; Fri, 29 Jul 2016 05:22:04 -0400
Received: by orange.safe-mail.net with Safe-mail (Exim 4.84)
 (envelope-from <gmichaels@HIDDEN>) id 1bT3zO-0007Vt-B5
 for bug-guile@HIDDEN; Fri, 29 Jul 2016 05:21:54 -0400
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=N1-0105; d=Safe-mail.net;
 b=ciuuGj7NAsZDwrd9COR3CE5LOirPh/pO306xwxhGvrycrACcmiXkjF+rlc42ngCQ
 J87KHHk2S3hMVzfc52hMAupd//woPH+cAGZipbeqEJZf2wZXYNgKiZpqGuOmfD+6
 2GrhFmiSyTXUpcMQFt4PZnyQMeaF4S24py3drBWWBx4=;
Received: from pc ([185.65.134.81]) by Safe-mail.net with https
Date: Fri, 29 Jul 2016 05:21:53 -0400
From: "Glenn Michaels" <gmichaels@HIDDEN>
X-SMType: Regular
X-SMRef: N1O-EYuO2QhvA6
Message-Id: <N1O-EYuO2QhvA6@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-SMSignature: nL00nQ99PTQU4Mhmu00i2e5ftqAWOQn8zZc5wIlBAQSUULflOmtsneji9lTac7TW
 50pWwgwEJ8rs1TjUsRjP7JnA2VeCptMEuri29KVAGcYRQj5mfXcMjNaYXLNx61Rm
 5DzHtn57kWVZxUXUbbNi9OzbJudr59Uexf2lLGRKO8I=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Currently, guile's (srfi srfi-111) module ("mutable boxes") provides
an implementation based on records with a single value field.

Wouldn't it make more sense to re-export the functions make-variable,
variable?, variable-ref and variable-set! from the guile core as box,
box?, unbox and set-box! respectively?

These functions have the same signatures and the same semantics as
required by the SRFI-111 spec., and they appear to be significantly
faster than the current record-based implementation.

Moreover, SRFI-111 boxes and guile variable objects are clearly
semantically the same thing. It's bad enough having two names for the
same thing, without having two implementations too.

Reference: http://srfi.schemers.org/srfi-111/srfi-111.html




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: "Glenn Michaels" <gmichaels@HIDDEN>
Subject: bug#24102: Acknowledgement (Use guile variable objects as
 SRFI-111 boxes.)
Message-ID: <handler.24102.B.146978414012071.ack <at> debbugs.gnu.org>
References: <N1O-EYuO2QhvA6@HIDDEN>
X-Gnu-PR-Message: ack 24102
X-Gnu-PR-Package: guile
Reply-To: 24102 <at> debbugs.gnu.org
Date: Fri, 29 Jul 2016 09:23:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-guile@HIDDEN

If you wish to submit further information on this problem, please
send it to 24102 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
24102: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24102
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
References: <N1O-EYuO2QhvA6@HIDDEN>
In-Reply-To: <N1O-EYuO2QhvA6@HIDDEN>
Resent-From: "Glenn Michaels" <gmichaels@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Tue, 02 Aug 2016 10:27:02 +0000
Resent-Message-ID: <handler.24102.B24102.147013358416066 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: 
To: 24102 <at> debbugs.gnu.org
Received: via spool by 24102-submit <at> debbugs.gnu.org id=B24102.147013358416066
          (code B ref 24102); Tue, 02 Aug 2016 10:27:02 +0000
Received: (at 24102) by debbugs.gnu.org; 2 Aug 2016 10:26:24 +0000
Received: from localhost ([127.0.0.1]:53394 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bUWtw-0004B0-2I
	for submit <at> debbugs.gnu.org; Tue, 02 Aug 2016 06:26:24 -0400
Received: from www.safe-mail.net ([212.29.227.81]:34044
 helo=orange.safe-mail.net)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gmichaels@HIDDEN>) id 1bUWto-0004Al-4G
 for 24102 <at> debbugs.gnu.org; Tue, 02 Aug 2016 06:26:18 -0400
Received: by orange.safe-mail.net with Safe-mail (Exim 4.84)
 (envelope-from <gmichaels@HIDDEN>) id 1bUWtY-0002MP-Ml
 for 24102 <at> debbugs.gnu.org; Tue, 02 Aug 2016 06:25:56 -0400
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=N1-0105; d=Safe-mail.net;
 b=R5xtmL/PtBV7NsL7grK3o0dM85MIjhR/rAhqmcZUiBwQeSt5VTbg8dMECbkYO18+
 RgAG3tcIpK/mjI6UrpMfgmzIiZzP4PQ2AY2Yt3Gpn3ZJ9vmxUTh7gdIiWz4PA7sH
 YvgUP1oxwHQM4LgnqLR9bYkiT58rUVS2XqwN1cagN4I=;
Received: from pc ([94.242.246.24]) by Safe-mail.net with https
Date: Tue, 2 Aug 2016 06:25:56 -0400
From: "Glenn Michaels" <gmichaels@HIDDEN>
X-SMType: Regular
X-SMRef: N1O-3bLcU31rOy
Message-Id: <N1O-3bLcU31rOy@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed;
 boundary="-----5KVYT3G4Q6BC2-57A07534.2373-L9Y0JA6PWR4JQ-----"
X-SMSignature: DTD8CPBs1XP4VCalAQ71ffhb/elLDFhePiG+bGE+Jkm+agOt+34D63AXAhQ+heGv
 52NACI26u/rqr7ptusLR9FNOM6oZuHv31dHtHY4FIPNC03bop9KePm++7jJRxdDJ
 xkX9WicgBcLR4MT3jjz5FotZ/VF+16lqddYtel0e/4Q=
X-Spam-Score: -1.9 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.9 (-)

This is a multi-part message in MIME format.

-------5KVYT3G4Q6BC2-57A07534.2373-L9Y0JA6PWR4JQ-----
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Trivial patch implementing this suggestion attached.

-------5KVYT3G4Q6BC2-57A07534.2373-L9Y0JA6PWR4JQ-----
Content-Type: text/x-diff; name="srfi-111.patch"
Content-Disposition: attachment; filename="srfi-111.patch"
Content-Transfer-Encoding: 7bit

--- a/module/srfi/srfi-111.scm
+++ b/module/srfi/srfi-111.scm
@@ -17,21 +17,9 @@
 ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 (define-module (srfi srfi-111)
-  #:use-module (srfi srfi-9)
-  #:use-module (srfi srfi-9 gnu)
-  #:export (box box? unbox set-box!))
+  #:re-export ((make-variable . box)
+               (variable? . box?)
+               (variable-ref . unbox)
+               (variable-set! . set-box!)))
 
 (cond-expand-provide (current-module) '(srfi-111))
-
-(define-record-type <box>
-  (box value)
-  box?
-  (value unbox set-box!))
-
-(set-record-type-printer! <box>
-  (lambda (box port)
-    (display "#<box " port)
-    (display (number->string (object-address box) 16) port)
-    (display " value: ")
-    (write (unbox box) port)
-    (display ">" port)))

-------5KVYT3G4Q6BC2-57A07534.2373-L9Y0JA6PWR4JQ-------




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 3 Aug 2016 07:51:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 03 03:51:49 2016
Received: from localhost ([127.0.0.1]:54036 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bUqxw-00079H-V3
	for submit <at> debbugs.gnu.org; Wed, 03 Aug 2016 03:51:49 -0400
Received: from orange.safe-mail.net ([212.29.227.81]:33506)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gmichaels@HIDDEN>) id 1bUqxv-000799-Fs
 for control <at> debbugs.gnu.org; Wed, 03 Aug 2016 03:51:48 -0400
Received: by orange.safe-mail.net with Safe-mail (Exim 4.84)
 (envelope-from <gmichaels@HIDDEN>) id 1bUqxt-0005bU-5S
 for control <at> debbugs.gnu.org; Wed, 03 Aug 2016 03:51:45 -0400
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=N1-0105; d=Safe-mail.net;
 b=GxjnGuYuG6WYUEdCfpNUcSmDmAU0yCFUjJpph47xwM3bhjZMJAuNpe1scTwt/MuU
 mUJJc9F/lELYDzQ0pyIE7xl44mUyjZ2PBcFYQ8DsI3RdJz8JXkSE6qEyIOR9g8kz
 8uQJMzcqBIEJ4id2OxzC2K0jTOM1b5we1DsG2OJdf68=;
Received: from pc ([5.79.68.161]) by Safe-mail.net with https
Subject: tags 24102 patch
Date: Wed, 3 Aug 2016 03:51:44 -0400
From: "Glenn Michaels" <gmichaels@HIDDEN>
To: control <at> debbugs.gnu.org
X-SMType: Regular
X-SMRef: N1O-FLEiEZ96_n
Message-Id: <N1O-FLEiEZ96_n@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-SMSignature: LU5/XGqOgzNTbr+V7c9u5J47YDB7ADboCxLgUPsrCfHR/qh4GywRhopygMp7alJw
 S4FEO0J+33pf1/FVSYUa79RDJr/fxu8E/jse4zay6Gq+hCPuXNB3wI8bxL7uNVwd
 6/vyQJYwNUuXzipYVZ/NYWbYc5n43aGIB2CD9LwayqA=
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.9 (-)

package guile
tags 24102 patch
stop




Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
Resent-From: Andy Wingo <wingo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Thu, 04 Aug 2016 21:00:02 +0000
Resent-Message-ID: <handler.24102.B24102.147034438412745 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: patch
To: "Glenn Michaels" <gmichaels@HIDDEN>
Cc: 24102 <at> debbugs.gnu.org
Received: via spool by 24102-submit <at> debbugs.gnu.org id=B24102.147034438412745
          (code B ref 24102); Thu, 04 Aug 2016 21:00:02 +0000
Received: (at 24102) by debbugs.gnu.org; 4 Aug 2016 20:59:44 +0000
Received: from localhost ([127.0.0.1]:55908 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bVPk0-0003JV-Kl
	for submit <at> debbugs.gnu.org; Thu, 04 Aug 2016 16:59:44 -0400
Received: from pb-sasl1.pobox.com ([64.147.108.66]:57178
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bVPjz-0003JO-B1
 for 24102 <at> debbugs.gnu.org; Thu, 04 Aug 2016 16:59:43 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id E23952EBBF;
 Thu,  4 Aug 2016 16:59:40 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=sasl; bh=dzzGbEegOG34epbV39pcZKUBVQY=; b=W7tQww
 5ZRoQK4UfGeVz1yMbV8VlqWsRfDWV1r0j5We6sr9t9B8433rhNyubEO501M3C+yo
 6E+2u1B9uD+98nKZemO4CX2JSb/8sEDaRuDtE6OOpDdv6jstzasc7DXqB/b1WkRD
 oX0LSEvjPU7WVW97MeWwBCtYXf/mZbOUNZR3c=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; q=dns; s=sasl; b=NuKuIjxns9soW7UoEGLA2TvoPmG60/Fj
 dbEhhamrPDZnMPVeFyIQhzPETVRZc+Hs7wKsZOWSLm8HF8e93caQeCP0Imf/4rRt
 2sHMl+/uZDOwiCYB97KwiTaNJHPjmd3psTALytzMJRQrfXEX/T7PC/QyDLE766dv
 0aI5sdXUT9E=
Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id D9B942EBBE;
 Thu,  4 Aug 2016 16:59:40 -0400 (EDT)
Received: from clucks (unknown [88.160.190.192])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 208BB2EBBC;
 Thu,  4 Aug 2016 16:59:40 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
References: <N1O-EYuO2QhvA6@HIDDEN> <N1O-3bLcU31rOy@HIDDEN>
Date: Thu, 04 Aug 2016 22:59:33 +0200
In-Reply-To: <N1O-3bLcU31rOy@HIDDEN> (Glenn Michaels's message of "Tue, 
 2 Aug 2016 06:25:56 -0400")
Message-ID: <87twf0s11m.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 5C54FD60-5A86-11E6-A44A-C1836462E9F6-02397024!pb-sasl1.pobox.com
X-Spam-Score: -1.2 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.2 (-)

On Tue 02 Aug 2016 12:25, "Glenn Michaels" <gmichaels@HIDDEN> writes:

> Trivial patch implementing this suggestion attached.
>
> --- a/module/srfi/srfi-111.scm
> +++ b/module/srfi/srfi-111.scm
> @@ -17,21 +17,9 @@
>  ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>  
>  (define-module (srfi srfi-111)
> -  #:use-module (srfi srfi-9)
> -  #:use-module (srfi srfi-9 gnu)
> -  #:export (box box? unbox set-box!))
> +  #:re-export ((make-variable . box)
> +               (variable? . box?)
> +               (variable-ref . unbox)
> +               (variable-set! . set-box!)))
>  
>  (cond-expand-provide (current-module) '(srfi-111))

I like it.  Let me check in with Mark and see if there's any reason to
keep it like it is.

Andy




Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
Resent-From: Mark H Weaver <mhw@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Fri, 05 Aug 2016 04:33:02 +0000
Resent-Message-ID: <handler.24102.B24102.14703715248401 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: patch
To: "Glenn Michaels" <gmichaels@HIDDEN>
Cc: Andy Wingo <wingo@HIDDEN>, 24102 <at> debbugs.gnu.org
Received: via spool by 24102-submit <at> debbugs.gnu.org id=B24102.14703715248401
          (code B ref 24102); Fri, 05 Aug 2016 04:33:02 +0000
Received: (at 24102) by debbugs.gnu.org; 5 Aug 2016 04:32:04 +0000
Received: from localhost ([127.0.0.1]:56024 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bVWnk-0002BR-CH
	for submit <at> debbugs.gnu.org; Fri, 05 Aug 2016 00:32:04 -0400
Received: from world.peace.net ([50.252.239.5]:42122)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1bVWng-0002At-Vk
 for 24102 <at> debbugs.gnu.org; Fri, 05 Aug 2016 00:32:02 -0400
Received: from pool-71-174-42-86.bstnma.east.verizon.net ([71.174.42.86]
 helo=jojen)
 by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mhw@HIDDEN>)
 id 1bVWna-0002au-Ot; Fri, 05 Aug 2016 00:31:54 -0400
From: Mark H Weaver <mhw@HIDDEN>
References: <N1O-EYuO2QhvA6@HIDDEN>
Date: Fri, 05 Aug 2016 00:31:39 -0400
In-Reply-To: <N1O-EYuO2QhvA6@HIDDEN> (Glenn Michaels's message of "Fri, 
 29 Jul 2016 05:21:53 -0400")
Message-ID: <87a8grygyc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Hi Glenn,

"Glenn Michaels" <gmichaels@HIDDEN> writes:
> Currently, guile's (srfi srfi-111) module ("mutable boxes") provides
> an implementation based on records with a single value field.
>
> Wouldn't it make more sense to re-export the functions make-variable,
> variable?, variable-ref and variable-set! from the guile core as box,
> box?, unbox and set-box! respectively?
>
> These functions have the same signatures and the same semantics as
> required by the SRFI-111 spec., and they appear to be significantly
> faster than the current record-based implementation.
>
> Moreover, SRFI-111 boxes and guile variable objects are clearly
> semantically the same thing.

Unfortunately, they are not quite the same thing.  Unlike SRFI-111
boxes, Guile variables are a union type: they contain an arbitrary
Scheme value, *or* they may be "unbound".  For such a simple data type,
this added complication is semantically quite significant.

As a result, some important properties of SRFI-111 boxes do not hold for
your proposed implementation.  For example, in SRFI-111, (box? x)
implies that (box-ref x) will not raise an exception, and this fact can
be exploited by a compiler to produce better native code for 'box-ref'
when the type of its argument is known to be a box.  In such cases, I
guess 'box-ref' can be implemented as a single load instruction, whereas
'variable-ref' will require a conditional branch.

Especially for such a simple and fundamental data type, I think it's
important to retain precisely the specified semantics, without *any*
additional complexity.  For this reason, I am opposed to this change.

What do you think?

    Regards,
      Mark




Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
Resent-From: Mark H Weaver <mhw@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Fri, 05 Aug 2016 04:38:02 +0000
Resent-Message-ID: <handler.24102.B24102.14703718798896 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: patch
To: "Glenn Michaels" <gmichaels@HIDDEN>
Cc: Andy Wingo <wingo@HIDDEN>, 24102 <at> debbugs.gnu.org
Received: via spool by 24102-submit <at> debbugs.gnu.org id=B24102.14703718798896
          (code B ref 24102); Fri, 05 Aug 2016 04:38:02 +0000
Received: (at 24102) by debbugs.gnu.org; 5 Aug 2016 04:37:59 +0000
Received: from localhost ([127.0.0.1]:56033 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bVWtT-0002JP-28
	for submit <at> debbugs.gnu.org; Fri, 05 Aug 2016 00:37:59 -0400
Received: from world.peace.net ([50.252.239.5]:42140)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1bVWtR-0002JC-B8
 for 24102 <at> debbugs.gnu.org; Fri, 05 Aug 2016 00:37:57 -0400
Received: from pool-71-174-42-86.bstnma.east.verizon.net ([71.174.42.86]
 helo=jojen)
 by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mhw@HIDDEN>)
 id 1bVWtL-0002cR-Pg; Fri, 05 Aug 2016 00:37:51 -0400
From: Mark H Weaver <mhw@HIDDEN>
References: <N1O-EYuO2QhvA6@HIDDEN> <87a8grygyc.fsf@HIDDEN>
Date: Fri, 05 Aug 2016 00:37:40 -0400
In-Reply-To: <87a8grygyc.fsf@HIDDEN> (Mark H. Weaver's message of "Fri, 05
 Aug 2016 00:31:39 -0400")
Message-ID: <8760rfygob.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Mark H Weaver <mhw@HIDDEN> writes:

> As a result, some important properties of SRFI-111 boxes do not hold for
> your proposed implementation.  For example, in SRFI-111, (box? x)
> implies that (box-ref x) will not raise an exception, and this fact can
> be exploited by a compiler to produce better native code for 'box-ref'
> when the type of its argument is known to be a box.  In such cases, I
> guess 'box-ref' can be implemented as a single load instruction, whereas
> 'variable-ref' will require a conditional branch.

s/box-ref/unbox/g

     Mark




Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
References: <N1O-EYuO2QhvA6@HIDDEN>
In-Reply-To: <N1O-EYuO2QhvA6@HIDDEN>
Resent-From: "Glenn Michaels" <gmichaels@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Thu, 18 Aug 2016 13:08:01 +0000
Resent-Message-ID: <handler.24102.B24102.14715256556577 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: patch
To: mhw@HIDDEN
Cc: wingo@HIDDEN, 24102 <at> debbugs.gnu.org
Received: via spool by 24102-submit <at> debbugs.gnu.org id=B24102.14715256556577
          (code B ref 24102); Thu, 18 Aug 2016 13:08:01 +0000
Received: (at 24102) by debbugs.gnu.org; 18 Aug 2016 13:07:35 +0000
Received: from localhost ([127.0.0.1]:60992 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1baN2k-0001i0-Px
	for submit <at> debbugs.gnu.org; Thu, 18 Aug 2016 09:07:34 -0400
Received: from orange.safe-mail.net ([212.29.227.81]:59706)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gmichaels@HIDDEN>) id 1baN2i-0001hq-LH
 for 24102 <at> debbugs.gnu.org; Thu, 18 Aug 2016 09:07:33 -0400
Received: by orange.safe-mail.net with Safe-mail (Exim 4.84)
 (envelope-from <gmichaels@HIDDEN>)
 id 1baN2c-00087R-Nr; Thu, 18 Aug 2016 09:07:26 -0400
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=N1-0105; d=Safe-mail.net;
 b=r+IeCNqPeNwbxUMeFLwL5iqQbFNbjunvxChEvfn7kZGNyg57rLBvFidL7sUWSFfM
 Qx/8+U4a5o4yFLQqGoW331WmQX/cojeBnVw3KFirlOso3aN4kS269RBsQcfz3qOQ
 hxTS9ADtbxqlfHVdLUxUh8uCeHaAc+1xbt6FCvGzSuk=;
Received: from pc ([94.23.150.95]) by Safe-mail.net with https
Date: Thu, 18 Aug 2016 09:07:26 -0400
From: "Glenn Michaels" <gmichaels@HIDDEN>
X-SMType: Regular
X-SMRef: N1O-ZjEQGzKD9q
Message-Id: <N1O-ZjEQGzKD9q@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-SMSignature: cdraO/6yuzI+eo8xaumcS353o4SAfanB0vXSGxTCe5KEpsDkLHCbJ0+H6XjdxR6Q
 +XBbQ0F2II/79ELFOGwQSKZ5Je2NswJAGM8G+FGtI9VtvFpO6c5YtKj1OlC818cm
 wCEGASj4KbAFaE+Gpyi+QaYy+mQ5VWEjgynVYdsdqps=
X-Spam-Score: -1.2 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.2 (-)

Sorry for the delayed response.

Mark H Weaver <mhw@HIDDEN> writes:
> > Moreover, SRFI-111 boxes and guile variable objects are clearly
> > semantically the same thing.

> Unfortunately, they are not quite the same thing.  Unlike SRFI-111
> boxes, Guile variables are a union type: they contain an arbitrary
> Scheme value, *or* they may be "unbound".  For such a simple data type,
> this added complication is semantically quite significant.
> As a result, some important properties of SRFI-111 boxes do not hold for
> your proposed implementation.  For example, in SRFI-111, (box? x)
> implies that (box-ref x) will not raise an exception

You're right. They aren't exactly the same, it would be more correct
to say that boxes are equivalent to bound variables. Thus box? should
be defined as:

(define (box? o) (and (variable? o) (variable-bound? o)))

That way, (box-ref o) is guaranteed to work whenever (box? o) holds.

I'm suggesting that in current versions of Guile, implementing
SRFI-111 boxes via variables is faster that the current implementation
using records. With the definition of box? as above, it would be
semantically correct.

If a future guile compiler can implement boxes more efficiently in a
different representation, there's nothing to stop you switching to
that representation when the time comes. Making this simple change now
doesn't prevent you from doing something different in future. I'm not
suggesting that you should necessarily *guarantee* that boxes will always 
be implemented using variables.

> this fact can be exploited by a compiler to produce better native code for
> 'box-ref' when the type of its argument is known to be a box.  In such cases,
> I guess 'box-ref' can be implemented as a single load instruction, whereas
> 'variable-ref' will require a conditional branch.

With respect to what you say about compiler optimizations: In order to
implement a given call to unbox with a single load instruction, the
compiler would have to prove that the argument is a box, i.e. that it
satisfies the box? predicate.

You could also implement calls to variable-ref with a single
load instruction in cases where the compiler can prove that the
argument is a bound variable, i.e. that it satisfies
(and (variable? o) (variable-bound? o)) -- precisely the definition of
box? above.

Therefore it seems to me that whether you can perform this
optimization or not in a given case depends not so much on whether
boxes and variables are distinct types, but on how much information the
compiler can infer statically about each variable (in the general sense)
reference at a given point the program.

However, this discussing is academic insomuch as AFAICT the
current guile compiler currently performs neither optimization.




Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
Resent-From: Mark H Weaver <mhw@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Thu, 18 Aug 2016 16:15:01 +0000
Resent-Message-ID: <handler.24102.B24102.147153688524757 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: patch
To: "Glenn Michaels" <gmichaels@HIDDEN>
Cc: wingo@HIDDEN, 24102 <at> debbugs.gnu.org
Received: via spool by 24102-submit <at> debbugs.gnu.org id=B24102.147153688524757
          (code B ref 24102); Thu, 18 Aug 2016 16:15:01 +0000
Received: (at 24102) by debbugs.gnu.org; 18 Aug 2016 16:14:45 +0000
Received: from localhost ([127.0.0.1]:33566 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1baPxt-0006RF-8S
	for submit <at> debbugs.gnu.org; Thu, 18 Aug 2016 12:14:45 -0400
Received: from world.peace.net ([50.252.239.5]:60290)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1baPxr-0006Qz-0I
 for 24102 <at> debbugs.gnu.org; Thu, 18 Aug 2016 12:14:43 -0400
Received: from pool-71-174-43-186.bstnma.east.verizon.net ([71.174.43.186]
 helo=jojen)
 by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mhw@HIDDEN>)
 id 1baPxl-0003U6-2Z; Thu, 18 Aug 2016 12:14:37 -0400
From: Mark H Weaver <mhw@HIDDEN>
References: <N1O-ZjEQGzKD9q@HIDDEN>
Date: Thu, 18 Aug 2016 12:14:24 -0400
In-Reply-To: <N1O-ZjEQGzKD9q@HIDDEN> (Glenn Michaels's message of "Thu, 
 18 Aug 2016 09:07:26 -0400")
Message-ID: <87pop6uk9r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

"Glenn Michaels" <gmichaels@HIDDEN> writes:

> Sorry for the delayed response.
>
> Mark H Weaver <mhw@HIDDEN> writes:
>> > Moreover, SRFI-111 boxes and guile variable objects are clearly
>> > semantically the same thing.
>
>> Unfortunately, they are not quite the same thing.  Unlike SRFI-111
>> boxes, Guile variables are a union type: they contain an arbitrary
>> Scheme value, *or* they may be "unbound".  For such a simple data type,
>> this added complication is semantically quite significant.
>> As a result, some important properties of SRFI-111 boxes do not hold for
>> your proposed implementation.  For example, in SRFI-111, (box? x)
>> implies that (box-ref x) will not raise an exception
>
> You're right. They aren't exactly the same, it would be more correct
> to say that boxes are equivalent to bound variables. Thus box? should
> be defined as:
>
> (define (box? o) (and (variable? o) (variable-bound? o)))
>
> That way, (box-ref o) is guaranteed to work whenever (box? o) holds.

The problem is, a variable that is bound can later become unbound.  In
SRFI 111, if (box? x) is _ever_ true, then it will always remain true.
With your proposed definition above, that is not the case.  Whether a
variable is bound is part of its mutable state.

> If a future guile compiler can implement boxes more efficiently in a
> different representation, there's nothing to stop you switching to
> that representation when the time comes.

If we adopted your suggestion, it's likely that some users would come to
rely on the fact that boxes are actually variables, with this extra
"feature" of supporting the "unbound" state, and then we wouldn't be
able to remove that feature without breaking existing code.

>> this fact can be exploited by a compiler to produce better native code for
>> 'box-ref' when the type of its argument is known to be a box.  In such cases,
>> I guess 'box-ref' can be implemented as a single load instruction, whereas
>> 'variable-ref' will require a conditional branch.
>
> With respect to what you say about compiler optimizations: In order to
> implement a given call to unbox with a single load instruction, the
> compiler would have to prove that the argument is a box, i.e. that it
> satisfies the box? predicate.

Right, and the compiler that will be in Guile 2.2.x already has the
ability to perform this kind of type inference.

> You could also implement calls to variable-ref with a single
> load instruction in cases where the compiler can prove that the
> argument is a bound variable, i.e. that it satisfies
> (and (variable? o) (variable-bound? o)) -- precisely the definition of
> box? above.

It would very rarely be possible to prove that in practice, because the
"bound"-ness of a variable can change with time, and because in Scheme
it is very common to call procedures whose body is unknown at
compile-time, during which the bound-ness of the variable could change.
This is not a problem with SRFI-111 boxes, which will never change to
anything else.

> However, this discussing is academic insomuch as AFAICT the
> current guile compiler currently performs neither optimization.

As I wrote above, the current guile compiler can already do this kind of
type inference, although it does not currently do this for boxes.
However, we can already anticipate having native code generation in the
next couple of years, and we must keep boxes semantically simple so that
our future compiler will be able to generate good code for this very
important fundamental type.

Does that make sense?

       Mark




Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
Resent-From: Andy Wingo <wingo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Wed, 31 Aug 2016 09:04:02 +0000
Resent-Message-ID: <handler.24102.B24102.147263419913818 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: patch
To: Mark H Weaver <mhw@HIDDEN>
Cc: 24102 <at> debbugs.gnu.org, Glenn Michaels <gmichaels@HIDDEN>
Received: via spool by 24102-submit <at> debbugs.gnu.org id=B24102.147263419913818
          (code B ref 24102); Wed, 31 Aug 2016 09:04:02 +0000
Received: (at 24102) by debbugs.gnu.org; 31 Aug 2016 09:03:19 +0000
Received: from localhost ([127.0.0.1]:44946 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bf1QV-0003ao-4N
	for submit <at> debbugs.gnu.org; Wed, 31 Aug 2016 05:03:19 -0400
Received: from pb-sasl2.pobox.com ([64.147.108.67]:58541
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bf1QT-0003ag-Gy
 for 24102 <at> debbugs.gnu.org; Wed, 31 Aug 2016 05:03:17 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 2A08D348E9;
 Wed, 31 Aug 2016 05:03:16 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=sasl; bh=gkedl1/78qmBFRBfCkWrvv7+ftg=; b=b5S8M1
 /lfQ7J+5/L6GLYzpWIsSk7xbtesUBsfjJOM33zwTzqKVk7ORs1tR1RNW4WuTiz6M
 +UrXN3IXxaN04TPKnj5GX8C3bC4KLbR7yObC8sFM8HOr9z9ptI15yPOtF7ZT96PQ
 U+Bbf8DJnrCDjE11DF+acY46kh8IBID9t9Cys=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; q=dns; s=sasl; b=Pb552nxPqD1yGvBxofNNyLSOdXgzOVsK
 hz4WY+9VpobGJ8+J6brDd7VfedDDetHCMD+J3XFQ++kPU7Wd3VpFajbWhUMS0ByN
 8ne5uzZ8285kY6SaW/qabG+e4pkcaNBk2cczFRiK+0IEcxRzmQ9rtuPX20vDFizf
 UEDgqXUeags=
Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 2026C348E8;
 Wed, 31 Aug 2016 05:03:16 -0400 (EDT)
Received: from clucks (unknown [88.160.190.192])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by pb-sasl2.pobox.com (Postfix) with ESMTPSA id ABB96348E6;
 Wed, 31 Aug 2016 05:03:12 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
References: <N1O-ZjEQGzKD9q@HIDDEN> <87pop6uk9r.fsf@HIDDEN>
Date: Wed, 31 Aug 2016 11:03:05 +0200
In-Reply-To: <87pop6uk9r.fsf@HIDDEN> (Mark H. Weaver's message of "Thu, 18
 Aug 2016 12:14:24 -0400")
Message-ID: <87wpixjoom.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: BEFB9130-6F59-11E6-A79A-0CE5F1301B6D-02397024!pb-sasl2.pobox.com
X-Spam-Score: -1.5 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.5 (-)

On Thu 18 Aug 2016 18:14, Mark H Weaver <mhw@HIDDEN> writes:

> As I wrote above, the current guile compiler can already do this kind of
> type inference, although it does not currently do this for boxes.
> we can already anticipate having native code generation in the
> next couple of years, and we must keep boxes semantically simple so that
> our future compiler will be able to generate good code for this very
> important fundamental type.

For what it's worth, I don't see the optimization argument as weighing
very heavily on this discussion.  I would rather have fewer fundamental
data types rather than more, in the next two years or so.  I see the
mid-term result here being that SRFI-111 boxes are much slower than
variables.

The highest performance compilation tier we can imagine would include
adaptive optimization, and when it runs you can know that the variables
that a bit of code uses are bound or not.  Also in that case we can
reasonably make any call to variable-unset! deoptimize any code that
uses variables, forcing it to reoptimize later.  Since variable-unset!
is quite rare this is no big deal I think.

Andy




Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#24102: Use guile variable objects as SRFI-111 boxes.
Resent-From: Andy Wingo <wingo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Wed, 01 Mar 2017 08:52:01 +0000
Resent-Message-ID: <handler.24102.B24102.148835830028098 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 24102
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: patch
To: Mark H Weaver <mhw@HIDDEN>
Cc: 24102 <at> debbugs.gnu.org, Glenn Michaels <gmichaels@HIDDEN>
Received: via spool by 24102-submit <at> debbugs.gnu.org id=B24102.148835830028098
          (code B ref 24102); Wed, 01 Mar 2017 08:52:01 +0000
Received: (at 24102) by debbugs.gnu.org; 1 Mar 2017 08:51:40 +0000
Received: from localhost ([127.0.0.1]:60956 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cizz1-0007J7-Nv
	for submit <at> debbugs.gnu.org; Wed, 01 Mar 2017 03:51:39 -0500
Received: from pb-sasl1.pobox.com ([64.147.108.66]:55749
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1cizyz-0007J0-T4
 for 24102 <at> debbugs.gnu.org; Wed, 01 Mar 2017 03:51:38 -0500
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id 7DD8B48DBC;
 Wed,  1 Mar 2017 03:51:37 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=sasl; bh=1FFTIkwuhYzkRbO8aRIG1ONhGT4=; b=lqzoHi
 B54X3OeOqcQ6jheajL2f9sLtrGWGPRxz/z08MiEqU8dg28Z+PuXJvGC6axYJCpdX
 j6daWFjT7rA2aTrMSEFJUgTh2O3yfvjyVczUx2SVCiY8s+68B+1D/hcYRMHrJHlA
 pKciN7/Zk+12pBKyQQVJqlk1SvH47RY//9PFU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; q=dns; s=sasl; b=CkBTlTXv1lKukGtIDNQzdQP7HxEQ92QS
 7e3SLeT21yfXKfbkC4lMvxK/EauFgkdO+gx04r+aZC/SOEeq6pPZTqMmVDo8VaFw
 BQFfRws4NKF23r3FdaYBweGuh2AlUxWtSoLd/h1e9ipyZre6hek0+1SoHmovAK7K
 06dpSxNcBK8=
Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id 6757548DBA;
 Wed,  1 Mar 2017 03:51:37 -0500 (EST)
Received: from clucks (unknown [109.190.228.233])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 747EB48DB9;
 Wed,  1 Mar 2017 03:51:36 -0500 (EST)
From: Andy Wingo <wingo@HIDDEN>
References: <N1O-ZjEQGzKD9q@HIDDEN> <87pop6uk9r.fsf@HIDDEN>
 <87wpixjoom.fsf@HIDDEN>
Date: Wed, 01 Mar 2017 09:51:29 +0100
In-Reply-To: <87wpixjoom.fsf@HIDDEN> (Andy Wingo's message of "Wed, 31 Aug
 2016 11:03:05 +0200")
Message-ID: <87fuixjs6m.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 47366E08-FE5C-11E6-AF44-B667064AB293-02397024!pb-sasl1.pobox.com
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On Wed 31 Aug 2016 11:03, Andy Wingo <wingo@HIDDEN> writes:

> On Thu 18 Aug 2016 18:14, Mark H Weaver <mhw@HIDDEN> writes:
>
>> As I wrote above, the current guile compiler can already do this kind of
>> type inference, although it does not currently do this for boxes.
>> we can already anticipate having native code generation in the
>> next couple of years, and we must keep boxes semantically simple so that
>> our future compiler will be able to generate good code for this very
>> important fundamental type.
>
> For what it's worth, I don't see the optimization argument as weighing
> very heavily on this discussion.  I would rather have fewer fundamental
> data types rather than more, in the next two years or so.  I see the
> mid-term result here being that SRFI-111 boxes are much slower than
> variables.
>
> The highest performance compilation tier we can imagine would include
> adaptive optimization, and when it runs you can know that the variables
> that a bit of code uses are bound or not.  Also in that case we can
> reasonably make any call to variable-unset! deoptimize any code that
> uses variables, forcing it to reoptimize later.  Since variable-unset!
> is quite rare this is no big deal I think.

Following up here :)  So again I think the optimization argument is not
so important; if that were the only consideration then IMO the balance
of things would be that we should apply Glenn's patch.

There is a semantic consideration as well -- box-ref on a box created by
make-box should never throw an exception, and code that uses the
SRFI-111 should be able to rely on this.  We should probably not
introduce a gratuitous incompatibility here.  I propose to add a flag to
variables indicating that certain variables may not be unset.  We can
also consider reversing this, in that only variables with the flag can
be unset; my understanding is that the only user of variable-unset! is
the Elisp language on variables that it creates, so that would be
acceptable too.

Andy





Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.