deprecate hex string literals#6925
Conversation
|
Thanks for your pull request, @bbasile! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
wilzbach
left a comment
There was a problem hiding this comment.
If this gets accepted, we shouldn't forget to update the deprecation page
changelog/deprecateHexStrings.dd
Outdated
| @@ -0,0 +1,3 @@ | |||
| HexString literals are deprecated. | |||
|
|
|||
| HexString literals are deprecated. Instead, the $(LINK2 https://dlang.org/phobos/std_conv.html#hexString hexString) template must be used. | |||
There was a problem hiding this comment.
Nit: You could link to http://dlang.org/spec/lex.html#HexString
|
Actually i see a slight problem caused by the removal of built-in hex strings: people who compile betterC D code will be, in a way, discriminated. |
| // https://dlang.dawg.eu/coverage/src/lexer.c.gcov.html | ||
|
|
||
| static s1 = x"123"; | ||
| static s2 = x"123G"; |
There was a problem hiding this comment.
These should still be tested, even while deprecated, as they are still supported.
Those who compile with -betterC are already discriminated against in much more serious ways. Don't worry about it. It's a tradeoff that they voluntarily opt into. |
|
@WalterBright - I think this needs your approval. Could you please quickly confirm that you are ok with deprecating hex strings (and I guess in the next step octal strings) so that @bbasile can move on here and get this through the auto-tester? |
|
I've detected a problem while removing the uses in phobos: void main()
{
import std.conv: hexString;
enum a1 = cast(ubyte[4]) x"40 41 42 43"; // compiles
enum a2 = cast(ubyte[4]) hexString!"40 41 42 43"; // fails
}both versions are not perfectly interchangeable. The library version doesn't allow cast to static arrays so there's a risk of of breakage, even if hex strings are finally rarely used, but well deprecation phase is there for this i suppose. |
enum ubyte[4] a2 = hexString!"40 41 42 43"; // worksDon't ask me why though :/. |
|
I'd like to put the focus on this PR: dlang/phobos#5546. You can also see that this affects a simple PR from a very casual committer. Is that just a random fact ? I don't think so. |
They have always been coupled (de facto). After all, that's why the auto-tester tests all three repos.
I am not sure I get your point, the deprecation messages are shown: https://auto-tester.puremagic.com/show-run.ghtml?projectid=1&runid=2651217&isPull=true Are you complaining about the fact that CircleCi fails and as a result doesn't report coverage? Or that most CIs are red?
It doesn't. This PR is blocked on @WalterBright's approval for changing the D language, when/if there's the approval, we can go ahead and merge your Phobos PR. |
|
No. The test are failing since yesterday because you've decided (I mean you and the other member who has approved) that the deprecations are now errors instead of warnings in phobos. Cant you see the problem ? If in the future something has to be deprecated the same will happen again. |
@bbasile is complaining that now that Phobos is failing the build, the autotester never gets around to running the DMD test suite. TBH I don't see much of a difference - you do want to have all uses of deprecated features removed from Phobos before the compiler change is merged, as it not only ensures there are no embarrassments about us ourselves still using features we don't want others to use, but also ensures that we have suitable replacements that are at least as good for Phobos. Whether to deprecate something also depends more on whether the idea is sound (for which being able to adequately fix the deprecation instances in Phobos makes a good litmus test), and secondly on the quality of the implementation (which the DMD test suite checks). Furthermore, you wrote about "platform specific failure missed locally", but deprecations by their nature are going to be a front end change, so there is not going to be much platform-dependent about it. I guess it would be possible in theory to check for deprecations in the Phobos tests instead of build, but I don't think the make file complications are worth it. Get your Phobos PR merged (dlang/phobos#5507), and then you will see DMD test results again. |
|
The difference is so obvious. From everything green yesterday to everything red today. Your new policy doesn't allow to test and integrate correctly new deprecations at the language level. |
As it should be. We should not be using features that we have deprecated in any components of D. Another point I forgot to mention above in that occasionally through negligence, we had shipped a version of D which caused deprecation warnings in Phobos when it is used as a library, i.e. someone imports a non-deprecated module and uses a non-deprecated symbol, and they get deprecation errors somewhere inside Phobos source code, making their program unbuildable with That this PR was showing as green in the autotester was a problem, which has now been fixed. The correct process is to first fix uses of deprecated symbols in Phobos/Druntime/etc., then have the deprecation merged. |
|
So i let the initiative to someone who'll be stasified by the way things are working here |

The library version was merged 2 years ago so it can be qualified as bug-free, allowing to remove the built-in version.