April 15, 2002
Ok, so this is a weird idea, very likely even a bad one - but thought I'd throw it out:

What if we allowed constructors (and destructors) in interfaces?  The interface could only call functions that it defines, but it might be useful for something, not sure...

Anybody got any good ideas how to use this?

Anybody got any good criticisms of it?  Complexity, surely.  How to handle a multiply-included interface (included in definition of both a class and its super class).  Others?

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]


April 15, 2002
"Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3CBB36E4.8597D9F5@deming-os.org...
> Ok, so this is a weird idea, very likely even a bad one - but thought I'd throw it out:
>
> What if we allowed constructors (and destructors) in interfaces?  The interface could only call functions that it defines, but it might be useful for something, not sure...

Not sure as well. Interface is a contract, nothing more. It is not supposed to contain any code.

> Anybody got any good criticisms of it?  Complexity, surely.  How to handle a multiply-included interface (included in definition of both a class and its super class).  Others?

What if you have two interfaces with destructors, and your class implements both? Destructor occupies special slot in the vtable, you can't have two that simple.