bugKawa - Bugs: bug #49416, Error macro-expanding with-syntax...

 
 

bug #49416: Error macro-expanding with-syntax with ... patterns

Submitter:  Adrián Medraño Calvo <medranocalvo>
Submitted:  Sat 22 Oct 2016 06:06:38 PM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Compile-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 24 Oct 2016 07:48:36 PM UTC, comment #2: 

Thank you very much, it works wonderful!

> Presumably you meant (kawe base), rather than (scheme base). (The latter should only contain bindings defined for it in R7RS, of course.) I also checked in a fix for this. Thanks for point this out.


Indeed, sorry for the inaccuracy.

There are a couple more, I'll open a separate ticket for that.

> (I didn't see any Java 7 vs Java 8 diffeerence, for what it's worth.)


Might have confused a subsequent issue, that I'll report separately.

Thank you again for your help.

Best regards,
Adrián

Adrián Medraño Calvo <medranocalvo>
Sun 23 Oct 2016 05:38:02 AM UTC, comment #1: 

I fixed this by adding two missing imports in std_syntax.scm.
Fix checked in along - with your test-case. Thanks!

"Additionally, 'with-syntax' cannot be used without explicitly importing (kawa lib std_syntax). I might make sense to export that directly from (scheme base).

Presumably you meant (kawe base), rather than (scheme base).  (The latter should only contain bindings defined for it in R7RS, of course.)  I also checked in a fix for this.  Thanks for point this out.

(I didn't see any Java 7 vs Java 8 diffeerence, for what it's worth.)

Per Bothner <bothner>
Group administrator
Sat 22 Oct 2016 06:06:38 PM UTC, original submission:  

The following code fails to run/compile with trunk kawa.  The issue might be related to Java 8: running it with Kawa r8803 built with Java 7 (an installation I already had) seems to work alright, but the same revision built with Java 8 throws the error at the end of the report.

Additionally, 'with-syntax' cannot be used without explicitly importing (kawa lib std_syntax).  I might make sense to export that directly from (scheme base).  I can open a separate ticket for this if you prefer.

=== somemodule.scm
(define-library (somemodule)
  (import
    (scheme base)
    (kawa base)
    (kawa lib std_syntax))
  (begin
    (define-syntax some-list
      (lambda (stx)
        (syntax-case stx ()
          ((_ a b rest ...)
           (with-syntax (((thelist ...) (syntax (1 2 3))))
             (syntax (list thelist ...)))))))

    (display 3)
    (display (some-list
              aaa
              bbb
              (cons 3 222)
              (cons 2 333)))))

(import (somemodule))


=== error message
somemodule.scm:12:14: ... follows template with no suitably-nested pattern variable
somemodule.scm:15:5: evaluating syntax transformer 'some-list' threw java.lang.RuntimeException: internal error - class gnu.expr.ErrorExp.eval called
    gnu.expr.Expression.apply(Expression.java:76)
    gnu.mapping.CallContext.runUntilDone(CallContext.java:227)
    gnu.mapping.CallContext.getFromContext(CallContext.java:256)
    gnu.expr.Expression.eval(Expression.java:29)
    gnu.expr.Expression.eval(Expression.java:44)
    kawa.lang.Macro.expand(Macro.java:179)
    kawa.lang.Macro.scanForm(Macro.java:227)
    kawa.lang.Translator.scanForm(Translator.java:1576)
    kawa.lang.Translator.scanBody(Translator.java:1634)
    kawa.standard.begin.scanForm(begin.java:23)
    kawa.standard.define_library.scanModulePass(define_library.java:124)
    kawa.standard.define_library.scanForm(define_library.java:27)
    kawa.lang.Translator.scanForm(Translator.java:1576)
    gnu.kawa.lispexpr.LispLanguage.parse(LispLanguage.java:87)
    gnu.expr.Compilation.process(Compilation.java:2089)
    gnu.expr.ModuleInfo.loadEager(ModuleInfo.java:333)
    kawa.standard.require.importDefinitions(require.java:287)
    kawa.standard.ImportFromLibrary.handleImport(ImportFromLibrary.java:478)
    kawa.standard.ImportFromLibrary.scanImportSet(ImportFromLibrary.java:291)
    kawa.standard.ImportFromLibrary.scanForm(ImportFromLibrary.java:95)
    kawa.lang.Translator.scanForm(Translator.java:1576)
    gnu.kawa.lispexpr.LispLanguage.parse(LispLanguage.java:115)
    gnu.expr.Language.parse(Language.java:775)
    gnu.expr.Language.parse(Language.java:769)
    kawa.Shell.compileSource(Shell.java:584)
    kawa.Shell.runFile(Shell.java:555)
    kawa.Shell.runFileOrClass(Shell.java:468)
    kawa.repl.processArgs(repl.java:689)
    kawa.repl.main(repl.java:811)

Thank you for your efforts.  Best regards,
Adrián.

Adrián Medraño Calvo <medranocalvo>

 

(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

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by medranocalvo (Submitted the item)
  •  

    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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-16 bothner Open/ClosedOpen Closed
    2016-10-23 bothner StatusNone Fixed
        Assigned toNone bothner

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code