mix java and sisc generics (REPOST CORRECTED)

"Mike J. Bell" <[email protected]> Tue, 16 Oct 2007 10:06:39 -0400
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Sorry, GMail barfed on my last post.  Here's what I meant to send in its
entirety:

Quick question...I want to mix java and sisc generic procedures to reduce
the amount of java type conversions I do.  For instance:


(import s2j)
(import generic-procedures)

(define-java-classes
  (<jstring> |java.lang.String|)
  (<logger> |org.apache.log4j.Logger|))

(define-generic-java-methods
  debug
  get-logger)

(define-generic debug)

; catch scheme strings
(add-method debug (method ((next: next)
               (<logger> logger)
               (<string> s)) (next logger (->jstring s))))

; catch java strings
(add-method debug (method ((next: next)
               (<logger> logger)
               (<jstring> s)) (debug logger s)))

(let ((log (get-logger (java-null <logger>) (->jstring "test"))))
  (debug log (->jstring "this is a JAVA test")))

(let ((log (get-logger (java-null <logger>) (->jstring "test"))))
  (debug log "this is a SCHEME test"))


The problem is, this recurses infinitely.  "debug" in the second generic
procedure dispatch seems to refer to the scheme generic procedure, not the
java generic procedure.

Is there any easy way around this?  I'd really like that second form (debug
log "scheme string") instead of doing the type conversions all the time.

Thanks in advance for any tips...

Mike

-- 
Mike J. Bell on gmail

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
Sisc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisc-users