/[guile]/guile/workbook/bugs/syncase-quotes-excessively
ViewVC logotype

Diff of /guile/workbook/bugs/syncase-quotes-excessively

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mvo, Sat Apr 27 15:14:43 2002 UTC revision 1.2 by mvo, Tue May 7 18:47:08 2002 UTC
# Line 1  Line 1 
1  summary: syncase quotes hashes and empty applications  summary: syncase quotes hashes and empty applications
2  reported: Lynn Winebarger <owinebar@free-expression.org>, 2002-03-30  reported: Lynn Winebarger <owinebar@free-expression.org>, 2002-03-30
3    reported: Eric E Moore <e.e.moore@sheffield.ac.uk>, 2002-04-23
4    
5    From Lynn:
6    
7  (use-modules (ice-9 syncase))  (use-modules (ice-9 syncase))
8  (define-syntax define-ez-class  (define-syntax define-ez-class
# Line 11  reported: Lynn Winebarger <owinebar@free Line 14  reported: Lynn Winebarger <owinebar@free
14    
15  seems straightforward enough, but syntax-rules quotes the parent list  seems straightforward enough, but syntax-rules quotes the parent list
16  and the #: keywords.  and the #: keywords.
17    
18    From Eric:
19    
20    I was trying to write a simple syncase macro to simplify creating some
21    classes with goops, but there's some confusing quoting going on.
22    
23    The simplest example of the sort of thing is:
24    
25    (use-modules (ice-9 syncase)
26                 (oop goops))
27    
28    (define-syntax my-define-class
29      (syntax-rules ()
30        ((my-define-class name supers slot ...)
31         (define-class name supers slot ...))))
32    
33    (my-define-class <someclass> () (someslot #:accessor someslot))
34    
35    Which gives the error:
36    
37    Backtrace:
38    In current input:
39       8: 0* (my-define-class <someclass> () (someslot #:accessor someslot))
40       8: 1  (define-class <someclass> (quote ()) (someslot (quote #:accessor) someslot))
41       ...
42       ?: 2  (define <someclass> (class (quote ()) (someslot (quote #) someslot) ...))
43       ?: 3* (class (quote ()) (someslot (quote #:accessor) someslot) ...)
44    
45    <unnamed port>: In expression (class (quote ()) (someslot # someslot) ...):
46    <unnamed port>: malformed slot option list
47    ABORT: (goops-error)
48    
49    Changing the macro to:
50    
51    (define-syntax my-define-class
52      (syntax-rules ()
53        ((my-define-class name supers slot ...)
54         (quote (define-class name supers slot ...)))))
55    
56    Does have:
57    
58    (my-define-class <someclass> () (someslot #:accessor someslot))
59    
60    returning:
61    
62    (define-class <someclass> () (someslot #:accessor someslot))
63    
64    Which even evals to do the right thing...

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26