This is the mail archive of the kawa@sources.redhat.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]
Other format: [Raw text]

Re: How to define constructors for classes defined using define-simple-class


S D wrote:
Will this be addressed in the future?

I expect so.


Or is there any technical
limitation in generating constructor byte code?

It's partly a design issue. Any design will be a bit of a kludge: what's a "constructor"? It's a special kind of beat: neither a normal instance method nor a static method. I think having constructors in a language is a mistake - one should use factory methods instead.

What I think we'll do is define "constructors" as if they were methods
with a special name - perhaps "new", and a few special rules.

Support for calling a super-constrcutor can be based on the existing
invoke-special.

Also, it doesn't seem
to be possible to overload a method with different sets of parameters
(I think the last definition definition is the one that is being
created).

That seems to work for me. If it doesn't work for you, submit a test case - but please try the cvs verson of kawa first. -- --Per Bothner per@bothner.com http://per.bothner.com/


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