Skip to content

Consider extending .Interface pattern to things other than COM interfaces #279

@rickbrew

Description

@rickbrew

For example,

public struct OSVERSIONINFOW : OSVERSIONINFOW.Interface
{
    public interface Interface { ... }
    ...
}

public struct OSVERSIONINFOEXW : OSVERSIONINFOEXW.Interface
{
    public interface Interface : OSVERSIONINFOW.Interface { ... }
    ...
}

This would reify the inheritance relationships, and enable certain uses of generics and would be source-generator friendly (like, I can generate my own __cast() "operator" methods).

Fields, which would have to be exposed as ref properties, might be best left out of the interfaces. Otherwise it would greatly increase friction for implementing and using them (hard to take the address of things).

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalAn issue that represents a proposed feature or change to the repo.untriagedAn issue that has not been triaged by the repo maintainers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions