mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
SRFI-9 uses make-record-type
* module/srfi/srfi-9.scm (%define-record-type): Use make-record-type, instead of rolling our own vtable. Shouldn't have any perf impact.
This commit is contained in:
parent
f060f1a4e6
commit
bebc46be14
1 changed files with 7 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
;;; srfi-9.scm --- define-record-type
|
;;; srfi-9.scm --- define-record-type
|
||||||
|
|
||||||
;; Copyright (C) 2001, 2002, 2006, 2009, 2010, 2011, 2012,
|
;; Copyright (C) 2001-2002, 2006, 2008-2014, 2018-2019
|
||||||
;; 2013, 2014, 2018 Free Software Foundation, Inc.
|
;; Free Software Foundation, Inc.
|
||||||
;;
|
;;
|
||||||
;; This library is free software; you can redistribute it and/or
|
;; This library is free software; you can redistribute it and/or
|
||||||
;; modify it under the terms of the GNU Lesser General Public
|
;; modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -315,16 +315,11 @@
|
||||||
#,(constructor #'form #'type-name #'constructor-spec field-ids)
|
#,(constructor #'form #'type-name #'constructor-spec field-ids)
|
||||||
|
|
||||||
(define type-name
|
(define type-name
|
||||||
(let ((rtd (make-struct/no-tail
|
(let ((rtd (make-record-type 'type-name
|
||||||
record-type-vtable
|
|
||||||
'#,(datum->syntax #'here (make-struct-layout layout))
|
|
||||||
default-record-printer
|
|
||||||
'type-name
|
|
||||||
'#,field-ids
|
'#,field-ids
|
||||||
#f ; Constructor.
|
default-record-printer)))
|
||||||
'(final) ; Flags.
|
;; Allow record-type-constructor to return our
|
||||||
#()))) ; Parents.
|
;; constructor.
|
||||||
(set-struct-vtable-name! rtd 'type-name)
|
|
||||||
(struct-set! rtd (+ 2 vtable-offset-user) #,ctor-name)
|
(struct-set! rtd (+ 2 vtable-offset-user) #,ctor-name)
|
||||||
rtd))
|
rtd))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue