[Issue 19700] [2.085.0-beta.2] Obj-C wrong code overloading selectors and extern(D)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 26 20:08:13 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19700
--- Comment #3 from Jacob Carlborg <doob at me.com> ---
(In reply to Adam D. Ruppe from comment #2)
> OK, I see. Well, in the mean time, at least now that I know what is causing
> this, it is very easy to work around. (It was just crazy at first to narrow
> it down, and since I frequently "comment" stuff with `version(none)` and
> that didn't change it, I thought I was crazy when it went away.)
>
> It is arguably bad form to include those extern(D) overloads side by side,
> though it is convenient, it isn't necessary. So, a possible fix to consider
> would just be to make it an error to mix extern declarations and body
> functions in the same class definition (excluding inherited declarations).
I don't think that would work. Because then this won't work:
extern (Objective-C)
class NSObject
{
NSObject init() @selector("init");
static NSObject alloc() @selector("alloc");
}
extern (Objective-C)
class Foo : NSObject
{
override Foo init() @selector("init");
override static Foo alloc() @selector("alloc");
void foo() @selector("foo") { }
}
In Foo we override "init" and "alloc" just to get the correct static return
type. I think the above example has to work.
--
More information about the Digitalmars-d-bugs
mailing list