Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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.

@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.

@0xEAB
Copy link
Member

0xEAB commented Mar 22, 2025

Backup of the original branch: https://github.com/0xEAB/phobos/tree/fix-gh-10550-backup

@pbackus
Copy link
Contributor Author

pbackus commented Mar 22, 2025

@0xEAB Is there a reason you've force-pushed on top of my PR?

@pbackus
Copy link
Contributor Author

pbackus commented Mar 22, 2025

Ok, looks like you've rebased onto current master. Next time, please just notify me so that I can do it myself. I actually have an unpublished commit on this branch (adding a changelog entry), and now I'm going to have to clean up your mess in order to push it.

@pbackus
Copy link
Contributor Author

pbackus commented Mar 22, 2025

Rebased, added changelog, and disabled "Allow edits by maintainers," since apparently that's a privilege that not everyone here can be trusted with. Ping me if you need it re-enabled.

@0xEAB
Copy link
Member

0xEAB commented Mar 22, 2025

Ok, looks like you've rebased onto current master. Next time, please just notify me so that I can do it myself.

Sorry, will do so.

Rebased, added changelog, and disabled "Allow edits by maintainers," since apparently that's a privilege that not everyone here can be trusted with.

  • I was curious whether the D-Scanner issue was still a thing, given that at least libdparse had been updated.
  • Also, another PR of mine had caused a conflict with this one already.
  • Given that this PR looked quite “finished” (and was suffering only from the external style checking incompatibility), I figured you wouldn’t mind having it rebased for you. I’m sorry.

pbackus added 3 commits March 28, 2025 15:53
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 Mar 28, 2025

Rebased again to include #10720

@LightBender LightBender merged commit b7395ea into dlang:master Mar 28, 2025
10 checks passed
vpanteleev-sym pushed a commit to vpanteleev-sym/phobos that referenced this pull request Jun 5, 2025
* std.conv: factor out writeTextImpl from textImpl

* std.conv: add writeText, writeWText, writeDText

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

Fixes dlang#10550

* Add changelog entry for writeText
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

5 participants