On 2018-12-13 00:36, Adam D. Ruppe wrote:

So I got out my code that (with your help about a year ago) was doing a
hello world window and menu, but now it doesn't compile, complaining
about a hidden Class clashing with my Class.

Hmm, it was not my intention for that to be exposed yet.

You don't need that hack with an extra interface called "Class" anymore. It's now possible to declare static/class methods directly, which wasn't possible before.

Technically in Objective-C static methods are instance methods on the metaclass. All classes in Objective-C are objects, they're instance of the metaclass. Each class has a corresponding metaclass. The class/interface you have implemented called "Class" was the metaclass, manually declared. This metaclass is normally not visible in the source code in Objective-C. What we did was we declared instance methods on the metaclass, this is now handled behind the scenes when you're declaring a method with "static" in the normal class/interface.

If you're code is looking like this:

extern (Objective-C) interface Foo
{
    extern (Objective-C) interface Class
    {
        Foo alloc() @selector("alloc");
    }
}

You can now replace it with this code:

extern (Objective-C) interface Foo
{
    static Foo alloc() @selector("alloc");
}

And you can directly call "Foo.alloc()".

It was not my intention to break existing code. I think if you rename your "Class" to something else it will continue to work.

What is the current state and roadmap for this support?

There's no roadmap. It's whenever I got time to work on the Objective-C integration. Lately I've been prioritizing other work. But it would be the next thing on the list of Objective-C features to implement.

The stuff described here seems wrong: https://dlang.org/spec/objc_interface.html

No, that's correct. The example at the bottom compiles and runs correctly using DMD 2.083.0.

and this apparently hasn't been edited for years:
https://wiki.dlang.org/DIP43 but SEEMS to be what closest matches up.

I'm not sure if DIP43 needs to be changed. It's what I'm following when implementing, more or less. It's just that not everything in DIP43 has been implemented yet.

--
/Jacob Carlborg

Reply via email to