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: Kawa Servlets


Well it's been a while since I was playing with Kawa, but....

Wouldn't it be reasonable if a Java class was mapped to a CLOS style
interface? The thing is there are millions of useful classes out there
and it's a bit boring to turn them into good scheme interfaces.
Something that mapped them to a CLOS type object that was "close
enough", would be preferable to manually creating one.

There's probably more problems here than meet the eye, but the thing is
Sun and others are coming out with ton's of stuff all the time and
trying to invent really cool scheme interfaces for them all and track
their development is just too hard.

If something could make them like half-decent CLOS style classes it
would be great. Of course one would need to support inheritance and
stuff.

Per Bothner wrote:
> 
> Chris Bitmead <chrisb@nimrod.itg.telstra.com.au> writes:
> 
> > On another note, is any work being done on automatically generating
> > interfaces to existing Java class libraries?
> 
> Well, there are some existing hooks you can use.
> 
> The "module" implementation I announced the other day essentially allows
> you to import any Kawa class, though it works best for factory classes
> or other classes where you primarily have one instance:
> 
>         (require <classname>)  ;; the < and > are required.
> This will import all the public fields of <classname> into the current
> namespace.  In the future, I am planning that it would also import
> public methods, though that is not needed for classes compiled from Scheme.
> If <classname> has non-static fields an instance of it will be
> allocated using the default constructor, and if there is a run()
> method it gets called.
> 
> For normal classes, you have the `make', `invoke', and `invoke-static'
> procedures.
> 
> So these give you some building blocks for generating Scheme
> interfaces to Java class libraries.  Beyond that, it depends on
> what you expect by "automatic".  I am thinking it might be nice
> to offer something Netscape's "LifeConnect" concept of accessing
> Java from JavaScript.
> 
> > Is it a reasonable idea?
> 
> Yes, it's a reasonable question, but the question is rather too vague
> to count as an "idea".  How do would you like the problem to be
> handled?  Some things to bear in mind:
> * There are existing tools that could be modified to generate
> Scheme interfaces from Java classes.  I haven't spent much time
> looking at them, because:
> * I don't think you can automatically generate a good Scheme API
> from a set of Java classes.  It might be more worthwhile looking at
> a Kawa binding for IDL (Corba), as well as look at some of the
> other Java/Corba work that Sun has done.
> * Kawa already has extensive features to access Java classes from Scheme;
> it would be good to build on those.
> * I don't think that a stand-alone tool to generate a Scheme interface
> from a Java library is appropriate for Kawa.  The Kawa approach is
> instead to integrate smarts directly into the Kawa compiler:  For example
> it would be better to have a set of Kawa macros that expand to
> wrapper procedures at compile time.
> 
> I'm sure various people on this list have experience generating Kawa
> interfaces to Java classes libraries.  Perhaps they could tell us
> something about their experience?  Where could Kawa make the tedious
> part easier, and help the job of making a nice Kawa interface?
> --
>         --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]