Type properties

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 7 23:46:30 PST 2016


On 2016-01-07 15:30, Steven Schveighoffer wrote:

> One thing that just occurred to me though, Objective-C makes use of the
> init function quite a bit. I wonder how getting rid of init as a
> customizable member would affect that.

NSObject init_() @selector("init");

With the full support for Objective-C, binding the "init" method would 
not be necessary at all. This will be supported:

auto foo = new NSObject;

Which will be lowered to:

auto foo = NSObject.alloc.init;

It will also be possible to bind a D constructor to an init method:

extern (Objective-C) class Foo : NSObject
{
     this(Foo) @selector("initWithFoo:");
}

Although, it's still a breaking change, which affect other projects.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list