-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
add spaces between type parameters and Dict entries #37085
Conversation
d820901
to
45d324b
Compare
45d324b
to
af17722
Compare
af17722
to
e7e4125
Compare
RIP every doctest in the ecosystem 😄 If people are running doctests on more than one Julia version, the following doctestfilters (https://juliadocs.github.io/Documenter.jl/stable/man/doctests/#Filtering-Doctests) can be applied to make it pass:
which should deal with this and also the two most common failures from #36107 ( |
Also interesting to note that in the codebase itself it seems that no space is winning:
Edit: And same in packages on my disk, no space is more common:
|
Crazy idea, but maybe Documenter should apply those filters by default..? |
Since doctests are pretty sensitive to printing like this, new random numbers streams etc, I think most packages only build and doctests on a single Julia version though. |
So? Should we go the other way and remove all the spaces? Or do we currently have an ideal compromise, using spaces half the time? 😄 |
I just wanted to point out that most Julia programmers prefer no space in type parameters. That is also the recommended style according to e.g. YASGuide (https://github.com/jrevels/YASGuide#linealignmentspacing-guidelines).
Yes: #25826 😄 |
Seems odd to me. I would almost guess it says that just to follow how we were printing them. @jrevels is that the case? |
Originally the YASGuide did not include the type parameter list exception in its "spaces-after-commas mandate", but we added it after it was brought up that most code in the wild does not include spaces after commas in type parameter lists (jrevels/YASGuide#3). So this exception was introduced purely to follow existing "convention" (or at least our perception of it, which probably was indeed influenced by the existing printing style). |
Even if we like it better, I'm not sure that changing away from no spaces is worth it. In the JuliaImages organization we had a half-dozen PRs like this one; that was a change that seems unambiguously better, yet despite that one can't help feeling like it was sort of a waste of a couple of hours (across the multiple packages). It's not always completely trivial to write these in a way that works across multiple Julia versions with different printing conventions and yet doesn't abandon all sense that you're actually testing the output in some meaningful way. I'm not saying it's hard, but it is the kind of annoyance that we should think twice before inflicting on folks. |
If you are adding spaces after commas, maybe julia> SVector{2}
SVector{2,T} where T = SArray{Tuple{2}, T, 1, 2} where T which is still inconsistent. |
Thanks for catching that, will fix. |
JuliaLang/julia#37085 changed how type parameters are printed, causing the following error: ``` Borders (issue JuliaImages#85): Test Failed at /home/runner/work/ImageFiltering.jl/ImageFiltering.jl/test/2d.jl:337 Expression: imfilter(A, kern, Fill(0, (3,))) Expected: ArgumentError("Fill{Int64,1}(0, (3,), (3,)) lacks the proper padding sizes for an array with 2 dimensions") Thrown: ArgumentError("Fill{Int64, 1}(0, (3,), (3,)) lacks the proper padding sizes for an array with 2 dimensions") ```
I expect this to be my most dramatic PR ever. I think this situation has gotten a bit silly:
Now that the
Vector
andMatrix
(etc.) type printing change is done, many of the tests this would break are already fixed. I'll fix the remainder if there is agreement.