Skip to content

refactor(hashmap, set): remove the deprecated Show impls - #4199

Merged
bobzhang merged 1 commit into
mainfrom
hongbo/simplify-template-collections
Sep 3, 2026
Merged

refactor(hashmap, set): remove the deprecated Show impls#4199
bobzhang merged 1 commit into
mainfrom
hongbo/simplify-template-collections

Conversation

@bobzhang

@bobzhang bobzhang commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Removes the deprecated Show impls for HashMap and linked-hash Set
(both were #deprecated in favor of @debug.Debug), together with their
hidden Show::{output, to_string} extends and the hashmap test that only
exercised the deprecated Show rendering. Nothing in the tree renders
these collections through Show anymore, so the impls are simply gone
(-85 lines).

Rewritten from the earlier <+>-refactor version of this PR after review
feedback: polishing deprecated impls is wasted effort, removing them is
cleaner.

Verified: moon check 0 warnings/0 errors; hashmap 139/139, set 70/70.

Generated with SeekMoon

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are a small, mechanically verifiable refactor of Show punctuation output with no observed behavioral or API impact in the reviewed hunks.

Pull request overview

Refactors Show implementations for HashMap and linked-hash Set to write delimiters/separators via <+ template writing (including inline writer holes), with the goal of simplifying punctuation handling while keeping write_object dispatch monomorphic and preserving output.

Changes:

  • Updated Set[K] Show::output to emit {, , , and } using <+ instead of write_string.
  • Updated HashMap[K, V] Show::output to emit HashMap::from_array([ ... ]) and element tuple punctuation using <+, collapsing per-field punctuation into a single template string with writer holes.
File summaries
File Description
set/linked_hash_set.mbt Switches Set Show punctuation writes ({, , , }) to <+ templates.
hashmap/utils.mbt Switches HashMap Show punctuation and tuple formatting to <+ templates with inline writer holes.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@coveralls

coveralls commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 6538

Coverage increased (+0.02%) to 89.21%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 18165
Covered Lines: 16205
Line Coverage: 89.21%
Coverage Strength: 275304.73 hits per line

💛 - Coveralls

Comment thread hashmap/utils.mbt Outdated
@@ -337,18 +337,14 @@ pub impl[K : Show, V : Show] Show for HashMap[K, V]

///|
pub impl[K : Show, V : Show] Show for HashMap[K, V] with fn output(self, logger) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should impl Show for HashMap be deprecated?
if it is maybe remove it now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right - this Show impl is #deprecated (Debug migration). Per your suggestion I've turned the PR into a removal instead: Show for HashMap is deleted together with the hidden Show::{output, to_string} extends and the test that only exercised the deprecated Show. moon check is clean; hashmap 139/139 and set 70/70 pass.

Comment thread set/linked_hash_set.mbt Outdated
@@ -468,13 +468,13 @@ pub impl[K : Show] Show for Set[K]

///|
pub impl[K : Show] Show for Set[K] with fn output(self, logger) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - Show for Set was deprecated in favor of @debug.Debug; the impl, its hidden Show extends, and any test only exercising the deprecated Show are now removed. hashmap 139/139 and set 70/70 pass.

@bobzhang
bobzhang force-pushed the hongbo/simplify-template-collections branch from a9a3371 to 939b2f1 Compare September 3, 2026 07:45
@bobzhang bobzhang changed the title refactor(hashmap, set): collapse Show punctuation into <+> templates refactor(hashmap, set): remove the deprecated Show impls Sep 3, 2026
@bobzhang
bobzhang enabled auto-merge (rebase) September 3, 2026 08:09
`Show` for `HashMap` and linked-hash `Set` was deprecated in favor of
`@debug.Debug`. Drop the impls (and their hidden `Show::{output,
to_string}` extends plus the now-obsolete Show test), now that nothing in
the tree renders these collections through `Show` anymore.

Co-Authored-By: SeekMoon <seekmoon@moonbitlang.com>
@bobzhang
bobzhang force-pushed the hongbo/simplify-template-collections branch from 939b2f1 to 853dd29 Compare September 3, 2026 08:09
@bobzhang
bobzhang merged commit 50531f5 into main Sep 3, 2026
16 checks passed
@bobzhang
bobzhang deleted the hongbo/simplify-template-collections branch September 3, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants