bugKawa - Bugs: bug #10561, define-syntax and case generate...

 
 

bug #10561: define-syntax and case generate bad code

Submitter:  Chris Dean <ctdean>
Submitted:  Sun 03 Oct 2004 03:03:33 AM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Unexpected result Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 09 Nov 2004 01:01:54 AM UTC, comment #2: 

This now works in CVS with the re-written hygiene framework.
I checked the testcase into the Kawa testsuite.

Per Bothner <bothner>
Group administrator
Mon 04 Oct 2004 10:16:46 PM UTC, comment #1: 

I haven't chased this all they way, but I'm not too surprised. The interaction between quote handling and hygiene is a bit kludgy.  The basic problem is that Kawa handles hygiene by symbol renaming, which conflicts with quote; the implemented solution is not very robust.

A better solution may be to implement hygiene using lexical closures.  I suspect syntax-case uses some variant of the latter.  I'd like to take some time out and clean up macro handling in Kawa, including solid let-syntax/letrec-syntax support, fixing quote handling, and useful (maybe complete) support for implementation.  I'd prefer to defer this bug until then.

Per Bothner <bothner>
Group administrator
Sun 03 Oct 2004 03:03:33 AM UTC, original submission:  

Both (foo) and (bar) below should return the same result, but
(foo) returns the wrong result due to improper macro expansion.



(define-syntax log-mode
  (syntax-rules ()
    ((log-mode mode)
     (case 'mode
       ((error) "error mode")
       ((warning) "warning mode")
       (else "bad mode")))))

(define (foo)
  (log-mode warning))

(define (bar)
  (case 'warning
    ((error) "error mode")
    ((warning) "warning mode")
    (else "bad mode")))



Chris Dean <ctdean>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-11-09 bothner StatusPostponed Fixed
    Open/ClosedOpen Closed
2004-10-04 bothner StatusNone Postponed
    Assigned toNone bothner

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code