bug#73605: [PATCH] Replace SRFI-64 with a new implementation.
Tomas Volf <[email protected]> Sat, 26 Oct 2024 16:09:48 +0200
| Newsgroups | gmane.lisp.guile.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello, I was thinking about this and then forgot to reply. Sorry about that. Ludovic Courtès <[email protected]> writes: > Hi, > > lloda <[email protected]> skribis: > >> I'm pleased to see all these fixes. However, I noticed a few breakages. They >> come from relying on undocumented behavior, but only using the public >> interface, so others might be affected. I don't propose to patch them, but >> perhaps to make a note in NEWS or (for the last two) to add a paragraph in the >> manual explaining how to achieve the same goal – the reference documentation >> doesn't have enough examples. >> >> * test-begin and test-end now require strings. The old version accepted symbols. No problem with this one. Even the specification for test-begin does note: > Rationale: In some ways using symbols would be preferable. However, we > want human-readable names, and standard Scheme does not provide a way > to include spaces or mixed-case text in literal symbols. I am just thinking how to express it neatly, maybe something like the following would work well enough? --8<---------------cut here---------------start------------->8--- --- a/wolfsden/srfi/srfi-64.scm +++ b/wolfsden/srfi/srfi-64.scm @@ -513,6 +513,14 @@ returning new test runner. Defaults to @code{test-runner-simple}.") ((test-runner-on-group-begin r) r suite-name count))) +(define (%cmp-group-name a b) + (match (list a b) + (((? string?) (? string?)) + (string=? a b)) + (((? symbol?) (? symbol?)) + (eq? a b)) + (_ #f))) + (define* (test-end #:optional suite-name) "Leave the current test group." (let* ((r (test-runner-current)) @@ -520,7 +528,7 @@ returning new test runner. Defaults to @code{test-runner-simple}.") (let ((begin-name (car (test-runner-group-stack r))) (end-name suite-name)) - (when (and end-name (not (string=? begin-name end-name))) + (when (and end-name (not (%cmp-group-name begin-name end-name))) ((test-runner-on-bad-end-name r) r begin-name end-name) (raise-exception (make-bad-end-name begin-name end-name)))) --8<---------------cut here---------------end--------------->8--- Is there more elegant way to express this? >> * test-approximate requires real arguments. The old version accepted complex arguments. No objections, since it seems that (imag-part 0) works just fine, I can basically rewrite it to always consider the input complex, and it will work. >> * The exported variable test-log-to-file is gone. I oppose to restoring this one. When you loaded test file into REPL, it used to just litter your file system with random test log files created in whatever the current working directory is. I do not consider that to be a good behavior. > > As discussed on IRC, I think we should consider restoring support for > these idioms, whether or not they conform to the reference, in an effort > to minimize breakage (especially since this is slated for a point > release). > > WDYT, Tomas? Reacted above, I am fine with the first two, oppose to the third one. I will send a patch for the first two today. 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/wakFAmcc+CwOHH5Ad29sZnNk ZW4uY3oACgkQL7/ufbZ/wanlfg/+M7kRF2eIpWuVw2DbWHjAyb6OcgwLthHPsc2i rMxmHGGz+oGTIQ4cao0Krwc6D70sNNquWZCTm6/MROQi3jBx1yueoLaNRWEpKtIW o6FYIek27W0N9jShR/cP/hufbKiy5rdDsf41xetEcitrBb0gSNzdDKGSAfZzKd5J rRo9N4/Dhw1Ge+PVIUyA4SW5W2RKVr8W1OpuWzRd0brA/p+fCaBcW82Qh2msdBX5 gu3ZjHAfvAJrlWVWwoJw06Q8SPhGKaFPmltoQMNSD5k2sSSX4O9ckffCdGv/olt4 /yyrT3fVT8XEnycTvP0ePEnkRJKHt96UTZYp3GwY6WQavtxHzhGCZkPfyKaYWTh1 mlMpqPJxvKZ6zjl+yeyrXeAOLPbMXboAwkIbmFrYWOmGc+2njblRzm+CyMhg8c6Y jFSTuc9KWKezzCr+tM62mytxbx0q0hNiJkLuZ2ccHfInO9MvdmaTJiVAi2TWABqg +7iEGkA1itrwMfmd/XrL6Lk56XujbFOrRX1nh3o6gYZ//+Y56+hYFx5K3MdqzEft bE651i4AiKY0q2rTLtz5Sl8AcLhLCvbFdvRz2yDedaOsqfZOh1if4ThdQj8GoMdW 9Gw80UtM0+1/AvgFyJkVwK61Ar4nwzMs/izn8xz2C1F9vxjq6am642jp62HqdpF0 0avhgVQ= =JbUL -----END PGP SIGNATURE-----