records: Allow thunked fields to refer to 'this-record'.
authorLudovic Courtès <ludo@gnu.org>
Fri, 22 Mar 2019 13:02:00 +0000 (14:02 +0100)
committerLudovic Courtès <ludo@gnu.org>
Mon, 25 Mar 2019 22:37:06 +0000 (23:37 +0100)
commitabd4d6b33dba4de228e90ad15a8efb456fcf7b6e
tree82851cffc3953f138df72fee42a2f5d801dde005
parent3191b5f6ba5ebbb59a7448facd999ad7f7aeae79
records: Allow thunked fields to refer to 'this-record'.

* guix/records.scm (this-record): New syntax parameter.
(make-syntactic-constructor)[wrap-field-value]: When F is thunked,
return a one-argument lambda instead of a thunk, and parameterize
THIS-RECORD.
(define-record-type*)[thunked-field-accessor-definition]: Pass X
to (real-get X).
* tests/records.scm ("define-record-type* & thunked & this-record")
("define-record-type* & thunked & default & this-record")
("define-record-type* & thunked & inherit & this-record"): New tests.
guix/records.scm
tests/records.scm