This is the mail archive of the kawa@sourceware.cygnus.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: Best way to interface Java?


"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/

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