match-record cryptic error message on unbound record type

  • Done
  • quality assurance status badge
Details
2 participants
  • Maxim Cournoyer
  • (
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal
M
M
Maxim Cournoyer wrote on 27 Apr 2023 16:27
(name . bug-guix)(address . bug-guix@gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
87edo55rjl.fsf@gmail.com
Hi,

When a record type is not in scope, the error message produced by the
match-record macro from (guix records) reads something like:

Toggle snippet (3 lines)
guix/records.scm:598:32: map-fields: bad use of syntactic keyword in subform map-fields of map-fields

It'd be nicer if it could hint the developer what the error is exactly
(unknown record type).

Reproducer:

Toggle snippet (18 lines)
scheme@(guile-user)>

(use-modules (gnu system accounts)
(guix records))

(define dummy-account
(user-account (name "dum") (group "dum")))

(match-record dummy-account <user-account>
(name)
name)

While compiling expression:
Syntax error:
guix/records.scm:598:32: map-fields: bad use of syntactic keyword in
subform map-fields of map-fields

This was caused by <user-account> not being exported from (gnu system
accounts).

--
Thanks,
Maxim
(
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87v8hhynz9.fsf@disroot.org
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
Toggle quote (7 lines)
> When a record type is not in scope, the error message produced by the
> match-record macro from (guix records) reads something like:
>
> --8<---------------cut here---------------start------------->8---
> guix/records.scm:598:32: map-fields: bad use of syntactic keyword in subform map-fields of map-fields
> --8<---------------cut here---------------end--------------->8---

Josselin made a patch, which I adapted and submitted at
M
M
Maxim Cournoyer wrote on 10 Oct 2023 05:45
(name . ()(address . paren@disroot.org)
87cyxn6szd.fsf@gmail.com
Hello,

"(" <paren@disroot.org> writes:

Toggle quote (11 lines)
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>> When a record type is not in scope, the error message produced by the
>> match-record macro from (guix records) reads something like:
>>
>> --8<---------------cut here---------------start------------->8---
>> guix/records.scm:598:32: map-fields: bad use of syntactic keyword in subform map-fields of map-fields
>> --8<---------------cut here---------------end--------------->8---
>
> Josselin made a patch, which I adapted and submitted at
> <https://issues.guix.gnu.org/63135>.

Which has since been merged, thank you! Closing.

--
Thanks,
Maxim
Closed
?