Best way to interface Java?
brlewis@alum.mit.edu
brlewis@alum.mit.edu
Wed Jun 21 09:58:00 GMT 2000
"Nic Ferrier" <nferrier@tapsellferrier.co.uk> writes:
> 2. I could expect the various procs to be defined when the module is
> loaded
> using:
> environment-bound?
> on the procs that the parser requires would allow me to throw an
> exception or terminate gracefully if they weren't there.
What's wrong with using require? The fact that you don't mention it
suggests you haven't been keeping up with recent changes to Kawa. If
you haven't gone through the manual lately, read it. I'm finding make,
invoke, etc. much easier to deal with than primitive-...
Here's a sample from netfun.scm, part of an upcoming release of BRL
(already checked into CVS):
(define (brl-tcp-socket (server <String>) (port <integer>))
(let* ((sock :: <java.net.Socket>
(make <java.net.Socket> server port))
(instream :: <java.io.InputStream>
(invoke sock 'getInputStream))
(outstream :: <java.io.OutputStream>
(invoke sock 'getOutputStream))
(inport :: <input-port>
(make <input-port> instream server))
(outport :: <output-port>
(make <output-port> outstream server)))
(cons inport outport)))
--
Bruce R. Lewis http://brl.sourceforge.net/
More information about the Kawa
mailing list