Age | Commit message (Collapse) | Author |
|
* guix/records.scm (lookup-field+wrapper): Attach source properties to the
field syntax object instead.
|
|
* guix/records.scm (match-record-lambda): New syntax.
* tests/records.scm ("match-record-lambda"): New test.
Signed-off-by: Josselin Poiret <dev@jpoiret.xyz>
|
|
* guix/records.scm (match-record): Unwrap matched thunked and delayed fields.
* tests/records.scm ("match-record, thunked field",
"match-record, delayed field"): New tests.
Signed-off-by: Josselin Poiret <dev@jpoiret.xyz>
|
|
* guix/records.scm (match-record): Raise a human-compherensible syntax error
if the given record type identifier is unbound.
Co-authored-by: Josselin Poiret <dev@jpoiret.xyz>
Signed-off-by: Josselin Poiret <dev@jpoiret.xyz>
|
|
This was obtained by setting up this environment:
guix shell -D guix --with-input=guile@3.0.9=guile-next \
--with-commit=guile-next=e2ed33ef0445c867fe56c247054aa67e834861f2
-- make -j5
then adding 'unused-module' to (@@ (guix build compiler) %warnings),
building, and checking all the "unused module" warnings and removing
those that were definitely unused.
|
|
An example:
(match-record obj <my-type>
(field1 (field2 custom-var-name) field3)
...)
* guix/records.scm (match-record-inner): Add support for the new syntax.
* tests/records.scm ("match-record, simple"): Add a simple test case for the
new syntax.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
|
|
This allows 'match-record' to be more efficient (field offsets are
computed at compilation time) and to report unknown fields at
macro-expansion time.
* guix/records.scm (map-fields): New macro.
(define-record-type*)[rtd-identifier]: New procedure.
Define TYPE as a macro and use a separate identifier for the RTD.
(lookup-field, match-record-inner): New macros.
(match-record): Rewrite in terms of 'match-error-inner'.
* tests/records.scm ("match-record, simple")
("match-record, unknown field"): New tests.
* gnu/services/cuirass.scm (cuirass-shepherd-service): Rename 'log-file'
local variable to 'main-log-file'.
* gnu/services/getmail.scm (serialize-getmail-configuration-file): Move
after <getmail-configuration-file> definition.
|
|
* guix/records.scm (make-syntactic-constructor): Add #:sanitizers.
[field-sanitizer]: New procedure.
[wrap-field-value]: Honor F's sanitizer.
(define-record-type*)[field-sanitizer]: New procedure.
Pass #:sanitizer to 'make-syntactic-constructor'.
* tests/records.scm ("define-record-type* & sanitize")
("define-record-type* & sanitize & thunked"): New tests.
|
|
Reported by Jan (janneke) Nieuwenhuizen <janneke@gnu.org>.
* guix/records.scm (define-record-type*): Use
'target-most-positive-fixnum' on Guile 3 instead of 'most-positive-fixnum'.
|
|
Previously users would just see:
error: invalid field specifier
without source location or hints.
* guix/records.scm (expand): Add optional 'parent-form' parameter and
pass it to 'syntax-violation' when it is true.
(make-syntactic-constructor): Pass S as a third argument to
'report-invalid-field-specifier'.
* guix/ui.scm (report-load-error): For 'syntax-error', show SUBFORM or
FORM in the message.
* tests/records.scm ("define-record-type* & wrong field specifier"): Add
a 'subform' parameter and adjust test accordingly.
("define-record-type* & wrong field specifier, identifier"): New test.
* tests/guix-system.sh: Add test.
|
|
This lets record users choose an identifier other than 'this-record'.
* guix/records.scm (make-syntactic-constructor): Add #:this-identifier.
[wrap-field-value]: Honor it.
(define-record-type*): Add form with extra THIS-IDENTIFIER and honor
it.
* tests/records.scm ("define-record-type* & thunked & inherit & custom this"):
New test.
|
|
* 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.
|
|
Fixes a regression in 'guix pack -R' introduced with commit
c2dcff41c2e47f5f978f467864d5ed7829939884. The imported modules of
'c-compiler' would be compiled in this order: first (guix records),
then (guix search-paths). Consequently,
'report-duplicate-field-specifier' would be reported as unbound while
compiling (guix search-paths), leading to a build failure.
* guix/records.scm (report-invalid-field-specifier)
(report-duplicate-field-specifier): Move within 'eval-expand'.
|
|
* guix/records.scm (report-duplicate-field-specifier): New procedure.
(make-syntactic-constructor): Call it.
* tests/records.scm ("define-record-type* & duplicate initializers"):
New test.
Co-authored-by: Mark H Weaver <mhw@netris.org>
|
|
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.
|
|
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'.
|
|
* guix/records.scm (current-abi-identifier, abi-check): Wrap in
'eval-when'.
|
|
* 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.
|
|
* guix/records.scm (make-syntactic-constructor): Use
'make-struct/no-tail' as 'make-struct' is deprecated as of 2.2.3.
|
|
* guix/records.scm: New syntax-rule.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
|
|
* guix/records.scm (make-syntactic-constructor): Simplify 'find' expression.
|
|
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.
|
|
* guix/records.scm (define-record-type*): Remove unnecessary 'begin'.
|
|
* 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.
|
|
* guix/records.scm (define-record-type*): Change "options" to "properties".
|
|
* guix/records.scm (define-field-property-predicate): New macro.
(define-record-type*)[thunked-field?, delayed-field?]: Use it.
|
|
* guix/records.scm (make-syntactic-constructor)[default-values]: New
variable.
[field-default-value]: New procedure.
Use them.
|
|
* guix/records.scm (make-syntactic-constructor): Remove enclosing
'eval-when'. Turn into a 'syntax-rules' macro.
|
|
* guix/records.scm (make-syntactic-constructor): Wrap in 'eval-when'.
|
|
* 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.
|
|
|
|
* guix/records.scm (make-syntactic-constructor)[wrap-field-value]: New
procedure.
[field-bindings, field-value]: Use it.
|
|
* guix/records.scm (make-syntactic-constructor): New procedure, formerly
nested in 'define-record-type*'.
|
|
* 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.
|
|
* 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.
|
|
* guix/records.scm (define-record-type*): Agument the docstring, give
examples.
|
|
* 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.
|
|
* guix/records.scm (record-error): New macro.
(define-record-type*)[error*]: Remove.
Use 'record-error' instead.
|
|
* 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.
|
|
* guix/records.scm (%recutils-plus-rx): New variable.
(recutils->alist): Use it to read + lines.
* tests/records.scm ("recutils->alist with + lines"): New test.
|
|
* guix/records.scm (alist->record): Add `multiple-value-keys'
parameter. Update docstring, and honor it.
* tests/records.scm ("alist->record"): New record.
|
|
* guix/records.scm (%recutils-comment-rx): New variable.
(recutils->alist): Match comments.
* tests/records.scm ("recutils->alist"): Add comments.
|
|
* 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.
|
|
* 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.
|