Skip to content

Alternative proposal for grouping exported and local declarations #197

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 7 commits into from
Jul 28, 2014

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Jul 22, 2014

This is another version of grouping exported and locals declarations (originally proposed as #37).
Implementation notes:

  • exported and local declarations can co-exist within a same symbol (similar to exported declarations now don't take the exclusive slot #37)
  • exported node has a link to a local symbol
  • local symbol is used to check if exports agree on all merged declarations (within one local symbol)
  • additional extra check is run on export symbol for functions (to detect duplicate implementation\mismatched ambients)

@@ -518,6 +518,10 @@
"category": "Error",
"code": 2190
},
"All declarations of merged declaration '{0}' must be exported or not exported.": {
Copy link
Member

Choose a reason for hiding this comment

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

It took me a minute to understand this message - if we reported this, people would think we found a way to break the law of the excluded middle.

I might go with

A declaration of '{0}' must be consistent with its other declarations in their export behavior.

or use the following two messages

A merging declaration of '{0}' must be exported to be consistent with its other declarations.
A merging declaration of '{0}' must not be exported to be consistent with its other declarations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah the problem is the scope ambiguity. If 'All' takes wide scope, it is a tautology.

How about: "Individual declarations in a merged declaration must be all exported or all local.

I like Daniel's suggestions too

// we use SymbolFlags.ExportValue, SymbolFlags.ExportType and SymbolFlags.ExportNamespace
// to denote disjoint declarationSpaces (without making new enum type).
var declarationSpaces: SymbolFlags = 0;
var hasExport: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Why not just make this false?

Also, can you make this symbolHasExport?

@vladima
Copy link
Contributor Author

vladima commented Jul 26, 2014

@ahejlsberg do you have any comments or notes?

@ahejlsberg
Copy link
Member

👍

vladima added a commit that referenced this pull request Jul 28, 2014
Alternative proposal for grouping exported and local declarations
@vladima vladima merged commit df3567c into master Jul 28, 2014
@vladima vladima deleted the locals_exports branch August 3, 2014 05:40
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants