On Sunday, September 8, 2019 12:12:53 PM MDT Exil via Digitalmars-d-learn wrote: > On Saturday, 7 September 2019 at 22:19:48 UTC, Jonathan M Davis > > wrote: > > On Saturday, September 7, 2019 3:40:58 PM MDT Exil via > > > > Digitalmars-d-learn wrote: > >> On Saturday, 7 September 2019 at 17:22:07 UTC, Jonathan M Davis > >> > >> wrote: > >> > @safe: > >> > @system: > >> > > >> > then @system overrides @safe. > >> > >> Just to add onto this, you can't do: > >> @safe @system void foo(); // error > >> > >> but you can do: > >> extern(C++, ns1) extern(C++, ns2) void foo(); // ok > > > > It makes no sense to apply multiple namespaces to the same > > symbol. I expect that this behavior is due to a lack of testing > > (the same with the out of order weirdness in the other post). > > It's the sort of thing that you test when you're trying to make > > sure that the feature does the right thing when people use it > > incorrectly, not the sort of thing when you're trying to make > > sure that the feature works as intended, so it's easy to forget. > > > > My guess is that this behavior leaked its way in due to the > > fact that you > > need to be able to put multiple extern(C++) declarations on a > > symbol when > > you use extern(C++, struct) or extern(C++, class) in addition > > to the > > extern(C++) for the namespace. > > > > - Jonathan M Davis > > You don't need to make guesses or assumptions. It most definitely > was intentional. > > https://github.com/dlang/dmd/commit/4b2578e208f2af9a02159fc2d8d87fb17b0900 > 5e#diff-62dcb5f0ffc3089b7565897d8beb3322R617 > > > By the looks of it, this feature was also implemented before > extern(C++, struct/class).
Well, it's inconsistent with the rest of the language and bad design IMHO. And even if it were desirable behavior, it clearly becomes a mess with the ordering once the attributes are no longer directly on the symbol. Of course, ideally, the whole extern(C++) feature with identifiers instead of strings for the namespace would be deprecated anyway. - Jonathan M Davis