On 23-02-2023 12:38, Ludovic Courtès wrote:
Hi, Maxime Devos <maximede...@telenet.be> skribis:For complicated macros, especially macros that are used correctly but have a bug in their implementation somewhere and use 'syntax-case' or 'syntax-rules' multiple times, it can be very convenient to know _which_ syntax-case or syntax-rules raised the syntax-error. E.g., I'm currently debugging some changes to a (non-Guile) macro, and I don't know what to make of the following -- the '#:getter . datum-type' isn't even present in the original code anywhere: ice-9/boot-9.scm:1685:16: In procedure raise-exception: Syntax error: unknown location: source expression failed to match any pattern in form (#:getter . datum-type) make: *** [Makefile:1333: gnu/gnunet/dht/client.go] Fout 1 As such, partially revert the following commit that does not give a rationale on how backtraces for syntax errors aren't helpful.Do you have a simple reproducer and a before/after comparison showing what Guile prints?
Looks like the patch didn't actually work: (define-syntax syntax-stuff-twice (lambda (s) (define (process/internal object) ;; Oops! Only certain forms of 'object' were accepted. (throw 'syntax-error "syntax-stuff-twice" "bad" '() object object)) (define (process/x x) #`(list #,(process/internal x))) (define (process/y y) #`(vector #,(process/internal y))) (define (computify o) (datum->syntax #false o)) (syntax-case s () ((_) ;; Let's compute some syntax, for some reason. (let ((x (computify "imagine this syntax is very hard to follow")) (y (computify "and difficult to distinguish from this"))) #`(list #,(process/x x) #,(process/y y))))))) (syntax-stuff-twice) ;; Before:;; unknown file:#f:#f: syntax-stuff-twice: bad in subform #<syntax:reproducer.scm:15:27 "imagine this syntax is very hard to follow"> of #<syntax:reproducer.scm:15:27 "imagine this syntax is very hard to follow">
;; After: ;; [the same thing] ;; ;; Looks like another patch is needed ...
OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature