This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Defining Java Classes in Kawa
On Mon, Aug 23, 2004 at 10:52:08AM -0700, Per Bothner wrote:
> David O'Callaghan wrote:
>
> > As far as I can tell, it's not possible to define a non-default
> > constructor in Kawa, or to call the super-class constructor, based on
> > http://sources.redhat.com/ml/kawa/2003-q4/msg00085.html.
>
> Calling super-methods is not a problem: Kawa recently not the
> invoke-special format which can be used for that.
>
> It might be nice to add a shorthard:
>
> (invoke-super ARG ...) ===
> (invoke-special <SUPERCLASS> (this) 'THIS-METHOD ARG ...)
Would invoke-special work even for constructors (assuming that it's
possible to define them)? Something like:
(invoke-special <SUPERCLASS> (this) '<init> ARG ...)
> Adding non-default constructors to define-simple-class is
> probably not that difficult.
That's good to hear.
> Design is an issue: I don't
> really like the concept of special constructor methods with
> magic properties and names. (There should be no public
> "constructors" - just factory methods.) However, for
> define-simple-class it is important to be compatible with
> Java, which makes it hard to do constructors as anything
> other than magic methods with magic names.
>
> But what should be the name of the constructor method?
I'd like "new", but I don't have strong feelings about this.
Thanks for the quick response,
David