JuliaDiff / JuliaDiff/BlueStyle

Relax opinion on use of `;` in NamedTuples?

Open
#62 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
519
Forks
34
PR merge metrics
No merged PRs in 30d

Description

Current guidnace is "NamedTuples should not be prefixed with ; at the start" (related to https://github.com/invenia/BlueStyle/pull/22)

As the current examples show this leads to these three cases having different style:

xy = (x=1, y=2)
x1 = (x=1,)  # Trailing comma required for correctness.
xs = (; kwargs...)  # Semicolon required to splat correctly.

I can't help but feel that this is a simpler rule:

xy = (; x=1, y=2)
x1 = (; x=1,) 
xs = (; kwargs...) 

Also, I write a lot of code in codebases that follow BlueStyle and I don't recall anyone ever corrected me on adding/removing a ;, so i wonder how much this guidance is even followed right now.

(related to #7, https://github.com/domluna/JuliaFormatter.jl/issues/283#issuecomment-687815553)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the current NamedTuple guidance and compare it with the three examples in this issue. Review related issue #7 and the JuliaFormatter.jl discussion linked in the body before deciding whether the rule should change. Done means reaching a documented decision and updating the style guidance consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.