More on implied interfaces.

Posted Wed, Apr 9 2008 13:40 by bill

If you read section 12.2 of the Common Language Infrastructure (CLI) Partition II document, you'll see the following part in regards to interface implementation:

If there are any virtual methods in the interface that still have empty slots, see if there are any public virtual methods, but not public virtual newslot methods, available on this class (directly or inherited) having the same name and signature, then use these to implement the corresponding methods on the interface.

The key thing to note here is the "or inherited" part.  This means for example, you may have a something like ToXML member of an interface, which is well suited into factoring into a base class .  The CLI allows for this by requiring the member match by name and signature.

This is where the interface is implied.  This important aspect is being left out of the proposed re-appropriating of VB's existing explicit interface syntax.

Filed under: ,

Comments

# re: Implicitly implemented interfaces

Tuesday, April 08, 2008 9:57 PM by Panopticon Central

# re: More on implied interfaces.

Saturday, April 12, 2008 8:58 AM by Kathleen

Bill,

Here's a link to a great scenario for implicit/implied interfaces.

blogs.msdn.com/.../intellisense-what-properties-are-required.aspx

AFAICT, this just won't work in VB.

Kathleen

# re: More on implied interfaces.

Sunday, April 13, 2008 9:23 PM by bill

Yep.  And if you factor any of those members into a base class, then you're hosed.  What Paul is suggesting won't address that, and will most likely prevent VB from ever being able to address that scenario even though the runtime supports it :(