summaryrefslogtreecommitdiff
path: root/guix/records.scm
Commit message (Collapse)AuthorAge
* records: Adjust to test changes in 'record-abi-mismatch-error'.Ludovic Courtès2018-08-31
| | | | | | | | | | Fixes a test failure introduced in de5cbd4a38a33e0412f1c481fe8e01a871dc13e5. * guix/records.scm (abi-check): Refer to TYPE in an unquoted context so we get at the RTD. * tests/records.scm ("ABI checks"): Adjust 'catch' handler to changes in the 'record-abi-mismatch-error' arguments.
* records: Adjust 'record-abi-mismatch-error' arguments.Ludovic Courtès2018-08-29
| | | | | | | | | | | | | | | | | | | | | | | Previously, 'display-error' (as used by 'warn-about-load-error', for instance) would be called with a wrong number of arguments when a 'record-abi-mismatch-error' was caught: warning: failed to load '(gnu tests install)': Backtrace: [...] ERROR: In procedure display-error: Wrong number of arguments to #<procedure display-error (_ _ _ _ _ _)> Now you get warnings and error reports as intended: warning: failed to load '(gnu tests install)': In procedure abi-check: <openssh-configuration>: record ABI mismatch; recompilation needed warning: failed to load '(gnu tests ssh)': In procedure abi-check: <openssh-configuration>: record ABI mismatch; recompilation needed * guix/records.scm (print-record-abi-mismatch-error): Remove. Remove top-level call to 'set-exception-printer!'. (abi-check): Use arguments as expected by 'display-error'.
* records: Make a couple of procedures available at expansion time.Ludovic Courtès2018-05-31
| | | | | * guix/records.scm (current-abi-identifier, abi-check): Wrap in 'eval-when'.
* records: Insert record type ABI checks in constructors.Ludovic Courtès2018-05-23
| | | | | | | | | | | * guix/records.scm (print-record-abi-mismatch-error): New procedure. <top level>: Add 'set-exception-printer!' call. (current-abi-identifier, abi-check): New procedures. (make-syntactic-constructor): Add #:abi-cookie parameter. Insert calls to 'abi-check'. (define-record-type*)[compute-abi-cookie]: New procedure. Use it and emit a definition of the 'current-abi-identifier' for TYPE. * tests/records.scm ("ABI checks"): New test.
* records: Use 'make-struct/no-tail'.Ludovic Courtès2017-12-01
| | | | | * guix/records.scm (make-syntactic-constructor): Use 'make-struct/no-tail' as 'make-struct' is deprecated as of 2.2.3.
* guix: records: Add match-record.nee2017-11-05
| | | | | | * guix/records.scm: New syntax-rule. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* records: Slight simplification.Ludovic Courtès2017-04-17
| | | | * guix/records.scm (make-syntactic-constructor): Simplify 'find' expression.
* records: Improve reporting of invalid field specifiers.Ludovic Courtès2016-07-14
| | | | | | | | | Fixes <http://bugs.gnu.org/23969>. Reported by Vincent Legoll <vincent.legoll@gmail.com>. * guix/records.scm (report-invalid-field-specifier): New procedure. * tests/records.scm ("define-record-type* & wrong field specifier"): New test.
* records: Remove unnecessary 'begin'.Ludovic Courtès2015-06-11
| | | | * guix/records.scm (define-record-type*): Remove unnecessary 'begin'.
* records: Add support for 'innate' fields.Ludovic Courtès2015-06-11
| | | | | | | | | | * 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.
* records: "options" → "properties".Ludovic Courtès2015-06-11
| | | | * guix/records.scm (define-record-type*): Change "options" to "properties".
* records: Factorize field property predicates.Ludovic Courtès2015-06-11
| | | | | * guix/records.scm (define-field-property-predicate): New macro. (define-record-type*)[thunked-field?, delayed-field?]: Use it.
* records: Separate default-value handling.Ludovic Courtès2015-06-11
| | | | | | | * guix/records.scm (make-syntactic-constructor)[default-values]: New variable. [field-default-value]: New procedure. Use them.
* records: Replace 'eval-when' with a proper 'define-syntax'.Ludovic Courtès2015-06-11
| | | | | * guix/records.scm (make-syntactic-constructor): Remove enclosing 'eval-when'. Turn into a 'syntax-rules' macro.
* records: Make 'make-syntactic-constructor' available at load/eval/expand.Ludovic Courtès2015-05-04
| | | | * guix/records.scm (make-syntactic-constructor): Wrap in 'eval-when'.
* records: Add support for delayed fields.Ludovic Courtès2015-01-19
| | | | | | | | | | | | | | | | | * 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.
* make-syntactic-constructor kwarg defaultLudovic Courtès2015-01-19
|
* records: Factorize value wrapping in the record constructor.Ludovic Courtès2015-01-19
| | | | | | * guix/records.scm (make-syntactic-constructor)[wrap-field-value]: New procedure. [field-bindings, field-value]: Use it.
* records: Move 'make-syntactic-constructor' to the top level.Ludovic Courtès2015-01-19
| | | | | * guix/records.scm (make-syntactic-constructor): New procedure, formerly nested in 'define-record-type*'.
* records: Use keyword parameters for 'make-syntactic-constructor'.Ludovic Courtès2015-01-19
| | | | | | | * 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.
* records: Optimize 'recutils->alist' by avoiding regexps.Ludovic Courtès2015-01-09
| | | | | | | | * 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.
* records: Improve the docstring of 'define-record-type*'.Ludovic Courtès2014-10-17
| | | | | * guix/records.scm (define-record-type*): Agument the docstring, give examples.
* records: Report unknown field names in inheriting forms.Ludovic Courtès2014-07-17
| | | | | | | | * 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.
* records: Factorize error-reporting macro.Ludovic Courtès2014-07-17
| | | | | | * guix/records.scm (record-error): New macro. (define-record-type*)[error*]: Remove. Use 'record-error' instead.
* records: define-record-type*: Field bindings are bound with 'let*'.Ludovic Courtès2013-10-15
| | | | | | | * 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.
* records: `recutils->alist' recognizes lines starting with a `+'.Ludovic Courtès2013-07-10
| | | | | | * guix/records.scm (%recutils-plus-rx): New variable. (recutils->alist): Use it to read + lines. * tests/records.scm ("recutils->alist with + lines"): New test.
* records: `alist->record' supports multiple-field occurrences.Ludovic Courtès2013-07-10
| | | | | | * guix/records.scm (alist->record): Add `multiple-value-keys' parameter. Update docstring, and honor it. * tests/records.scm ("alist->record"): New record.
* records: `recutils->alist' recognizes comments.Ludovic Courtès2013-07-10
| | | | | | * guix/records.scm (%recutils-comment-rx): New variable. (recutils->alist): Match comments. * tests/records.scm ("recutils->alist"): Add comments.
* records: Add `recutils->alist' for public consumption.Ludovic Courtès2013-07-10
| | | | | | | * 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.
* Move record utilities to (guix records).Ludovic Courtès2013-05-12
* 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.