More on implied interfaces.

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.



2 Comments so far

  1.   Kathleen on April 12th, 2008          

    Bill,

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

    http://blogs.msdn.com/alexj/archive/2008/04/09/intellisense-what-properties-are-required.aspx

    AFAICT, this just won’t work in VB.

    Kathleen

  2.   bill on April 13th, 2008          

    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 🙁