chicken-janitors
[Top][All Lists]
Advanced

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

[Chicken-janitors] #1040: coops: Hygiene issue with ensure-generic-proce


From: Chicken Trac
Subject: [Chicken-janitors] #1040: coops: Hygiene issue with ensure-generic-procedure
Date: Sun, 28 Jul 2013 21:51:34 -0000

#1040: coops: Hygiene issue with ensure-generic-procedure
------------------------+---------------------------------------------------
 Reporter:  syn         |       Owner:  felix  
     Type:  defect      |      Status:  new    
 Priority:  minor       |   Milestone:  someday
Component:  extensions  |     Version:  4.8.x  
 Keywords:  coops       |  
------------------------+---------------------------------------------------
 This program:

 {{{
 (use extras coops)

 (define-class <foo> ())
 (define-class <bar> (<foo>))

 (define-method (foo (x <foo>)) `(<foo>  ,x))

 (define-syntax define-foo
   (syntax-rules ()
     ((_ class)
      (define-method (foo (x class))
        `(class ,x)))))

 (define-foo <bar>)

 (pp (foo (make <foo>)))
 (pp (foo (make <bar>)))
 }}}

 results in this output:

 {{{
 Note: implicitly defining generic-procedure: foo

 Note: implicitly defining generic-procedure: foo170

 Error: (foo) no method defined for given argument classes: (#<coops
 standard-class `<foo>'>)

         Call history:

         <eval>    (list198 (quote197 x171))
         <eval>    (funcallable-generic-procedure200 (slot-value201 %gp195
 (quote197 generic-procedure202)) %gp195)
         <eval>    (slot-value201 %gp195 (quote197 generic-procedure202))
         <eval>    (create-generic-procedure207 (quote208 (setter191
 foo170)) (list209 (quote208 x171)))
         <eval>    (list209 (quote208 x171))
         <eval>    (funcallable-generic-procedure211 (slot-value212 %gp206
 (quote208 generic-procedure213)) %gp206)
         <eval>    (slot-value212 %gp206 (quote208 generic-procedure213))
         <eval>    ((slot-value180 foo170 (quote181 add-new-primary-
 method182)) (list183 <bar>) (call-next-method-lambd......
         <eval>    (slot-value180 foo170 (quote181 add-new-primary-
 method182))
         <eval>    (list183 <bar>)
         <syntax>          (pp (foo (make <foo>)))
         <syntax>          (foo (make <foo>))
         <syntax>          (make <foo>)
         <eval>    (pp (foo (make <foo>)))
         <eval>    (foo (make <foo>))
         <eval>    (make <foo>)  <--
 }}}

 Note how the second implicit generic procedure definition mentions a
 renamed identifier. Indeed, using an equivalent but direct method
 definition like this instead:

 {{{
 (define-method (foo (x <bar>))
   `(<bar> ,x))
 }}}

 works fine. The attached patch fixes this but I'm not sure if it's the
 correct way to do it.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/1040>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

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