Re: Interface with implied Constructor
On 7/23/2013 5:32 PM, Gene Wirchenko wrote:
On Mon, 22 Jul 2013 16:02:05 -0400, Eric Sosman
<esosman@comcast-dot-net.invalid> wrote:
On 7/22/2013 3:39 PM, Gene Wirchenko wrote:
[...] I just want a prototype of the
constructor with the rest of the prototypes.
I don't think anyone's in doubt about what you and Richard
want. The question that still burns is:
"Why?"
An interface documents. I can put additional comments in there
and do because it helps the signatures make sense. Since I have all
this, why not have the constructors there, too? Then, I have the API
documented in one place.
An interface documents -- and also specifies, mandates,
requires, and enforces.
Perhaps if you'd offer a concrete example...? To avoid charges
Read my pargraph above.
of made-up-ness, take an existing interface that you think would be
more useful if it could specify constructors, and exhibit the
constructors you'd like it to specify. Please use an interface
that's not some creature of your own; if the idea is useful, there
surely must be some java or javax interfaces that could use it.
(If there aren't, that casts some doubt on the utility of the
construct ...)
It would document the class in one place.
Are you proposing to do away with the class' own JavaDoc?
Also, what happens to "in one place" when a class implements
more than one interface?
I have already done this. I added comments to my interfaces
stating what the constructor signatures were. I would like to have
Java enforce constructor signatures. Note that I am fine with this
being optional so you need not worry about it.
Then, maybe, we can get away from this childish "It's behavior!"
"No, it's implementation!" back-and-forth. A use case, please.
For me, it is such a general situation that a use case is gilding
the lily. If you were to ask me for a use case for using a for
statement, it would be about the same level.
That level being "beneath contempt," I guess?
In summary, we've still seen not even one use case. We've
seen assertions by you and by Richard that the capability would
be of great utility, yet nobody's offered even one example of
a "well-known" interface that could benefit from it. That, I
think, should raise a doubt or two.
--
Eric Sosman
esosman@comcast-dot-net.invalid