JuliaDiff / JuliaDiff/BlueStyle
Prefer `where {T}` to `where T`?
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 519
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
As far as i can am aware, BlueStyle has no opinion on this.
even the example code in this style guide itself is inconsistent, sometimes using where {T} and othertimes where T (or where {T <: Int} and othertimes where T <: Int).
We could stick with having no preference, however, for the sake of running a formatter (https://github.com/domluna/JuliaFormatter.jl/issues/283, #7 ), what should a formatter do?
We have four options (to my mind, anyway)
- always prefer braces:
where {T}towhere T - always prefer NO braces:
where Ttowhere {T}(when valid) - sometimes prefer NO braces (in a subset of cases of the valid cases, based on some rule)
- do nothing
Option (4) is "do nothing". This isn't a great option for 2 reasons: (1) stylistically, we probably want a code-base to be consistent on this, it's one thing to say "either is fine", and another to say "both is fine". (2) effort-wise, the formatter can/does already fix these cases, so i see no reason to add functionality to leave a code-base less consistent.
I see no reason to come up with a subtle rule here (we've survived without it so far), so let's not do option (3), which is the most complicated.
This leaves options (1) and (2). Since we have no strong preference here (based on the current style guide), i say we stick with the decision made in https://github.com/domluna/JuliaFormatter.jl/issues/53 and go with option (1) -- it's the more common pattern in Julia Base, and it's what JuliaFormatter does right now -- so for the sake of the formatter, prefer where {T} to where T.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the BlueStyle guide's examples and the referenced JuliaFormatter issues #53 and #283 to confirm the intended convention. Done means the guide states one consistent preference for where {T} versus where T and its examples follow that preference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100