← Back to Pull requests

clarify that :compact prohibition on line breaks is for 2-arg show #55489

Open
stevengj opened this pull request with 2 lines diff across 1 files
View on GitHub
stevengj stevengj commented on Aug 13, 2024 23:38 UTC
Author

The docs say that :compact=>true in the IOContext means that the output should not contain line breaks. Clarify that this is for the 2-argument show(io, x) output.

(As opposed to 3-arg show, whose whole purpose has always been to enable verbose multi-line display, and which is normally only called at the top level by display, not for nested objects).

See also this discourse thread.

Diff: 2 lines (+1 / -1) across 1 files Reviewer: matthias314 Review duration: 1189135m
All Vouch review confidence checks passed
Residual risk 0.03 = Change Risk (0.17) × (1 − Review Confidence (0.83)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.17 · 2 lines diff across 1 files
0.17
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 1 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
83%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.066
Real PR Conversation Timeline
2 items
matthias314 matthias314 commented on code on Aug 14, 2024 12:36 UTC
Code Review
base/show.jl:1
@@ -352,7 +352,7 @@ The following properties are in common use:
 
  - `:compact`: Boolean specifying that values should be printed more compactly, e.g.
    that numbers should be printed with fewer digits. This is set when printing array
-   elements. `:compact` output should not contain line breaks.
+   elements. `:compact` output for 2-argument [`show(io, x)`](@ref) should not contain line breaks.

   elements. `:compact` output should not contain line breaks.
   This flag may be ignored for 3-argument [`show(io, mime, x)`](@ref).

I guess that this is what show for arrays and dictionaries does at present (apart from passing :compact on to the elements). It would also keep readers from asking themselves what "compact output with line breaks" may look like.

As expressed in the referenced Discourse thread, I would personally find a compact (human-readable) 3-argument show version quite useful. For this reason I suggest to add

Nevertheless, users are encouraged to take the `:compact` flag into account
when writing 3-argument `show` methods for the `"text/plain"` MIME type.

Reviewers
Assignees
stevengj stevengj
Labels
risk: low confidence: 83.4% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 16.6% (LOW) · Higher = larger blast radius
16.6%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 83.4% · Lower = rushed or shallow review
83.4%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 2.8% · Safe to merge
2.8%