Skip to content

fix, prevent a few traits to hijack the "i" identifier#5446

Closed
ghost wants to merge 2 commits intomasterfrom
unknown repository
Closed

fix, prevent a few traits to hijack the "i" identifier#5446
ghost wants to merge 2 commits intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Jun 6, 2017

from IRC, discovered with this paste https://dpaste.dzfl.pl/8d46ad513fbe, by "mitch_"

@dnadlinger
Copy link
Contributor

Isn't the fact that there is a conflict in the first place a bug in the code (or compiler)?

@ghost
Copy link
Author

ghost commented Jun 6, 2017

No, "i" was just a poorly chosen identifier. I have already encountered the same issue with a custom template. People have to take care to the identifiers they use in things that get mixed or that are templates.

@dnadlinger
Copy link
Contributor

Why should the name of a template parameter matter? It shouldn't leak into the external scope, and of course take precedence in the internal scope.

@ghost
Copy link
Author

ghost commented Jun 6, 2017

this fix is pragmatic.

@jmdavis
Copy link
Member

jmdavis commented Jun 6, 2017

If the name is leaking, it's a compiler bug and needs to be fixed. Picking a different name just changes what conflicts. And while __i is less likely to conflict, it's also using double underscores, which as I understand it is supposed to only be used by the compiler, and using it in a variable name is asking for trouble.

@ghost
Copy link
Author

ghost commented Jun 6, 2017

In the meantime, waiting for a compiler fix, this workaround is there.

@aG0aep6G
Copy link
Contributor

aG0aep6G commented Jun 6, 2017

Is there a Bugzilla issue for the compiler bug? Looks nasty.

@quickfur
Copy link
Member

quickfur commented Jun 6, 2017

Wow, this looks really nasty. I think it needs to be fixed in the compiler. Hacking the identifier to be __i is just bandaging over the real problem. Since Phobos fixes aren't going to be available until the next release anyway, what we need is a high-priority compiler bug to make sure the fix gets in by the next release.

@ghost ghost closed this Jun 11, 2017
@ghost ghost deleted the traits-ident-hijack branch June 11, 2017 20:10
This pull request was closed.
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.

4 participants