emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#11196: closed (missing constructor procedure in ne


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#11196: closed (missing constructor procedure in new srfi-9 records)
Date: Mon, 09 Apr 2012 22:21:02 +0000

Your message dated Tue, 10 Apr 2012 00:19:12 +0200
with message-id <address@hidden>
and subject line Re: bug#11196: missing constructor procedure in new srfi-9 
records
has caused the debbugs.gnu.org bug report #11196,
regarding missing constructor procedure in new srfi-9 records
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
11196: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11196
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: missing constructor procedure in new srfi-9 records Date: Sat, 7 Apr 2012 21:54:34 +0200 (CEST)
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



--- End Message ---
--- Begin Message --- Subject: Re: bug#11196: missing constructor procedure in new srfi-9 records Date: Tue, 10 Apr 2012 00:19:12 +0200 User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux)
Hi Klaus,

Please forget my previous message.  SRFI-9 in Guile 2.0 _is_ actually
implemented in terms of “Guile records”.  So I applied a patch similar
to yours as commit 5ef102cc93a4f2eba0f5dad94a7306085b353000.

Thanks!

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]