bug#74385: [PATCH 3/4] srfi-64: Export define-equality-test.

Tomas Volf <[email protected]> Fri, 13 Dec 2024 17:16:47 +0100
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
Ludovic Courtès <[email protected]> writes:

> Hi Tomas,
>
> Tomas Volf <[email protected]> skribis:
>
>> +(define-syntax define-equality-test
>>    (syntax-rules ()
>>      ((_ name test-proc)
>>       (define-syntax name
>>         (λ (x)
>>           (syntax-case x ()
>>             ((_ test-name expected test-expr)
>> -            #`(%%test-2 #,x test-proc test-name expected test-expr))
>> +            #`(%test-2 #,x test-proc test-name expected test-expr))
>>             ((_ expected test-expr)
>> -            #`(%%test-2 #,x test-proc #f        expected test-expr))))))))
>> +            #`(%test-2 #,x test-proc #f        expected test-expr))))))))
>> +(set-documentation! 'define-equality-test
>> +  "@defspec define-equality-test identifier proc
>> +Define a new test form named @var{identifier} with same signature and usage as
>> +@code{test-eq} but using @var{proc} instead of @code{eq?}.
>
> I didn’t notice earlier, but you can add docstrings like this:
>
>   (define-syntax define-equality-test
>     (syntax-rules ()
>       "This is the docstring."
>       …))

Ah, good catch.  Since that works just for syntax-rules and not
syntax-case, I probably did not moved the documentation string around
when switching between them.  Will update.

>
> As for exporting ‘define-equality-test’, I would clearly mark it as a
> “GNU extension”.
>
> The way this was done before is by having more exports in a separate
> module, like (srfi srfi-9 gnu).
>
> Whether or not you pick this approach, please make sure to document it
> in the manual and to prominently mark it as a GNU extension.

I personally think that leaving it in one module is fine, and I agree it
should be documented.  There are other GNU extensions already in the new
SRFI-64, and I plan to document all once #71300 is merged.  I will wait
for v2 until that happens and will include the documentation changes
required.

Have a nice day,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
signature.asc (application/pgp-signature, 853 B)
-----BEGIN PGP SIGNATURE-----

iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmdcXe8OHH5Ad29sZnNk
ZW4uY3oACgkQL7/ufbZ/wamW/w//Q3qyLCBbtd7GYPsmX4n5znOq6RzOdW+2ePZS
85/x5sW8yoMyO99UPGYy08i1S+yqhttlh4Nd3NRenhHgyQy9a2MD8pbRHlxbLlXY
Jl2XR9Ze6GQDs5xA6EZf3bsHd4H4rou7zLpX7xPV1RvTFncYL6j6yt03oaAt5Z1p
+/eQc/dhWNzLq8ibWzvOF4m2yBbhgOlcS2vE1z8rLOJbY4cLUO+w9jl8nVVQHEdO
aTmhM/9P7b9OuhlDZPWbEzxmXtR9Bk+ICQqFO+k2zSBhF+9e0YF6537Se81urv21
J4DJpSHzOfj5reEKA+WwRI26SaSx4P97vQo2k9w0Z8AfhkgMFU315ACUK62y9io3
nREEL9qeLGPnvsnIcAbc2FwnPPYjBL1xR58h/B2Z+LvEeakQCRSew30tU653qMDy
gZvUmYPAtndEzx+c37R6jsv0F0FEbrBDvPigSKGAjrFI8rk91NnpmRiEsVegsZpq
iK4nRIcGxLIfaBanKUNOca6MO2EZwaieIU4uI5AZAlNZlw45fE+Z+uoBAo5qV6C1
4T3BLlrswNmAB2tLGZX+9fp9JGNTMLEvD/ZgvM1uFeihEYv32IJZ3bq/ew9KquLR
4wvMk7LHEcOqsKXewXAarCluan0Ppklr7/yKDKJLgKlJV1ZTiDIUrVseOYLwvZvk
OtS+Ivw=
=PuRf
-----END PGP SIGNATURE-----