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


Chris <chris@bitmead.com> writes:

> Would it be restricted? Wouldn't it be possible to implement it by
> having every generic function a part of the Java class that corresponds
> to its first argument. So if we had..

For one thing, you would be restricted to having to define the methods
as the same time (same module) as the class.  This is a *major*
restriction, since you won't be able to have the first argument be
a standard (pre-defined) clas.

When the times comes to implement generic methods, I think I (or whoever)
should sit down and carefully read:
http://www.cs.washington.edu/research/projects/cecil/www/Papers/dispatching.html
Note that building dispatch tables has to be done at "link time",
not compile time, and re-built when a new method is added to a generic
functions.

> More than one object system sounds like a bit of a problem to me.

Well, this is quite in the spirit of CLOS, with its meta-class and MOP.

> > Well, there are some questions here.  For example, how do you
> > *name* the generic functions?  Just the name of the Java method?
> 
> Yes.

There are namespace problems here.  There has been some discussion
on the Guile mailing list about the interaction of generic functions
and modules.  I haven't come to a conclusion yet.

> The thing is "invoke" is not scheme. You don't write 
> (invoke string-append foo bar) for example.

You do write (apply foo ...).  The thing is:  What syntax *would* you
use in Scheme?  I gather the answer is generic functions.  One reason
I'm nervous about them is primarily name-space management.  Having
every method named "foo" in every class all be part of the same "foo"
generic function is rather scary.

> Ok, I didn't notice this before. But is an anonymous class enough? I can
> think of cases where you really want a named class.

No, anonymous classes aren't really enough, but they go a long way.
The main thing is that you can't inherit *from* an anonymous class,
but you can have an anonymous class inherit from existing classes and
interfaces.

> I'm not sure how anonymous classes interact in Java.

They are part of Java since JDK 1.1.  Kawa anonymous classes are
quite similar both conceptually an in implementation.  The idea is
that the class definition and the instance creation operation are
combined in one operation.     Also, anonymou classes inherit the
lexical clsoure they are defined in.

Check the applet example in the manual.
-- 
	--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]