Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.conv: add writeText, writeWText, writeDText #10652

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pbackus
Copy link
Contributor

@pbackus pbackus commented Feb 27, 2025

These are variants of text, wtext, and dtext that write their output to an output range instead of returning a string.

Fixes #10550

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @pbackus! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

  • In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example, Fix Bugzilla Issue 12345 or Fix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#10652"

@pbackus
Copy link
Contributor Author

pbackus commented Feb 27, 2025

Style check is going to fail because of dlang-community/D-Scanner#956

@pbackus
Copy link
Contributor Author

pbackus commented Feb 27, 2025

CC @LightBender

@LightBender
Copy link
Contributor

Naming nit:
writeWtext = writeWText
writeDtext = writeDText

@pbackus
Copy link
Contributor Author

pbackus commented Feb 27, 2025

The current names were chosen to be consistent with text, wtext, and dtext, which do not capitalize the word "text." I don't mind changing them if we think quality of new names is more important than consistency with old ones, though.

@LightBender
Copy link
Contributor

In v3 those methods are getting renamed. Likely to something like asText, asWText, and asDText. There is a thread about these names in the v3 design repo.

These are variants of text, wtext, and dtext that write their output to
an output range instead of returning a string.

Fixes dlang#10550
@pbackus
Copy link
Contributor Author

pbackus commented Feb 28, 2025

Ok; I'll assume you're bringing this up because you think that we should also follow this Phobos v3 naming convention when adding new symbols to Phobos v2, even if it breaks consistency with existing v2 symbols.

@pbackus pbackus changed the title std.conv: add writeText, writeWtext, writeDtext std.conv: add writeText, writeWText, writeDText Feb 28, 2025
@LightBender
Copy link
Contributor

TBH, I've gone round and round on the idea of V2 names following the V3 conventions even if that breaks consistency, both with others and with myself.

And where I've landed on it is: Every name that does not change between versions is one less bit of friction to the process of upgrading your code to V3. It's already going to be an unpleasant chore, anything that makes it easier will help convince people to make the switch.

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.

formattedWrite should support string interpolation
3 participants