[Issue 2051] interfaces should allow private methods
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 28 09:16:00 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2051
------- Comment #3 from andrei at metalanguage.com 2008-04-28 11:15 -------
(In reply to comment #1)
> d-bugmail at puremagic.com wrote:
> > Consider:
> >
> > interface Foo
> > {
> > private void bar();
> > }
> >
> > class Bar : Foo
> > {
> > }
> >
> > void main()
> > {
> > Foo bar = new Bar;
> > bar.bar;
> > }
> >
> > This code has a link-time error. Removing "private" yields (correctly) a
> > compile-time error. So we have a bug already :o).
>
> The error occurs because there's no implementation anywhere, so the
> vtable can't be completed. I'm assuming you're suggesting that this
> should be turned into a runtime error if no implementation is present
> anywhere, but this would be so much harder to update stuff once an
> interface is updated. I can't see any advantages of making this error
> runtime.
The rest of my post clarifies my intent, which is not to make the error
runtime.
--
More information about the Digitalmars-d-bugs
mailing list