This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bug when compiling macro


ygrats@gmx.net writes:

> if I compile the following file (let's say bla.scm):
> 
> (module-name "bla")
> (module-static #t)
> 
> (define-syntax jhash-get
>   (syntax-rules ()
>     ((jhash-get hash key)
>      (let ((val (invoke (as <java.util.Hashtable> hash) 'get key)))
>        (if (eq? val #!null)
>            #f
>            val)))))
> 
> by 'kawa -d . -C bla.scm
> I get a <unknown>:0: Literals: Internal
> error:java.lang.NullPointerException.
> 
> Any ideas about that?

The following patch (which I have checked into cvs) shodl fix that:

Index: LitTable.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/LitTable.java,v
retrieving revision 1.2
diff -u -r1.2 LitTable.java
--- LitTable.java	2000/06/11 02:00:18	1.2
+++ LitTable.java	2000/08/07 02:19:38
@@ -183,7 +183,8 @@
 		writeObject(arr[i]);
 	      }
 	  }
-	else if (obj instanceof String || lit.type instanceof ArrayType)
+	else if (obj == null
+                 || obj instanceof String || lit.type instanceof ArrayType)
 	  {
 	    // nothing to do
 	  }

> BTW, can I export syntax-definitions, or is this not necessary?

Yes and yes.

I.e. if you compile bla.scm, then you can (require <bla>), and then
use jhash-get.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]