1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +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:
Andy Wingo 2019-10-23 12:04:58 +02:00
parent f060f1a4e6
commit bebc46be14

View file

@ -1,7 +1,7 @@
;;; srfi-9.scm --- define-record-type
;; Copyright (C) 2001, 2002, 2006, 2009, 2010, 2011, 2012,
;; 2013, 2014, 2018 Free Software Foundation, Inc.
;; Copyright (C) 2001-2002, 2006, 2008-2014, 2018-2019
;; Free Software Foundation, Inc.
;;
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@ -315,16 +315,11 @@
#,(constructor #'form #'type-name #'constructor-spec field-ids)
(define type-name
(let ((rtd (make-struct/no-tail
record-type-vtable
'#,(datum->syntax #'here (make-struct-layout layout))
default-record-printer
'type-name
'#,field-ids
#f ; Constructor.
'(final) ; Flags.
#()))) ; Parents.
(set-struct-vtable-name! rtd 'type-name)
(let ((rtd (make-record-type 'type-name
'#,field-ids
default-record-printer)))
;; Allow record-type-constructor to return our
;; constructor.
(struct-set! rtd (+ 2 vtable-offset-user) #,ctor-name)
rtd))