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]
Other format: [Raw text]

symbol patch


A small patch for some symbol procedures in misc.scm:

- A version of symbol? that checks that the symbol is interned.
- A version of string->symbol that looks up the intern method at compile
  time.

Regards,
Chris Dean

cvs server: Diffing kawa/lib
Index: kawa/lib/ChangeLog
===================================================================
RCS file: /cvs/kawa/kawa/kawa/lib/ChangeLog,v
retrieving revision 1.104
diff -u -w -r1.104 ChangeLog
--- kawa/lib/ChangeLog	29 Oct 2003 01:46:25 -0000	1.104
+++ kawa/lib/ChangeLog	29 Oct 2003 06:54:41 -0000
@@ -1,3 +1,8 @@
+2003-10-28  Chris Dean  <Chris.Dean@sokitomi.com>
+
+	* misc.scm (symbol?, string->symbol): check that the symbol is
+    	interned and optimization intern call.
+
 2003-10-28  Per Bothner  <per@bothner.com>
 
 	* files.scm (system-tmpdir):  Micro-optimization.
Index: kawa/lib/misc.scm
===================================================================
RCS file: /cvs/kawa/kawa/kawa/lib/misc.scm,v
retrieving revision 1.24
diff -u -w -r1.24 misc.scm
--- kawa/lib/misc.scm	31 May 2003 01:39:55 -0000	1.24
+++ kawa/lib/misc.scm	29 Oct 2003 06:54:41 -0000
@@ -10,13 +10,15 @@
   (instance? x <java.lang.Boolean>))
 
 (define (symbol? x)
-  (instance? x <java.lang.String>))
+  (and (instance? x <java.lang.String>)
+       (eq? x
+            (invoke (as <java.lang.String> x) 'intern))))
 
 (define (symbol->string (s <symbol>))
   (make <string> s))
 
 (define (string->symbol (str <string>))
-  (invoke (invoke str 'toString) 'intern))
+  (invoke (as <java.lang.String> (invoke str 'toString)) 'intern))
 
 (define (procedure? x)
   (and (instance? x <function>) (not (instance? x <gnu.mapping.Location>))))


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