Skip to content
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

Bundle getter/setter names for lexical lookups #548

Merged
merged 16 commits into from
Sep 6, 2019

Conversation

eernstg
Copy link
Member

@eernstg eernstg commented Aug 27, 2019

This PR updates the language specification such that it specifies "bundling" of getters and setters for all parts of Dart except imports and exports, that is, whenever an identifier is looked up in the enclosing lexical scopes.

It defines a new concept of 'lexical lookup' which will look for id as well as id= and select the lexically nearest declaration with one of those names, and make it an error if we are looking up id and the selected scope has an id= but no id, and vice versa; or if we look up id/id= and nothing is in scope, conclude that we must use an instance member, and the class interface doesn't have the required getter-or-setter, and so on. It's a substantial rewrite, clarification, and bug fix.

In any case, the newly specified approach is what we already did/intended for 'Identifier Reference'.

It is also what the CFE already does for 'Unqualified Invocation'. (In this case, the spec required a simple search for id and ignored conflicts with id= in intermediate scopes, but the new text and the CFE behavior is more consistent with the rest of the language.)

For assignments, we used to spec a nearly consistent search for id as well as id=, and tools are actually slightly more consistent (in their bundling of getters and setters, as specified now).

All in all, this should not be a breaking change in any other way than for unqualified invocation.

@eernstg eernstg requested review from lrhn and leafpetersen August 27, 2019 17:13
@eernstg eernstg changed the title Bundle identifier lookup for lexical settings Bundle identifier lookup for lexical lookups Aug 27, 2019
@eernstg eernstg changed the title Bundle identifier lookup for lexical lookups Bundle getter/setter names for lexical lookups Aug 27, 2019
Copy link
Member

@leafpetersen leafpetersen left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this! This basically looks good to me. The one really substantive issue I have is around the definition of lexical scopes with respect to imports and exports. The implementations are inconsistent, and I don't feel like this rewrite pins down which one is incorrect. Is this just something that is already unspecified now, and we're just not (yet) resolving it? Or am I missing it?

specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Show resolved Hide resolved
specification/dartLangSpec.tex Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Show resolved Hide resolved
Copy link
Member Author

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

Review response. I think all comments have been resolved, but I kept the complex one open, namely: the one about considering imports/exports as a mechanism that could be specified in terms of scope nesting. I think we shouldn't do that, because we'd need a notion of namespace union + conflict resolution, and there's no need to pollute the rules about lexically nested scopes with such a concept.

specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Show resolved Hide resolved
specification/dartLangSpec.tex Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Show resolved Hide resolved
…iable"; also changed "getter" to "library getter" where an ambiguity could arise
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
Copy link
Member Author

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

Just a couple of issues not resolved.

specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
specification/dartLangSpec.tex Show resolved Hide resolved
specification/dartLangSpec.tex Outdated Show resolved Hide resolved
@lrhn
Copy link
Member

lrhn commented Sep 5, 2019

LGTM

@eernstg eernstg merged commit 8fa22ea into master Sep 6, 2019
@eernstg eernstg deleted the bundle_identifier_lookup_aug19 branch September 6, 2019 08:47
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.

4 participants