July 24, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright Attachments:
| On Wed., 24 Jul. 2019, 4:05 pm Walter Bright via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: > On 7/24/2019 2:56 AM, Manu wrote: > > Just kill me and bring me peace. > > I lose my mind trying to argue with you, and get so frustrated and > angry, I just > > have to take a week or 2 timeout. > > On the other hand, you've gotten: > > 1. user defined attributes > 2. rvalue reference parameters > 3. restricted shared access > 4. mixin types > 5. the namespace string thing > Don't forget extern(C++), @nogc, win64... ;) > More than 10 years and a crazy amount of time arguing for some of those though! But this isn't like that... This isn't in the major or controversial feature category, it's just a bug... but apparently it's not; it's by design, and the design is great. > |
July 24, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 7/24/2019 4:03 PM, Walter Bright wrote:
> On the other hand, you've gotten:
>
> 1. user defined attributes
> 2. rvalue reference parameters
> 3. restricted shared access
> 4. mixin types
> 5. the namespace string thing
6. Windows 64 code generator
|
July 25, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Thursday, 25 July 2019 at 03:56:57 UTC, Walter Bright wrote:
> On 7/24/2019 4:03 PM, Walter Bright wrote:
>> On the other hand, you've gotten:
>>
>> 1. user defined attributes
>> 2. rvalue reference parameters
>> 3. restricted shared access
>> 4. mixin types
>> 5. the namespace string thing
>
> 6. Windows 64 code generator
these won't make people come, one weird shit make people go
|
July 25, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Elvis Zhou | We expect professional demeanor here, not cussing. |
July 25, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | On Wednesday, 24 July 2019 at 05:03:16 UTC, Manu wrote:
> https://issues.dlang.org/show_bug.cgi?id=20012
>
> I need to know who is the crazy one here?
> I can't believe the idea that extern(C) functions being mangled to
> un-knowable generated names is what any sane user would ever expect.
>
> Surely extern(C) means extern(C)?
>
> I'd like a poll here...
This has got to be one of the most duplicated issues in bugzilla. It's in there as 962 (12 years ago!), 4581, 6132, 7005, 12575, 15712, 15843, 17748, and now as 20012. There may even be more.
As evinced by 4581 (which I filed in 2013), I'm on your side here. I also like Mike Franklin's idea of pragma(mangle, D) to handle the other cases.
--
Simen
|
July 25, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Marler | On Thursday, 25 July 2019 at 00:24:11 UTC, Jonathan Marler wrote:
> On Wednesday, 24 July 2019 at 09:56:50 UTC, Manu wrote:
>> [...]
>
> You're not crazy. Walter can bey hard to discuss things with. I think he's tired of discussing things after so many years. He tends to ignore most things and only responds to what he thinks is important. If you're feeling burnt out, imagine how he feels after all the years he's been doing this.
>
> But know that you're not the only one who feels this way, and Walter tends to have a very different viewpoint on things. So don't take it personally, just because he disagrees with you doesn't mean you're wrong.
>
> As for this subject, I expect extern (C) to change both the API and the mangling, so I would expect the behavior described by Manu. However, I can see use cases for only changing the ABI while keeping mangling. It is very weird that extern (C) affects both in normal code, and only the ABI when it's inside a mixin template. Sounds like one of those very odd cases in C++ that Scott Meyers would put on one of his slides :)
>
> Dconf 2014 Day 2 Keynote: The Last Thing D Needs -- Scott Meyers
> https://www.youtube.com/watch?v=KAWA1DuvCnQ
>
> After reading the thread and thinking on a bit, it seems like it would be simpler to have extern (C) do the same thing in all cases, which would be to change the ABI and the mangling. If you want D mangling, use mangle(D) or something along with extern (C).
Ok, I think after reading this and the bug report, and the mentioned uses cases, the callback case is the one that should be treated differently, and not the vanilla case. So mangle(D) and extern(C) if you want mangling to be different for a C function makes things consistent and expected.
|
July 26, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Thursday, 25 July 2019 at 07:06:28 UTC, Walter Bright wrote:
> We expect professional demeanor here, not cussing.
No offence here, my point was that, we should first focus on fixing those weird things, other than expanding the language with new features, since it's obvious once a user quit with bad impressions after coming and trying d, he'll never back and we lose him forever, the inconsistency Manu mentioned is determined to give a bad impression.
|
July 26, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Wednesday, 24 July 2019 at 23:05:33 UTC, Walter Bright wrote: > On 7/24/2019 2:24 PM, Manu wrote: >> In that callback case, they're effectively anonymously named >> functions... > > Yet they are given a name, and extern(C) to get the right calling convention. I think the issue here is one of definitions and I think I understand why Walter and Manu do not understand each others point. For Manu extern(?) is mostly about mangling and secondarily about calling convention. For Walter, its first and foremost about calling convention. The mangling being unimportant as it can be explicitly set with mangle. When looking at what the specs says [1] it's clear that extern is more about calling conventions than mangling [1]: https://dlang.org/spec/attribute.html#linkage |
July 26, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Schluter | On Friday, 26 July 2019 at 12:55:10 UTC, Patrick Schluter wrote:
> On Wednesday, 24 July 2019 at 23:05:33 UTC, Walter Bright wrote:
>> On 7/24/2019 2:24 PM, Manu wrote:
>>> In that callback case, they're effectively anonymously named
>>> functions...
>>
>> Yet they are given a name, and extern(C) to get the right calling convention.
>
> I think the issue here is one of definitions and I think I understand why Walter and Manu do not understand each others point.
>
> For Manu extern(?) is mostly about mangling and secondarily about calling convention.
> For Walter, its first and foremost about calling convention. The mangling being unimportant as it can be explicitly set with mangle.
>
> When looking at what the specs says [1] it's clear that extern is more about calling conventions than mangling
>
> [1]: https://dlang.org/spec/attribute.html#linkage
To clarify. The issue here is that extern(?) is one keyword acting on 2 different things that are only loosely linked: the calling convention and the naming convention. What the different versions (C, C++, D, Windows, System, Objective-C) actually really do is very sketchy and not well defined and can even change from platform to platform (C++ mangles differently on Windows and Linux afaik).
|
July 26, 2019 Re: extern(C) names are being mangled; that's crazy, Walter says I'm crazy | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Schluter | On Fri, Jul 26, 2019 at 6:00 AM Patrick Schluter via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>
> On Wednesday, 24 July 2019 at 23:05:33 UTC, Walter Bright wrote:
> > On 7/24/2019 2:24 PM, Manu wrote:
> >> In that callback case, they're effectively anonymously named functions...
> >
> > Yet they are given a name, and extern(C) to get the right
> > calling convention.
>
> I think the issue here is one of definitions and I think I understand why Walter and Manu do not understand each others point.
>
> For Manu extern(?) is mostly about mangling and secondarily
> about calling convention.
> For Walter, its first and foremost about calling convention. The
> mangling being unimportant as it can be explicitly set with
> mangle.
>
> When looking at what the specs says [1] it's clear that extern is more about calling conventions than mangling
>
> [1]: https://dlang.org/spec/attribute.html#linkage
I'm pretty sure it's about both... you can't separate them and still
be the thing that's written on the tin.
It's highly surprising, and I raise the issue as important having
recently witnessed multiple people being surprised and unimpressed
with this particular quirk. I've talked a lot about tidying up weird
shit that makes bad impressions; I'm getting tired of too many little
things adding up this way, and making it really hard for me to get
colleagues invested and build confidence, this is one such thing.
|
Copyright © 1999-2021 by the D Language Foundation