bugKawa - Bugs: bug #13854, Using EVAL and #!key

 
 

bug #13854: Using EVAL and #!key

Submitter:  Dean Ferreyra <dferreyra>
Submitted:  Wed 20 Jul 2005 02:26:21 AM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Run-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 20 Jul 2005 09:15:17 PM UTC, comment #1: 

I checked in a fix.

The problem was that keyword arguments have to be passed in an array, as if there was a #!rest argument.  I made it to that, using arguable a kludge.

Per Bothner <bothner>
Group administrator
Wed 20 Jul 2005 02:26:21 AM UTC, original submission:  

I've boiled down a problem we've run into with the CVS version of Kawa.  If I compile and run this code:

  (module-static #t)
 
  (eval '(define (f a #!key (msg "nothing"))
           msg))
 
  (eval '(begin
           (require 'srfi-1)
           (f 1)))

I get an ArrayIndexOutOfBoundsException.  Comment out the (require ...) line or add a #!rest before the #!key like so:

  (eval '(define (f a #!rest rest #!key (msg "nothing"))
           msg))

and the problem goes away.

Here's what my compile looks like:

% make PURE=1 default
rm -f *.class
CLASSPATH=.:~/kawa/cvs/kawa-pure-build/kawa-1.7.91.jar java kawa.repl --warn-undefined-variable --module-static-run --main -C test.scm
(compiling test.scm)
CLASSPATH=.:~/kawa/cvs/kawa-pure-build/kawa-1.7.91.jar java test
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at atEvalLevel.applyN(test.scm:3)
        at gnu.expr.ModuleBody.apply0(ModuleBody.java:147)
        at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:177)
        at gnu.expr.ModuleMethod.apply(ModuleMethod.java:151)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:247)
        at gnu.expr.ModuleExp.evalModule(ModuleExp.java:218)
        at kawa.lang.Eval.evalBody(Eval.java:104)
        at kawa.lang.Eval.eval(Eval.java:31)
        at kawa.lang.Eval.apply(Eval.java:138)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:247)
        at gnu.expr.ModuleBody.runCleanup(ModuleBody.java:60)
        at gnu.expr.ModuleBody.run(ModuleBody.java:51)
        at gnu.expr.ModuleBody.run(ModuleBody.java:32)
        at test.<clinit>(test.scm)
make: * [run] Error 1

Dean Ferreyra <dferreyra>

 

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

Date Changed by Updated Field Previous Value => Replaced by
2005-07-20 bothner StatusNone Fixed
    Assigned toNone bothner
    Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code