summaryrefslogtreecommitdiff
path: root/guix/records.scm
AgeCommit message (Collapse)Author
2015-06-11records: Remove unnecessary 'begin'.Ludovic Courtès
* guix/records.scm (define-record-type*): Remove unnecessary 'begin'.
2015-06-11records: Add support for 'innate' fields.Ludovic Courtès
* guix/records.scm (make-syntactic-constructor): Add #:innate parameter. [record-inheritance]: Honor it. [innate-field?]: New procedure. (define-record-type*)[innate-field?]: New procedure. Pass #:innate to 'make-syntactic-constructor'. * tests/records.scm ("define-record-type* & inherit & innate", "define-record-type* & thunked & innate"): New tests.
2015-06-11records: "options" → "properties".Ludovic Courtès
* guix/records.scm (define-record-type*): Change "options" to "properties".
2015-06-11records: Factorize field property predicates.Ludovic Courtès
* guix/records.scm (define-field-property-predicate): New macro. (define-record-type*)[thunked-field?, delayed-field?]: Use it.
2015-06-11records: Separate default-value handling.Ludovic Courtès
* guix/records.scm (make-syntactic-constructor)[default-values]: New variable. [field-default-value]: New procedure. Use them.
2015-06-11records: Replace 'eval-when' with a proper 'define-syntax'.Ludovic Courtès
* guix/records.scm (make-syntactic-constructor): Remove enclosing 'eval-when'. Turn into a 'syntax-rules' macro.
2015-05-04records: Make 'make-syntactic-constructor' available at load/eval/expand.Ludovic Courtès
* guix/records.scm (make-syntactic-constructor): Wrap in 'eval-when'.
2015-01-19records: Add support for delayed fields.Ludovic Courtès
* guix/records.scm (make-syntactic-constructor): Add #:delayed parameter. [delayed-field?]: New procedure. [wrap-field-value]: Use it. (define-record-type*)[delayed-field?, wrapped-field?]: New procedures. [thunked-field-accessor-name]: Rename to... [wrapped-field-accessor-name]: ... this. [field-spec->srfi-9]: Change 'thunked' to 'wrapped'. [delayed-field-accessor-definition]: New procedure. Compute delayed-field accessors and emit them. Pass #:delayed to 'make-syntactic-constructor'. * tests/records.scm ("define-record-type* & delayed", "define-record-type* & delayed & default", "define-record-type* & delayed & inherited"): New tests.
2015-01-19make-syntactic-constructor kwarg defaultLudovic Courtès
2015-01-19records: Factorize value wrapping in the record constructor.Ludovic Courtès
* guix/records.scm (make-syntactic-constructor)[wrap-field-value]: New procedure. [field-bindings, field-value]: Use it.
2015-01-19records: Move 'make-syntactic-constructor' to the top level.Ludovic Courtès
* guix/records.scm (make-syntactic-constructor): New procedure, formerly nested in 'define-record-type*'.
2015-01-19records: Use keyword parameters for 'make-syntactic-constructor'.Ludovic Courtès
* guix/records.scm (define-record-type*)[make-syntactic-constructor]: Turn THUNKED and DEFAULTS into keyword arguments. Adjust caller accordingly. Declare 'thunked' and 'defaults' local variables.
2015-01-09records: Optimize 'recutils->alist' by avoiding regexps.Ludovic Courtès
* guix/records.scm (%recutils-field-rx, %recutils-comment-rx, %recutils-plus-rx): Remove. (%recutils-field-charset): New variable. (recutils->alist): Adjust to use tests (string-ref line 0) instead of regexps.
2014-10-17records: Improve the docstring of 'define-record-type*'.Ludovic Courtès
* guix/records.scm (define-record-type*): Agument the docstring, give examples.
2014-07-17records: Report unknown field names in inheriting forms.Ludovic Courtès
* guix/records.scm (define-record-type*)[record-inheritance]: Check for unexpected field names. * tests/records.scm ("define-record-type* with let* behavior"): Return #t, not *unspecified*. ("define-record-type* & inherit & extra initializers"): New test.
2014-07-17records: Factorize error-reporting macro.Ludovic Courtès
* guix/records.scm (record-error): New macro. (define-record-type*)[error*]: Remove. Use 'record-error' instead.
2013-10-15records: define-record-type*: Field bindings are bound with 'let*'.Ludovic Courtès
* guix/records.scm (define-record-type*): Wrap field bindings in a 'let*', not in a 'letrec*', which turned out to be pointlessly inconvenient. * tests/records.scm: Adjust test names accordingly.
2013-07-10records: `recutils->alist' recognizes lines starting with a `+'.Ludovic Courtès
* guix/records.scm (%recutils-plus-rx): New variable. (recutils->alist): Use it to read + lines. * tests/records.scm ("recutils->alist with + lines"): New test.
2013-07-10records: `alist->record' supports multiple-field occurrences.Ludovic Courtès
* guix/records.scm (alist->record): Add `multiple-value-keys' parameter. Update docstring, and honor it. * tests/records.scm ("alist->record"): New record.
2013-07-10records: `recutils->alist' recognizes comments.Ludovic Courtès
* guix/records.scm (%recutils-comment-rx): New variable. (recutils->alist): Match comments. * tests/records.scm ("recutils->alist"): Add comments.
2013-07-10records: Add `recutils->alist' for public consumption.Ludovic Courtès
* guix/records.scm (%recutils-field-rx): New variable. (recutils->alist): New procedure, formerly known as `fields->alist'. * guix/scripts/substitute-binary.scm (fields->alist): Use it. * tests/records.scm ("recutils->alist"): New test.
2013-05-12Move record utilities to (guix records).Ludovic Courtès
* guix/utils.scm (define-record-type*): Move to... * guix/records.scm: ... here. New file. * guix/build-system.scm, guix/packages.scm: Use it. * guix/gnu-maintenance.scm: Likewise. (official-gnu-packages)[alist->record]: Remove. * guix/scripts/substitute-binary.scm: Likewise. (alist->record, object->fields): Remove. * tests/utils.scm ("define-record-type*", "define-record-type* with letrec* behavior", "define-record-type* & inherit", "define-record-type* & inherit & letrec* behavior", "define-record-type* & thunked", "define-record-type* & thunked & default", "define-record-type* & thunked & inherited"): Move to... * tests/records.scm: ... here. New file.