Subject: Re: bug#54003: local-file after Guile update

From: Maxime Devos <[email-masked]>
Date: Tue, 15 Feb 2022 21:56:09 +0100

Ludovic Courtès schreef op di 15-02-2022 om 20:42 [+0100]:
> The problem is that ‘read’ hash extensions (like those for #~ and #$)
> would so far return sexps with associated source properties, but
> psyntax
> in 3.0.8 ignores those source properties.

Read hash extensions can return syntax objects.  In a Guile 3.0.8 REPL:

(define-module (hat))
(define (hat s-exp)
  `#(hat ,s-exp))

(read-hash-extend #\^
  (lambda (_ port)
    ;; Use 'read-syntax' instead of a combination of 'read' and
    ;; 'datum->syntax' for source properties.
    #`(hat '#,(read-syntax port))))

#^(foo bar)
$4 = #(hat (foo bar))

Doing something like this in the hash extension for G-exps might work.

Greetings,
Maxime.