Skip to content

update export.md: clarify that constructor proxies are exported #13339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2021

Conversation

unkarjedy
Copy link
Contributor

Currently, the docs say:

A member is eligible if all of the following holds:
...
it is not a constructor, nor the (synthetic) class part of an object,

However, constructor proxies are exported and they are synthetic

related: #11128

@@ -69,6 +69,7 @@ A member is _eligible_ if all of the following holds:
a base class of the class containing the export clause.
- it is accessible at the export clause,
- it is not a constructor, nor the (synthetic) class part of an object,
- it is a constructor proxy
Copy link
Contributor

Choose a reason for hiding this comment

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

That implies that only constructor proxies can be exported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed it should have been appended to previous item as a note

@odersky
Copy link
Contributor

odersky commented Aug 19, 2021

However, constructor proxies are exported and they are synthetic

But constructor proxies are not the synthetic class part of an object. So the original wording is correct.

@odersky odersky closed this Aug 19, 2021
@unkarjedy
Copy link
Contributor Author

@odersky
It still feels that constructor proxies could be mention somewhere more explicitly.

But constructor proxies are not the synthetic class part of an object. So the original wording is correct.

There is still this part in the docs:

A wildcard selector * creates aliases for all eligible members of path except for given instances, synthetic members generated by the compiler and those members that are named by a previous simple, renaming, or omitting selector.

Aren't constructor proxies also "synthetic members generated by the compiler"?

@unkarjedy
Copy link
Contributor Author

Also regarding this part:

A wildcard selector * creates aliases for all eligible members of path except for given instances, synthetic members generated by the compiler and those members that are named by a previous simple, renaming, or omitting selector.
A member is eligible if all of the following holds:

Aren't the members, generated by the compiler for export clauses considered synthetic as well?

Currently, it's allowed to export already-exported members:

object Outer1:
  object Inner:
    def foo = 1

  export Inner._

  println(foo)

object Outer2:
  export Outer1._

  println(foo)

Maybe this case could also be clarified in the docs?

@odersky
Copy link
Contributor

odersky commented Aug 19, 2021

Yes, indeed. That sentence needs changing. Maybe:

A wildcard selector * creates aliases for all eligible members of path except for given instances, synthetic members generated by the compiler and those members that are named by a previous simple, renaming, or omitting selector.

Notes:

  • eligible construtor proxies are also included, even though they are synthetic members.
  • members created by an export are also included. They are created by the compiler, but are not considered synthetic.

@odersky odersky reopened this Aug 19, 2021
@unkarjedy
Copy link
Contributor Author

Great!
I will patch the working in the PR

@unkarjedy
Copy link
Contributor Author

done

Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants