chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-janitors] #1441: Macro keywords unexpectedly match against


From: Chicken Trac
Subject: Re: [Chicken-janitors] #1441: Macro keywords unexpectedly match against imported identifiers
Date: Sat, 24 Feb 2018 09:03:06 -0000

#1441: Macro keywords unexpectedly match against imported identifiers
-------------------------------------+-------------------------------------
            Reporter:  sjamaan       |      Owner:  sjamaan
                Type:  defect        |     Status:  new
            Priority:  major         |  Milestone:  4.14.0
           Component:  expander      |    Version:  4.13.0
          Resolution:                |   Keywords:  hygiene, syntax-rules,
Estimated difficulty:  hard          |  capture
-------------------------------------+-------------------------------------

Comment (by sjamaan):

 Chibi prints #t in both cases, but Gauche complains after importing:

 {{{
 *** ERROR: pattern variable #<identifier match-it-chibi##<identifier
 match-it-chibi#?whatever.683ca40>.6840e20> appears more than once in the
 macro definition of match-identifier: (#<identifier match-it-
 chibi##<identifier match-it-chibi#_.683ca60>.6840e40> #<identifier match-
 it-chibi##<identifier match-it-chibi#?whatever.683ca40>.6840e20>
 #<identifier match-it-chibi##<identifier match-it-
 chibi#?whatever.683ca40>.6840e20>)
     While compiling: (#<identifier match-it-chibi##<identifier match-it-
 chibi#syntax-rules.683caa0>.6840e80 ...
     While compiling "(standard input)" at line 1: (print (match-foo foo))
 Stack Trace:
 _______________________________________
   0  (eval expr env)
         at "/usr/share/gauche-0.9/0.9.5/lib/gauche/interactive.scm":282
 }}}

 Files:

 {{{
 ;; match-it-chibi.sld
 (define-library (match-it-chibi)
   (export match-foo)
   (import (scheme base))
   (begin
     (define-syntax match-foo
       (syntax-rules ()
         ((_ ?input)
          (let-syntax ((match-identifier
                        (syntax-rules (foo)
                          ((_ foo foo) #t)
                          ((_ foo ?whatever) 'mismatch)
                          ((_ ?whatever ?whatever) #f))))
            (match-identifier foo ?input)))))))
 }}}

 {{{
 ;; myfoo-chibi.sld
 (define-library (myfoo-chibi)
   (export foo)
   (import (scheme base))
   (begin (define foo 2)))
 }}}

 In Scheme48:

 {{{
 ;; match-it-s48
 (define-syntax match-foo
   (syntax-rules ()
     ((_ ?input)
      (let-syntax ((match-identifier
                    (syntax-rules (foo)
                      ((_ foo foo) #t)
                      ((_ foo ?whatever) 'mismatch)
                      ((_ ?whatever ?whatever) #f))))
        (match-identifier foo ?input)))))
 }}}

 {{{
 ;;; myfoo-s48.scm
 (define foo 2)
 }}}

 {{{
 ;;; packages.scm
 (define-structure match-it-s48 (export match-foo)
    (open scheme)
    (files match-it-s48))

 (define-structure myfoo-s48 (export foo)
    (open scheme)
    (files myfoo-s48))
 }}}

 So all in all, so far I'm not so convinced anymore that this really is a
 bug, except for the fact that there is something of a "regression" when
 compared to how it used to work in CHICKEN.

--
Ticket URL: <https://bugs.call-cc.org/ticket/1441#comment:9>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]