bugKawa - Bugs: bug #18504, Cannot generate...

 
 

bug #18504: Cannot generate (define-simple-class) using syntax-case macros

Submitted by:  Margus Freudenthal <margus>
Submitted on:  Mon 11 Dec 2006 09:02:15 AM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: Compile-time exceptionStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 12 Dec 2006 08:11:24 AM UTC, comment #4:

I checked in the patch for 18105, which should also fix the second problem in the report.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Mon 11 Dec 2006 08:30:57 PM UTC, comment #3:

I checked in the attached patch.
I also checkws in the testcase (see testing/obj-test.scm and testing/ChangeLog). Thanks!

Do try to not mix different bugs in the same bug report. (Admittedly sometimes it isn't obvious whether something is a different symptom of the same bug, so you have make a best guess.)

(file #11506)

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Mon 11 Dec 2006 02:07:22 PM UTC, comment #2:

Oops. The second problem is duplicate of https://savannah.gnu.org/bugs/index.php?18105

Margus Freudenthal <margus>
Mon 11 Dec 2006 02:04:57 PM UTC, comment #1:

Additionally, the following macro works in REPL, but fails when compiling.

(define-syntax aa
(lambda (x)
(syntax-case x ()
((_ cl arg)
(with-syntax
((param-name (datum->syntax-object
#`arg
(string->symbol
(string-append
"param-"
(symbol->string (syntax-object->datum #`arg)))))))
#`(define-simple-class cl ()
(param-name)))))))

(aa MyClass oioi)

java.lang.NullPointerException
at gnu.expr.ReferenceExp.apply(ReferenceExp.java:142)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.mapping.CallContext.getFromContext(CallContext.java:280)
at gnu.expr.Expression.eval(Expression.java:24)
at gnu.expr.ApplyExp.apply(ApplyExp.java:63)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.mapping.CallContext.getFromContext(CallContext.java:280)
at gnu.expr.Expression.eval(Expression.java:24)
at gnu.expr.IfExp.apply(IfExp.java:33)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.mapping.CallContext.getFromContext(CallContext.java:280)
at gnu.expr.Expression.eval(Expression.java:24)
at gnu.expr.BlockExp.apply(BlockExp.java:46)
at gnu.expr.LetExp.apply(LetExp.java:64)
at gnu.expr.LetExp.apply(LetExp.java:64)
at gnu.expr.IfExp.apply(IfExp.java:34)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.mapping.CallContext.getFromContext(CallContext.java:280)
at gnu.expr.Expression.eval(Expression.java:24)
at gnu.expr.BlockExp.apply(BlockExp.java:46)
at gnu.expr.LetExp.apply(LetExp.java:64)
at gnu.expr.Closure.apply(LambdaExp.java:1906)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.mapping.CallContext.runUntilValue(CallContext.java:315)
at gnu.mapping.MethodProc.applyN(MethodProc.java:105)
at gnu.mapping.ProcedureN.apply1(ProcedureN.java:31)
at kawa.lang.Macro.expand(Macro.java:178)
at kawa.lang.Macro.scanForm(Macro.java:206)
at kawa.lang.Translator.scanForm(Translator.java:959)
at gnu.kawa.lispexpr.LispLanguage.parse(LispLanguage.java:69)
at gnu.expr.Language.parse(Language.java:547)
at gnu.expr.Language.parse(Language.java:523)
at kawa.repl.compileFiles(repl.java:728)
at kawa.repl.processArgs(repl.java:425)
at kawa.repl.main(repl.java:827)
(compiling test-macro.scm)
test-macro.scm:24:1: evaluating syntax transformer 'aa' threw java.lang.NullPointerException

However, the following variant compiles OK:

(define-syntax aa
(lambda (x)
(syntax-case x ()
((_ cl arg)
#`(define-simple-class cl ()
(,(datum->syntax-object
#`arg
(string->symbol
(string-append
"param-"
(symbol->string (syntax-object->datum #`arg)))))))))))

Margus Freudenthal <margus>
Mon 11 Dec 2006 09:02:15 AM UTC, original submission:

When I try to generate class inside macro, I get exception.

Macro:

(define-syntax aa
(lambda (x)
(syntax-case x ()
((_ cl arg argtype)
#`(define-simple-class cl ()
(arg type: argtype))))))

#|kawa:7|# (aa MyClass myparam <String>)
<stdin>:7:1: invalid type spec (must be "type" or 'type or <type>)

When I use <String> instead of argtype, it compiles.

Margus Freudenthal <margus>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #11506:  object-keywords.patch added by bothner (837B - text/x-patch - patch for original problem)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bothner (Updated the item)
  • -unavailable- added by margus (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 12 Dec 2006 08:11:24 AM UTCbothnerStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Mon 11 Dec 2006 08:30:57 PM UTCbothnerAttached File-=>Added object-keywords.patch, #11506
      StatusNone=>In Progress
      Assigned toNone=>bothner
    Mon 11 Dec 2006 09:02:15 AM UTCmargusCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1