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

Document name resolution. #568

Open
6 of 29 tasks
ehuss opened this issue Apr 21, 2019 · 6 comments
Open
6 of 29 tasks

Document name resolution. #568

ehuss opened this issue Apr 21, 2019 · 6 comments
Labels
A-resolve Name resolution, paths, namespaces, preludes, etc. New Content Missing features or aspects of language not currently documented.

Comments

@ehuss
Copy link
Contributor

ehuss commented Apr 21, 2019

Name resolution should be documented. This is a large topic. A few pieces I can think of:

@ehuss ehuss added the New Content Missing features or aspects of language not currently documented. label Apr 21, 2019
@ehuss ehuss added the A-resolve Name resolution, paths, namespaces, preludes, etc. label Jul 5, 2019
@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 27, 2019

cc @petrochenkov

@ehuss
Copy link
Contributor Author

ehuss commented Jan 10, 2021

Just to kick off a little discussion of the outline: a long while back I started an outline here: ehuss@bb2e84b

Since I think this will overall be a meaty topic, I think it would be good to split it into separate files from the start.

I think the "Paths" chapter should be moved underneath name resolution, since it doesn't really belong in the lexical chapter.

Some high-level questions:

  • Does it make sense to split it up like this?
  • I was thinking the "Definitions" chapter would list all the things that can introduce an identifier into scope. However, an alternative would be to spread that information out across the entire reference. So, for example, the struct item chapter could specify how various identifiers in a struct definition introduce different things into different namespaces. One concern is that could introduce a lot of verbiage across the entire reference. However, it would probably make more sense to describe that in-place instead of consolidating it in one chapter. So "Definitions" could possibly be removed, or maybe just shrunk into a small subsection in the chapter introduction.
  • What to call the things that identifiers can refer to? I was using "elements", but I don't think there is any precedent for that. It would be nice to have a word to refer to items+types+bindings+macros+attributes+whatever, but I couldn't find one already in use.

@petrochenkov
Copy link
Contributor

I was thinking the "Definitions" chapter would list all the things that can introduce an identifier into scope.

I think it would be good to have at least a list of definitions with links to other chapters, even if majority of the text will be elsewhere.

What to call the things that identifiers can refer to?

They are called NameBinding in the compiler, but it's a very old and sufficiently inconsistent name.
"Name introduction" perhaps? The introduction may either be a "name definition", or an "import"/"reexport" referring to a different name introduction.

@Havvy
Copy link
Contributor

Havvy commented Jan 11, 2021

Just to add a couple more questions:

  1. Do we want to call them "names" or "bindings"?
  2. Can we pick a better term than "name resolution"? I know it's the name we use in the compiler, but "resolve" doesn't really mean anything on its own? You could argue these names are references and we dereference them, but we already use Deref for pointers.

I like the term introduction for the places a binding/name is introduced. Also +1 on having a central list that links to more descriptions in the specific chapters.

For "elements", we could just be informal and say "parts of a program".

@petrochenkov
Copy link
Contributor

Can we pick a better term than "name resolution"?

In C++ it's officially called "name lookup", for example.

Do we want to call them "names" or "bindings"?

I would personally prefer "names".
AFAIK, the term "bindings" is only used for local variables in the user-facing documentation, and all those "variable vs binding" explanations never made sense to me.

@Havvy
Copy link
Contributor

Havvy commented Jan 11, 2021

AFAIK, the term "bindings" is only used for local variables in the user-facing documentation,

Yes. That is entirely correct and I am way too tired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Name resolution, paths, namespaces, preludes, etc. New Content Missing features or aspects of language not currently documented.
Projects
None yet
Development

No branches or pull requests

4 participants