On 16-02-2023 09:03, Dr. Arne Babenhauserheide wrote:
Maxime Devos <[email protected]> writes:+ ;; allow using "# foo" as #(foo). + (read-hash-extend #\# (λ (chr port) #\#))That's a rather Wisp-specific extension, but it appears you are extending things globally. Instead, I propose extending it temporarily, with the undocumented '%read-hash-procedures' fluid.I tried the spec-example, but it didn’t work for me.
Assuming that with 'spec-example', you meant
(parameterize ((%read-hash-procedures/parameter
`((#\# ,(λ (chr port) #\#))
,@(%read-hash-procedures/parameter))))
[...]):
I forgot to place a '.' between #\# and ,(λ ...).
Do you mean using it similar to this test?
(pass-if "R6RS/SRFI-30 block comment syntax overridden"
;; To be compatible with 1.8 and earlier, we should be able to override
;; this syntax.
(with-fluids ((%read-hash-procedures (fluid-ref %read-hash-procedures)))
(read-hash-extend #\| (lambda args 'not))
(fold (lambda (x y result)
(and result (eq? x y)))
#t
(read-string "(this is #| a comment)")
`(this is not a comment))))
That appears to me a valid (and slightly simpler and more robust) way of doing things, yes.
Greetings, Maxime.
OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
