-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
Fix issue 21203: Accept pragma(mangle) on aggregate types #11835
Conversation
|
What is issue 21203 ? |
|
This was a subtle attempt to not repeat myself yet one more time by saying:
Time to make this a keyboard macro. |
|
Well usually the bot would link that but this is a draft PR. |
It's not about the link. It's about:
|
c8021f6 to
22e398a
Compare
e135128 to
8383437
Compare
baaabd4 to
914d6f1
Compare
5a7060b to
0a532a0
Compare
0a532a0 to
5485022
Compare
|
Thanks for your pull request and interest in making D better, @thewilsonator! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#11835" |
|
I'm afraid I find this very complex for something that should be really simple - just use "abc" as the name for a symbol instead of |
I have a hard time with adding a very confusing feature to D just to pass then just cast your |
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.
See my comments.
But you won't be able to mix that with code that uses |
You asserting that the user have the ability to change the source code, that is not always the case here. |
The user can change his own source code, and that is all that's necessary.
Sure you can, because D has different name spaces. That's what my example relied on. You can locally create which definition of |
If it is not their own code, then what? You are making assertions regarding @ibuclaw , @TurkeyMan , among others that are interested in this feature without knowing their situation that requires solution like this to exist. @thewilsonator Can you explain the motivation behind this feature and what problems can't be fixed with current solutions for Walter please? |
|
The issue contains a motivation for the feature. |
I take this above is what you referring to right? |
It is impossible to bind to anything that involves
Template argument list mangling where the desired name is different from the name in the source (e.g. |
|
I'm not objecting to attaching mangling to an aggregate. It's that 3rd argument that baffles me.
I still don't understand that. I have no idea what that does or why it is needed. @12345swordy 's comment does not use the third argument. |
extern(C++)
struct Foo {}
struct Bar(T) {}
extern(C++, "std")
{
class _function(T) { } // want to be std::function
}
template ScopeClass(C)
{
extern(C++, class)
pragma(mangle, stuff_goes_here)
struct ScopeClass { ... }
}By necessity of |
|
@thewilsonator What is the status on this? I see that the Azure builds are failing, however, when I try to check the error it says "Build is missing" |
|
Nick: the example you gave above is suspect, We don't need to copy the args from a symbol in this case, we have the template arg tuple which could be supplied to That said, this leads to some background on this discussion... However, there is a case where giving a tuple of args to pragma(mangle) falls over, which is the zero-template-args case. We can't distinguish these 2 cases: Trouble is though, that there is a critical difference in mangling between a not-a-template, and a var-arg template with zero args.
This is what lead Nick to prefer copying template args from a symbol, rather than receiving a list of template args to use for the mangling. The symbol being copied from can express being not-a-template, or having zero or more template args. I initially thought of a pair of So, the situation right now; I think the current implementation supports these cases: I think we can do with these 2 forms: And the user can express: I recall making this recommendation to Nick, and I think he may have had a reason he didn't do this...? An alternative solution to solve the not-a-template vs zero-template-arg ambiguity would also be a consideration. I think On a side note; I just want to mention that this is actually a REALLY powerful feature. What this feature can do is solve the long-standing With this tool, we finally gain by-value binding compatibility with C++. This is HUGE. |
I'm sorry, all I see are bits and pieces of what that 3rd argument does. How about a real, minimal, actual example? |
3b71718 to
509f049
Compare
|
509f049 to
49a184c
Compare
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.
Everything LGTM. Just need @WalterBright approval on this.
The basic idea is to have a way to substitute the name of the class as a value type and then modify it (e.g. with
ref) to get the correct mangling for symbols that are otherwise impossible to represent.Todo
std::function)spec PR dlang/dlang.org#2875
cc @TurkeyMan @AndrejMitrovic