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

fix docstrings for & and | #34688

Merged
merged 1 commit into from
Feb 8, 2020

Conversation

tpapp
Copy link
Contributor

@tpapp tpapp commented Feb 6, 2020

The header of the docstring for & and | suggest a call syntax that is invalid (either needs ()s, or be infix). This is a trivial fix for that.

Issue noted here:

https://discourse.julialang.org/t/ampersand-operator-not-consistent-with-help/34266

@MasonProtter
Copy link
Contributor

Is it worth mentioning in the doc-string that one can do (&)(x, y) and (|)(x, y)?

@tpapp
Copy link
Contributor Author

tpapp commented Feb 7, 2020

@MasonProtter: that is generic information about using infix operators as prefix syntax, so I don't think we should mention it in specific docstrings.

Incidentally, I noted that many operators have this problem in docstrings (eg +, -), I wonder if they should be fixed in general.

@fredrikekre
Copy link
Member

Incidentally, I noted that many operators have this problem in docstrings (eg +, -), I wonder if they should be fixed in general.

But they work:

julia> +(1, 2)
3

The difference seems to be that & doesn't parse to a :call without the parenthesis. | actually work though:

julia> |(true, false)
true

(but the proposed change looks better anyway IMO).

@fredrikekre fredrikekre added the docs This change adds or pertains to documentation label Feb 7, 2020
@GunnarFarneback
Copy link
Contributor

Parsing of &: #34693

@MasonProtter
Copy link
Contributor

That is generic information about using infix operators as prefix syntax, so I don't think we should mention it in specific docstrings.

As Fredrik pointed out, the fact that you can't do &(a, b) but can do (&)(a, b) is a bit of an oddity among the infix operators, that might make it worth mentioning in its docstring.

@kshyatt
Copy link
Contributor

kshyatt commented Feb 8, 2020

Test on freebsd failed in SuiteSparse.

@kshyatt kshyatt merged commit 1895a29 into JuliaLang:master Feb 8, 2020
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants