-
-
Notifications
You must be signed in to change notification settings - Fork 741
Remove use of automatic adjacent string literal concatenation from phobos #1871
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
Conversation
@@ -2463,7 +2463,7 @@ class EncodingSchemeASCII : EncodingScheme | |||
"ISO_646.irv:1991", | |||
"US-ASCII", | |||
"cp367", | |||
"csASCII" | |||
"csASCII", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug?
I think this pull request really proves that we need to get rid of this terrible misfeature from the language. |
+1 I'm convinced ;) |
Yup. It'll probably break existing code, and people will groan, but clearly, this is a miss-feature. Is there a dmd pull you used to detect these, or did you do it all by hand? |
We can start with a warning, people will learn to deal with it.
Haha it's a one-line change to parse.c to warn on this. I'll open a pull request once this has gone in. |
@yebblies: thank you, my original request is almost four years old. The precedence of the automatic string joining (seen as an implicit operator) is higher than the precedence of ~, so this causes some problems because the semantics is different, so a good error message system should also differenetly handle and warn the situations where replacing the space with a tilde will change the code semantics. And the string joining should still be done at compile-time if possible, for efficiency. See the thread https://d.puremagic.com/issues/show_bug.cgi?id=3827 for more details. |
@bearophile I think the concerns about semantic changes and efficiency are exaggerated. I think this pull shows the vast majority of cases are trivially const-folded and involve only strings. |
@yebblies: Phobos shows that string auto-joining is an anti-feature, but there's more D code around than Phobos. Ignoring the potential problems will not help the acceptance of your future compiler patch. With some care all the problems listed by Don and others can be addressed. A patch designed to avoid bugs should try to avoid introducing some new bugs caused by operator precedence (and possibly avoid performance regressions in user code). |
@bearophile You seem to know what you want the patch to look like. Why don't you make a pull request? My guess is the patch will be shorter than the comment you just typed. |
Auto-merge toggled on |
Remove use of automatic adjacent string literal concatenation from phobos
Thanks! |
No description provided.