Skip to content

Update extension methods specification for prefix imports.#672

Merged
lrhn merged 3 commits intomasterfrom
lrhn-sem-prefix
Nov 12, 2019
Merged

Update extension methods specification for prefix imports.#672
lrhn merged 3 commits intomasterfrom
lrhn-sem-prefix

Conversation

@lrhn
Copy link
Copy Markdown
Member

@lrhn lrhn commented Nov 7, 2019

Allow extensions imported with a prefix to be accessible for implicit invocation, but make them less specific than any extension imported without a prefix.

Allow extensions imported with a prefix to be accessible for implicit invocation, but make them less specific than any extension imported without a prefix.

An extension is *accessible* for an expression if it is declared in the current library, or if there is a non-deferred `import` declaration in the current library of a library with the extension in its export scope, where the name of the extension is not private and it is not hidden by a `hide` or `show` modifier of the import. _This includes (non-deferred) imports with a prefix._

It is a *compile-time error* if a deferred import declaration imports a library with an extension declaration in its export scope, unless all such extensions are hidden by `show` or `hide` modifiers on the deferred import. *This is a temporary restriction ensuring that no extensions are introduced using deferred imports, and it allows us to later introduce any semantics for such extensions without affecting existing code*.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hide only. show is an error as well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I understand, you mean that the extension is hidden by a show of something else. I found this confusing though. Consider re-phrasing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or will do, I actually updated the paragraph below instead.

3. *T<sub>1</sub>* is a subtype of of *T<sub>2</sub>* and either
4. not vice versa, or
5. the instantiate-to-bounds `on` type of `E1` is a subtype of the instantiate-to-bounds `on` type of `E2` and not vice versa.
1. The `E2` extension is only accessible from imports with a prefix and `E1` not, or
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not current.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@lrhn lrhn merged commit 464cab6 into master Nov 12, 2019
@lrhn lrhn deleted the lrhn-sem-prefix branch March 12, 2020 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants