From unknown Sun Jun 15 13:01:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11196: missing constructor procedure in new srfi-9 records Resent-From: Klaus Stehle Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 07 Apr 2012 20:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11196 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 11196@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.133382888313175 (code B ref -1); Sat, 07 Apr 2012 20:02:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Apr 2012 20:01:23 +0000 Received: from localhost ([127.0.0.1]:44168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGbp3-0003QQ-FP for submit@debbugs.gnu.org; Sat, 07 Apr 2012 16:01:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50505) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGbjX-0003Hg-VI for submit@debbugs.gnu.org; Sat, 07 Apr 2012 15:55:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SGbim-0005Wa-OP for submit@debbugs.gnu.org; Sat, 07 Apr 2012 15:54:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:38422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGbim-0005WW-Kq for submit@debbugs.gnu.org; Sat, 07 Apr 2012 15:54:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGbil-0002pw-0T for bug-guile@gnu.org; Sat, 07 Apr 2012 15:54:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SGbij-0005WD-2I for bug-guile@gnu.org; Sat, 07 Apr 2012 15:54:50 -0400 Received: from mx08.uni-tuebingen.de ([134.2.3.6]:38834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGbii-0005UB-PZ for bug-guile@gnu.org; Sat, 07 Apr 2012 15:54:48 -0400 Received: from commlink.zdv.uni-tuebingen.de (commlink.zdv.uni-tuebingen.de [134.2.2.101]) by mx08.uni-tuebingen.de (8.13.6/8.13.6) with ESMTP id q37Jwwc7028571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 7 Apr 2012 21:58:59 +0200 Date: Sat, 7 Apr 2012 21:54:34 +0200 (CEST) From: Klaus Stehle X-X-Sender: knaks01@commlink.zdv.uni-tuebingen.de Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-AntiVirus-Spam-Check: clean (checked by Avira MailGate: version: 3.2.1.23; spam filter version: 3.2.0/2.3; host: mx08) X-AntiVirus: checked by Avira MailGate (version: 3.2.1.23; AVE: 8.2.5.34; VDF: 7.11.10.215; host: mx08); id=9054-y6HHHw X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Mailman-Approved-At: Sat, 07 Apr 2012 16:01:19 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Hi, ;;;; A short example script to describe the problem: (use-modules (srfi srfi-9)) ;; A simple record definition for example (define-record-type my-record (make-my-record one two) my-record? (one my-one) (two my-two)) ;; "Normal" construction is working well (define r1 (make-my-record "1" "2")) ;; This should also work, but it doesn't! (define r2 ((record-constructor my-record) "1" "2")) => ERROR ;; Where's the constructor procedure? (display (record-constructor my-record)) (newline) => #f The bug is located in the new srfi-9.scm which forgets to set the record's constructor procedure. The following patch may help (hoping not to introduce new problems): --- srfi-9.scm 2012-04-06 16:52:02.000000000 +0200 +++ srfi-9.scm 2012-04-06 17:14:36.000000000 +0200 @@ -188,7 +188,9 @@ (let* ((fields (field-identifiers #'(field-spec ...))) (field-count (length fields)) (layout (string-concatenate (make-list field-count "pw"))) - (indices (field-indices (map syntax->datum fields)))) + (indices (field-indices (map syntax->datum fields))) + (ctor-proc (syntax-case #'constructor-spec () + ((func args ...) (syntax func))))) #`(begin (define type-name (let ((rtd (make-struct/no-tail @@ -204,7 +206,7 @@ (eq? (struct-vtable obj) type-name))) #,(constructor #'type-name #'constructor-spec indices) - + (struct-set! type-name (+ 2 vtable-offset-user) #,ctor-proc) #,@(accessors #'type-name #'(field-spec ...) indices))))))) ;;; srfi-9.scm ends here Cheers, Klaus Stehle ---------------------------- guile --version guile (GNU Guile) 2.0.5 uname -srm Linux 2.6.32-5-amd64 x86_64 From unknown Sun Jun 15 13:01:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11196: missing constructor procedure in new srfi-9 records Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 09 Apr 2012 21:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11196 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Klaus Stehle Cc: 11196@debbugs.gnu.org Received: via spool by 11196-submit@debbugs.gnu.org id=B11196.133400653212268 (code B ref 11196); Mon, 09 Apr 2012 21:23:02 +0000 Received: (at 11196) by debbugs.gnu.org; 9 Apr 2012 21:22:12 +0000 Received: from localhost ([127.0.0.1]:47412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHM2N-0003Bp-Jq for submit@debbugs.gnu.org; Mon, 09 Apr 2012 17:22:11 -0400 Received: from xanadu.aquilenet.fr ([88.191.123.111]:59934) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHM2L-0003Bg-CF for 11196@debbugs.gnu.org; Mon, 09 Apr 2012 17:22:10 -0400 Received: from localhost (xanadu.aquilenet.fr [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id F38E17609; Mon, 9 Apr 2012 23:21:10 +0200 (CEST) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qA4E9MM5UBbr; Mon, 9 Apr 2012 23:21:10 +0200 (CEST) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 4EF73E4D; Mon, 9 Apr 2012 23:21:10 +0200 (CEST) From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: Date: Mon, 09 Apr 2012 23:21:09 +0200 In-Reply-To: (Klaus Stehle's message of "Sat, 7 Apr 2012 21:54:34 +0200 (CEST)") Message-ID: <87bon0a9fe.fsf@gnu.org> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) Hi Klaus, Klaus Stehle skribis: > (use-modules (srfi srfi-9)) > > ;; A simple record definition for example > (define-record-type my-record > (make-my-record one two) > my-record? > (one my-one) > (two my-two)) > > ;; "Normal" construction is working well > (define r1 (make-my-record "1" "2")) > > ;; This should also work, but it doesn't! > (define r2 ((record-constructor my-record) "1" "2")) > =3D> ERROR The use of =E2=80=98record-constructor=E2=80=99 above relies on a implement= ation detail of the SRFI-9 implementation in Guile 1.8=E2=80=93namely, that SRFI-9 recor= ds were implemented in terms of =E2=80=9CGuile records=E2=80=9D (info "(guile)= Records"). In Guile 2.0, SRFI-9 records are no longer =E2=80=9CGuile records=E2=80=9D,= so they no longer have a =E2=80=9Crecord-type descriptor=E2=80=9D attached. Thus, =E2=80=98record-constructor=E2=80=99 cannot be used with them. Since you are using SRFI-9 anyway, I would recommend sticking to the mechanisms specified by SRFI-9, thus avoiding =E2=80=98record-constructor= =E2=80=99. How would it work for you? Thanks, Ludo=E2=80=99. From unknown Sun Jun 15 13:01:27 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Klaus Stehle Subject: bug#11196: closed (Re: bug#11196: missing constructor procedure in new srfi-9 records) Message-ID: References: <87bon08s67.fsf@gnu.org> X-Gnu-PR-Message: they-closed 11196 X-Gnu-PR-Package: guile Reply-To: 11196@debbugs.gnu.org Date: Mon, 09 Apr 2012 22:21:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1334010063-17559-1" This is a multi-part message in MIME format... ------------=_1334010063-17559-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #11196: missing constructor procedure in new srfi-9 records which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 11196@debbugs.gnu.org. --=20 11196: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D11196 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1334010063-17559-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 11196-close) by debbugs.gnu.org; 9 Apr 2012 22:20:16 +0000 Received: from localhost ([127.0.0.1]:47476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHMwa-0004YH-G2 for submit@debbugs.gnu.org; Mon, 09 Apr 2012 18:20:16 -0400 Received: from xanadu.aquilenet.fr ([88.191.123.111]:58302) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHMwW-0004Y8-Ua for 11196-close@debbugs.gnu.org; Mon, 09 Apr 2012 18:20:14 -0400 Received: from localhost (xanadu.aquilenet.fr [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id E510B7596; Tue, 10 Apr 2012 00:19:13 +0200 (CEST) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0AZi+bg2wY19; Tue, 10 Apr 2012 00:19:13 +0200 (CEST) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 5B5787589; Tue, 10 Apr 2012 00:19:12 +0200 (CEST) From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) To: Klaus Stehle Subject: Re: bug#11196: missing constructor procedure in new srfi-9 records References: Date: Tue, 10 Apr 2012 00:19:12 +0200 In-Reply-To: (Klaus Stehle's message of "Sat, 7 Apr 2012 21:54:34 +0200 (CEST)") Message-ID: <87bon08s67.fsf@gnu.org> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 11196-close Cc: 11196-close@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) Hi Klaus, Please forget my previous message. SRFI-9 in Guile 2.0 _is_ actually implemented in terms of =E2=80=9CGuile records=E2=80=9D. So I applied a pa= tch similar to yours as commit 5ef102cc93a4f2eba0f5dad94a7306085b353000. Thanks! Ludo=E2=80=99. ------------=_1334010063-17559-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Apr 2012 20:01:23 +0000 Received: from localhost ([127.0.0.1]:44168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGbp3-0003QQ-FP for submit@debbugs.gnu.org; Sat, 07 Apr 2012 16:01:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50505) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGbjX-0003Hg-VI for submit@debbugs.gnu.org; Sat, 07 Apr 2012 15:55:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SGbim-0005Wa-OP for submit@debbugs.gnu.org; Sat, 07 Apr 2012 15:54:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:38422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGbim-0005WW-Kq for submit@debbugs.gnu.org; Sat, 07 Apr 2012 15:54:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGbil-0002pw-0T for bug-guile@gnu.org; Sat, 07 Apr 2012 15:54:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SGbij-0005WD-2I for bug-guile@gnu.org; Sat, 07 Apr 2012 15:54:50 -0400 Received: from mx08.uni-tuebingen.de ([134.2.3.6]:38834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGbii-0005UB-PZ for bug-guile@gnu.org; Sat, 07 Apr 2012 15:54:48 -0400 Received: from commlink.zdv.uni-tuebingen.de (commlink.zdv.uni-tuebingen.de [134.2.2.101]) by mx08.uni-tuebingen.de (8.13.6/8.13.6) with ESMTP id q37Jwwc7028571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 7 Apr 2012 21:58:59 +0200 Date: Sat, 7 Apr 2012 21:54:34 +0200 (CEST) From: Klaus Stehle X-X-Sender: knaks01@commlink.zdv.uni-tuebingen.de To: bug-guile@gnu.org Subject: missing constructor procedure in new srfi-9 records Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-AntiVirus-Spam-Check: clean (checked by Avira MailGate: version: 3.2.1.23; spam filter version: 3.2.0/2.3; host: mx08) X-AntiVirus: checked by Avira MailGate (version: 3.2.1.23; AVE: 8.2.5.34; VDF: 7.11.10.215; host: mx08); id=9054-y6HHHw X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 07 Apr 2012 16:01:19 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Hi, ;;;; A short example script to describe the problem: (use-modules (srfi srfi-9)) ;; A simple record definition for example (define-record-type my-record (make-my-record one two) my-record? (one my-one) (two my-two)) ;; "Normal" construction is working well (define r1 (make-my-record "1" "2")) ;; This should also work, but it doesn't! (define r2 ((record-constructor my-record) "1" "2")) => ERROR ;; Where's the constructor procedure? (display (record-constructor my-record)) (newline) => #f The bug is located in the new srfi-9.scm which forgets to set the record's constructor procedure. The following patch may help (hoping not to introduce new problems): --- srfi-9.scm 2012-04-06 16:52:02.000000000 +0200 +++ srfi-9.scm 2012-04-06 17:14:36.000000000 +0200 @@ -188,7 +188,9 @@ (let* ((fields (field-identifiers #'(field-spec ...))) (field-count (length fields)) (layout (string-concatenate (make-list field-count "pw"))) - (indices (field-indices (map syntax->datum fields)))) + (indices (field-indices (map syntax->datum fields))) + (ctor-proc (syntax-case #'constructor-spec () + ((func args ...) (syntax func))))) #`(begin (define type-name (let ((rtd (make-struct/no-tail @@ -204,7 +206,7 @@ (eq? (struct-vtable obj) type-name))) #,(constructor #'type-name #'constructor-spec indices) - + (struct-set! type-name (+ 2 vtable-offset-user) #,ctor-proc) #,@(accessors #'type-name #'(field-spec ...) indices))))))) ;;; srfi-9.scm ends here Cheers, Klaus Stehle ---------------------------- guile --version guile (GNU Guile) 2.0.5 uname -srm Linux 2.6.32-5-amd64 x86_64 ------------=_1334010063-17559-1--