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

help for +=, .+, etcetera #33301

Closed
stevengj opened this issue Sep 17, 2019 · 4 comments · Fixed by #35154
Closed

help for +=, .+, etcetera #33301

stevengj opened this issue Sep 17, 2019 · 4 comments · Fixed by #35154
Assignees
Labels
docs This change adds or pertains to documentation REPL Julia's REPL (Read Eval Print Loop)

Comments

@stevengj
Copy link
Member

Operators like += and dotted operators like .+ currently don't have any REPL help.

@stevengj stevengj added the docs This change adds or pertains to documentation label Sep 17, 2019
@fredrikekre fredrikekre added the good first issue Indicates a good issue for first-time contributors to Julia label Sep 17, 2019
@stevengj
Copy link
Member Author

stevengj commented Sep 17, 2019

e.g. this works for += etcetera (from this list in the lowering code):

import Base.BaseDocs.Keyword
for op in (:+, :-, :*, :/, ://, :\, :^, :÷, :%, :<<, :>>,  :>>>, :|, :&, :, :$)
    @eval @doc $("`x $op= y` is a synonym for `x = x $op y`")  $(Keyword(Symbol(op,"=")))
end

(Had to use the special Keyword wrapper since += does not parse as a valid identifier.)

(There are also "dotted" update operators like .+=.)

@stevengj
Copy link
Member Author

Since things like .+ parse, in principle we could just add ordinary documentation strings for each dottable operator. However, that is a bit annoying since the list of dottable operators is long and the only canonical list is in julia-parser.scm, which is not directly accessible from Julia.

Instead, it might be better to modify the @repl macro (which is used by the REPL module to look up help) to check for dotted operators.

@stevengj stevengj removed the good first issue Indicates a good issue for first-time contributors to Julia label Sep 17, 2019
@stevengj
Copy link
Member Author

(Removing the "good first issue" tag since getting into the guts of the documentation system like this is not very accessible to newbies.)

@stevengj
Copy link
Member Author

We'll also want to document .= specially, since broadcast assignment is different from other broadcast operators.

@JeffBezanson JeffBezanson self-assigned this Mar 18, 2020
@JeffBezanson JeffBezanson added the REPL Julia's REPL (Read Eval Print Loop) label Mar 18, 2020
JeffBezanson added a commit that referenced this issue Mar 18, 2020
- add docstrings for .= and .
- improve help prompt behavior on comment syntax
- add help text for dotted and updating operators
- remove `->` syntax from docstring for doc macro

Fixes #33301.
JeffBezanson added a commit that referenced this issue Mar 18, 2020
- add docstrings for .= and .
- improve help prompt behavior on comment syntax
- add help text for dotted and updating operators
- remove `->` syntax from docstring for doc macro

Fixes #33301.
JeffBezanson added a commit that referenced this issue Mar 20, 2020
- add docstrings for .= and .
- improve help prompt behavior on comment syntax
- add help text for dotted and updating operators
- remove `->` syntax from docstring for doc macro

Fixes #33301.
oxinabox pushed a commit to oxinabox/julia that referenced this issue Apr 8, 2020
- add docstrings for .= and .
- improve help prompt behavior on comment syntax
- add help text for dotted and updating operators
- remove `->` syntax from docstring for doc macro

Fixes JuliaLang#33301.
ravibitsgoa pushed a commit to ravibitsgoa/julia that referenced this issue Apr 9, 2020
- add docstrings for .= and .
- improve help prompt behavior on comment syntax
- add help text for dotted and updating operators
- remove `->` syntax from docstring for doc macro

Fixes JuliaLang#33301.
KristofferC pushed a commit that referenced this issue Apr 11, 2020
- add docstrings for .= and .
- improve help prompt behavior on comment syntax
- add help text for dotted and updating operators
- remove `->` syntax from docstring for doc macro

Fixes #33301.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants