Re: [PATCH] Preserve keyword in 'syntax-rules' and 'define-syntax-rule'
Hi Alex, Alex Shinn alexsh...@gmail.com skribis: This is not a bug. R5RS states: The keyword at the beginning of the pattern in a syntax rule is not involved in the matching and is not considered a pattern variable or literal identifier. R6RS forbids _ as a literal. R7RS retains the R5RS ignoring of the initial keyword, adds _ as a wildcard, but allows it to be used as a literal. So this code would only break in R6RS. Interesting, thanks for the clarification. So I guess the safest decision for Guile is to keep the current behavior. Thanks, Ludo’.
Re: [PATCH] Preserve keyword in 'syntax-rules' and 'define-syntax-rule'
Unfortunately, preserving the macro keyword breaks one of Oleg Kiselyov's macros, namely 'ppat' in system/base/pmatch.scm: --8---cut here---start-8--- (define-syntax ppat (syntax-rules (_ quote unquote) ((_ v _ kt kf) kt) ((_ v () kt kf) (if (null? v) kt kf)) ((_ v (quote lit) kt kf) (if (equal? v (quote lit)) kt kf)) ((_ v (unquote var) kt kf) (let ((var v)) kt)) ((_ v (x . y) kt kf) (if (pair? v) (let ((vx (car v)) (vy (cdr v))) (ppat vx x (ppat vy y kt kf) kf)) kf)) ((_ v lit kt kf) (if (eq? v (quote lit)) kt kf --8---cut here---end---8--- Oleg's macro uses '_' in the keyword position of the pattern, even though '_' is in the literals list. Therefore, it fails to match because 'ppat' does not match that literal. Among other things, this broke our build, which is why Hydra has been failing to build Guile recently. I reverted the change. Mark
Re: [PATCH] Preserve keyword in 'syntax-rules' and 'define-syntax-rule'
Hi, Mark H Weaver m...@netris.org skribis: Unfortunately, preserving the macro keyword breaks one of Oleg Kiselyov's macros, namely 'ppat' in system/base/pmatch.scm: [...] Oleg's macro uses '_' in the keyword position of the pattern, even though '_' is in the literals list. Therefore, it fails to match because 'ppat' does not match that literal. I would call it a bug in ‘ppat’. However, the real question is how frequent that “bug” is. If people have come to rely on the current behavior, then it may be more reasonable to stick to it. Among other things, What were the other things? :-) Ludo’.
Re: [PATCH] Preserve keyword in 'syntax-rules' and 'define-syntax-rule'
l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: Unfortunately, preserving the macro keyword breaks one of Oleg Kiselyov's macros, namely 'ppat' in system/base/pmatch.scm: [...] Oleg's macro uses '_' in the keyword position of the pattern, even though '_' is in the literals list. Therefore, it fails to match because 'ppat' does not match that literal. I would call it a bug in ‘ppat’. However, the real question is how frequent that “bug” is. If people have come to rely on the current behavior, then it may be more reasonable to stick to it. I tend to agree that it's arguably a bug in 'ppat'. I could go either way on this, so I'll leave it up to you and Andy. Among other things, What were the other things? :-) Well, anything that uses pmatch will fail. I'm not aware of any other problems. Mark
Re: [PATCH] Preserve keyword in 'syntax-rules' and 'define-syntax-rule'
On Thu, Oct 11, 2012 at 5:41 AM, Ludovic Courtès l...@gnu.org wrote: Hi, Mark H Weaver m...@netris.org skribis: Unfortunately, preserving the macro keyword breaks one of Oleg Kiselyov's macros, namely 'ppat' in system/base/pmatch.scm: [...] Oleg's macro uses '_' in the keyword position of the pattern, even though '_' is in the literals list. Therefore, it fails to match because 'ppat' does not match that literal. I would call it a bug in ‘ppat’. However, the real question is how frequent that “bug” is. If people have come to rely on the current behavior, then it may be more reasonable to stick to it. This is not a bug. R5RS states: The keyword at the beginning of the pattern in a syntax rule is not involved in the matching and is not considered a pattern variable or literal identifier. R6RS forbids _ as a literal. R7RS retains the R5RS ignoring of the initial keyword, adds _ as a wildcard, but allows it to be used as a literal. So this code would only break in R6RS. -- Alex
Re: [PATCH] Preserve keyword in 'syntax-rules' and 'define-syntax-rule'
Hi Mark! Makes sense to me, you can apply it. Thanks, Ludo’.