Skip to content

add Output::write_string; rename Writer::writewrite_data#386

Open
bobzhang wants to merge 2 commits into
mainfrom
stdio-output-write-string
Open

add Output::write_string; rename Writer::writewrite_data#386
bobzhang wants to merge 2 commits into
mainfrom
stdio-output-write-string

Conversation

@bobzhang
Copy link
Copy Markdown
Contributor

@bobzhang bobzhang commented May 22, 2026

Summary

Two related changes (commits separated for review):

  1. Output::write_string on @stdio.Output — mirror of the helper introduced for ServerConnection in ff28856, so out <+ "hello \{x}" resolves on stdio/stderr.
  2. Rename Writer::write(&Data)write_data(&Data) on the @io.Writer trait, with a #deprecated write alias kept for backwards compatibility. This frees up the write name for a future fn[A: Show] write(Self, A) overload, at which point <+ can render any value (not just &Data-implementing types).

The internal call sites (~280) are migrated mechanically from .write(...) to .write_data(...). <+ macro expansions in examples/http_file_server still hit the deprecated write (7 warnings) and will be cleaned up when the Show-based overload lands in a follow-up.

Test plan

  • moon check — 0 errors; 8 expected deprecation warnings (7 from <+ in http_file_server, 1 from the deprecated write shim's own body in src/io/deprecated.mbt)
  • moon test — 490/490 pass
  • mbti regenerated for io and stdio

🤖 Generated with Claude Code

Mirrors the helper added to `ServerConnection` so that string
interpolation can be streamed directly into `@stdio.stdout` /
`@stdio.stderr` via `out <+ "hello \{x}"`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coveralls
Copy link
Copy Markdown

coveralls commented May 22, 2026

Coverage Report for CI Build 345

Coverage increased (+0.01%) to 79.362%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 11 uncovered changes across 6 files (23 of 34 lines covered, 67.65%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/http/send.mbt 17 13 76.47%
src/http/client.mbt 3 0 0.0%
examples/tcp_server_benchmark/main.mbt 1 0 0.0%
src/io/writer.mbt 2 1 50.0%
src/stdio/stdio.mbt 1 0 0.0%
src/websocket/server.mbt 1 0 0.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4201
Covered Lines: 3334
Line Coverage: 79.36%
Coverage Strength: 80193.28 hits per line

💛 - Coveralls

`write(&Data)` is renamed to `write_data(&Data)` on the `@io.Writer`
trait, with a deprecated `write` shim kept for backwards compatibility.
This frees up the `write` name for a future `Show`-based overload that
will let `<+` interpolation render any value.

Internal call sites are migrated mechanically. `<+` macro expansions in
`examples/http_file_server` still resolve to the deprecated `write` and
will be cleaned up when the Show-based `write` lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bobzhang bobzhang changed the title add Output::write_string for <+ sugar add Output::write_string; rename Writer::writewrite_data May 22, 2026
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.

2 participants