GNU bug report logs - #63135
[PATCH 0/3] MATCH-RECROD improvements

Previous Next

Package: guix-patches;

Reported by: "(" <paren <at> disroot.org>

Date: Thu, 27 Apr 2023 22:06:01 UTC

Severity: normal

Tags: patch

Done: Josselin Poiret <dev <at> jpoiret.xyz>

Bug is archived. No further changes may be made.

Full log


Message #35 received at 63135 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "(" <paren <at> disroot.org>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, 63135 <at> debbugs.gnu.org
Subject: Re: bug#63135: [PATCH 0/3] MATCH-RECROD improvements
Date: Fri, 19 May 2023 17:22:48 +0200
Hi,

Thanks for these much welcome improvements!

"(" <paren <at> disroot.org> skribis:

> * guix/records.scm (match-record): Raise a human-compherensible syntax error
>   if the given record type identifier is unbound.

[...]

>  (define-syntax map-fields
>    (lambda (x)
> -    (syntax-violation 'map-fields "bad use of syntactic keyword" x x)))
> +    (syntax-case x ()
> +      ((_ type within)
> +       (syntax-violation (syntax->datum #'within)
> +                         "undefined guix record-type"
> +                         #'type))

How about “invalid record type identifier”?

(Rule of thumb: never use “Guix” in messages and interfaces.)

> -                     ((_ map-fields macro)
> +                     ((_ (map-fields _ _) macro)
>                        #'(macro (field ...)))
>                       (id
>                        (identifier? #'id)
> @@ -595,7 +600,7 @@ (define-syntax match-record-inner
>         #'(let-syntax ((field-offset (syntax-rules ()
>  			              ((_ f)
>                                         (lookup-field field 0 f)))))
> -           (let* ((offset (type map-fields field-offset))
> +           (let* ((offset (type (map-fields type match-record) field-offset))

There’s always a tradeoff; not a strong opinion but I’d lean towards
keeping the macro unchanged (thus a bit simpler) and simply changing the
default ‘syntax-violation’ message above.

WDYT?

Ludo’.




This bug report was last modified 1 year and 352 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.