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

go/types: some small problems in docs #35189

Closed
yaxinlx opened this issue Oct 26, 2019 · 5 comments
Closed

go/types: some small problems in docs #35189

yaxinlx opened this issue Oct 26, 2019 · 5 comments

Comments

@yaxinlx
Copy link

@yaxinlx yaxinlx commented Oct 26, 2019

In the docs of the selections:

Selector    Kind          Recv    Obj    Type               Index     Indirect

p.x         FieldVal      T       x      int                {0}       true
p.m         MethodVal     *T      m      func (e *T) m()    {1, 0}    true
T.m         MethodExpr    T       m      func m(_ T)        {1, 0}    fals

Should the Type columns for the second and third line be func() and func(_ T)?

@yaxinlx
Copy link
Author

@yaxinlx yaxinlx commented Oct 27, 2019

And in the func (*Scope) LookupParent docs:

...  (see Insert, below) ...

The Insert method docs is shown above the LookupParent docs in fact.

Loading

@yaxinlx yaxinlx changed the title go/types: types of selections go/types: some small problems in docs Oct 27, 2019
@dmitshur
Copy link
Contributor

@dmitshur dmitshur commented Oct 29, 2019

The Insert method docs is shown above the LookupParent docs in fact.

It's below in source code, but above in documentation (since godoc displays identifiers in alphabetical order). We can fix this by making it say just "see Insert"; the reader should be able to find Insert easily in either medium.

Loading

@dmitshur
Copy link
Contributor

@dmitshur dmitshur commented Oct 29, 2019

Should the Type columns for the second and third line be func() and func(_ T)?

That does seem more fitting to me too. It's also what https://github.com/golang/example/tree/master/gotypes#selections uses. The current text seems to be close to what types.SelectionString may produce, but that is the string form of the entire selector expression, not just its type. (Relevant playground snippet here.)

@griesemer Do you agree it would be an improvement, or are we missing some context?

/cc @dominikh

Loading

@griesemer
Copy link
Contributor

@griesemer griesemer commented Oct 29, 2019

Agreed. CL forthcoming.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 29, 2019

Change https://golang.org/cl/204044 mentions this issue: go/types: clarify documentation

Loading

@gopherbot gopherbot closed this in 20d621d Oct 29, 2019
@golang golang locked and limited conversation to collaborators Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants