Question about Xcode 12.5 Clang compiler release notes.


Alex Zavatone
 

From the release notes


> Clang now infers the availability of 
+new from availability annotations on -init methods. 
>
> Since +new calls [[Foo alloc] init]+new isn’t available unless +init is available. (75884815)


+init?  Is this a typo in the release notes??

Thanks in advance.
Alex Zavatone


Jack Brindle
 

No. It is correct. Both new and alloc are + methods since they act on the class, and not an object. If you think about it, there is no object to message when you use them.
From the docs:
+ (instancetype)new;

This method is a combination of alloc and init. Like alloc, it initializes the isa instance variable of the new object so it points to the class data structure. It then invokes the init method to complete the initialization process.

Jack


On Apr 27, 2021, at 6:42 AM, Alex Zavatone via groups.io <zav@...> wrote:

From the release notes


> Clang now infers the availability of 
+new from availability annotations on -init methods. 
>
> Since +new calls [[Foo alloc] init]+new isn’t available unless +init is available. (75884815)


+init?  Is this a typo in the release notes??

Thanks in advance.
Alex Zavatone


Jack Brindle
 

Oops. Sorry. new and alloc are +, but init is definitely -. You are right +init is an error.
So, file a bug report? ;-)

Jack

On Apr 27, 2021, at 7:27 AM, Jack Brindle via groups.io <jackbrindle@...> wrote:

No. It is correct. Both new and alloc are + methods since they act on the class, and not an object. If you think about it, there is no object to message when you use them.
From the docs:
+ (instancetype)new;

This method is a combination of alloc and init. Like alloc, it initializes the isa instance variable of the new object so it points to the class data structure. It then invokes the init method to complete the initialization process.

Jack


On Apr 27, 2021, at 6:42 AM, Alex Zavatone via groups.io <zav@...> wrote:

From the release notes


> Clang now infers the availability of 
+new from availability annotations on -init methods. 
>
> Since +new calls [[Foo alloc] init]+new isn’t available unless +init is available. (75884815)


+init?  Is this a typo in the release notes??

Thanks in advance.
Alex Zavatone