Skip to content

Extensions are not available when imported with a prefix. #671

Closed
@lrhn

Description

@lrhn

We designed extensions so that they are not accessible when they are imported with a prefix.

That has already lead to at least two reports of libraries which introduce their own extensions (on their own types), and which people expected to keep working when they imported the library with a prefix.

The reason to not make them accessible was that it provided a way to avoid an extension method conflict while still making explicit application possible. I don't want to lose that property.

I suggest that we loosen the extension resolution so that extensions imported with a prefix are accessible, but we give preference to extensions imported without a prefix.

The rules for extension conflict resolution for applicable extensions E1 and E2 would then be:

  • E1 is more specific than E2 if E2 is only imported through imports with a prefix, and E1 is not,
  • or both are imported only through prefix imports or neither are, and:
  • ... current rules ...

@johnniwinther WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    requestRequests to resolve a particular developer problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions