Skip to content

Conversation

yebblies
Copy link
Contributor

No description provided.

@@ -2463,7 +2463,7 @@ class EncodingSchemeASCII : EncodingScheme
"ISO_646.irv:1991",
"US-ASCII",
"cp367",
"csASCII"
"csASCII",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug?

@JakobOvrum
Copy link
Contributor

I think this pull request really proves that we need to get rid of this terrible misfeature from the language.

@DmitryOlshansky
Copy link
Member

+1 I'm convinced ;)

@monarchdodra
Copy link
Collaborator

I think this pull request really proves that we need to get rid of this terrible misfeature from the language.

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?

@yebblies
Copy link
Contributor Author

Yup. It'll probably break existing code, and people will groan, but clearly, this is a miss-feature.

We can start with a warning, people will learn to deal with it.

Is there a dmd pull you used to detect these, or did you do it all by hand?

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.

@bearophile
Copy link

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

@yebblies
Copy link
Contributor Author

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

@bearophile
Copy link

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

@yebblies
Copy link
Contributor Author

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

@monarchdodra
Copy link
Collaborator

Auto-merge toggled on

monarchdodra added a commit that referenced this pull request Jan 24, 2014
Remove use of automatic adjacent string literal concatenation from phobos
@monarchdodra monarchdodra merged commit 31a5813 into dlang:master Jan 24, 2014
@yebblies yebblies deleted the stringcat branch January 25, 2014 01:22
@yebblies
Copy link
Contributor Author

Thanks!

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.

5 participants