Re: Value of the MAC_OS_X_VERSION_MIN_REQUIRED macro

2016-02-20 Thread Quincey Morris
On Feb 20, 2016, at 23:07 , Ilya Kulakov  wrote:
> 
> Checking version of the OS is the least problem. Providing an implementation 
> is the actual one.
> I want to use weaks, because they are easier for developers who are tought by 
> new documentation and didn't learn to explicitly nullify references to 
> objects like delegate. Not saying that one would want to this logic in an app 
> that targets newer versions of OS X.

Ah, I see.

Assuming the compiler version you’re using accepts ‘weak’, then that should 
function as a non-zeroing weak reference on OS X versions that don’t have 
support for zeroing. You could then document that clients targeting 10.6 must 
nullify the delegate before deallocating it, leaving the convenience of zeroing 
to more “modern” clients, without having to write any zeroing code yourself, or 
using any conditional code at compile time or run time. 

(But check that this is actually feasible. I realize I might be confusing the 
old GC zeroing weak with ARC zeroing weak, if there’s a difference in effective 
functionality.)

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Value of the MAC_OS_X_VERSION_MIN_REQUIRED macro

2016-02-20 Thread Ilya Kulakov
Quincey,

Checking version of the OS is the least problem. Providing an implementation is 
the actual one.
I want to use weaks, because they are easier for developers who are tought by 
new documentation and didn't learn to explicitly nullify references to objects 
like delegate. Not saying that one would want to this logic in an app that 
targets newer versions of OS X.


> On 21 февр. 2016 г., at 11:50, Quincey Morris 
>  wrote:
> 
> On Feb 20, 2016, at 21:03 , Ilya Kulakov  > wrote:
>> 
>> There should be an ability to makes this decision in runtime I guess.
> 
> Well, there is, if you mean that you make the decision — -[NSProcessInfo 
> isOperatingSystemAtLeastVersion:].
> 
> I’m not sure I understand, though, why you want to have this decision made. 
> If you wrote code to make ‘assign’ (aka ‘unowned’) work in 10.6, that code — 
> manual zeroing of the reference, I mean — will necessarily work in later 
> versions, so why not just go with that unconditionally?
> 
> OTOH, if you have a good reason for wanting to use ‘weak’ instead, it seems 
> to me that’s a good reason to withdraw support for 10.6**, or at least to 
> have a separate build for clients that want to run on 10.6.
> 
> 
> ** I’m not sure I remember now, but didn’t 10.6.8 have support for zeroing 
> weak references? If that’s so, you could just withdraw support for 10.6.7 or 
> earlier, which shouldn't upset anyone greatly.
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Value of the MAC_OS_X_VERSION_MIN_REQUIRED macro

2016-02-20 Thread Quincey Morris
On Feb 20, 2016, at 21:03 , Ilya Kulakov  wrote:
> 
> There should be an ability to makes this decision in runtime I guess.

Well, there is, if you mean that you make the decision — -[NSProcessInfo 
isOperatingSystemAtLeastVersion:].

I’m not sure I understand, though, why you want to have this decision made. If 
you wrote code to make ‘assign’ (aka ‘unowned’) work in 10.6, that code — 
manual zeroing of the reference, I mean — will necessarily work in later 
versions, so why not just go with that unconditionally?

OTOH, if you have a good reason for wanting to use ‘weak’ instead, it seems to 
me that’s a good reason to withdraw support for 10.6**, or at least to have a 
separate build for clients that want to run on 10.6.


** I’m not sure I remember now, but didn’t 10.6.8 have support for zeroing weak 
references? If that’s so, you could just withdraw support for 10.6.7 or 
earlier, which shouldn't upset anyone greatly.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Value of the MAC_OS_X_VERSION_MIN_REQUIRED macro

2016-02-20 Thread Ilya Kulakov
Indeed, I didn't think of that. There should be an ability to makes this 
decision in runtime I guess.

Best Regards
Ilya Kulakov

> On 21 февр. 2016 г., at 3:42, Jean-Daniel Dupas  wrote:
> 
> It is unsafe to use availability conditional in headers.
> You can’t guarantee that the framework client will has the same settings that 
> what was used to compile the framework.
> 
> That said, if you want to use weak when compiling for ARC and assign 
> otherwise, you can just use #if __has_feature(objc_arc)
> 
> 
>> Le 20 févr. 2016 à 19:00, Ilya Kulakov  a écrit :
>> 
>> Hi,
>> 
>> I would like to add support for ARC's weaks to my framework that supports 
>> Mac OS X down to 10.6
>> 
>> My current solution is:
>> 
>> #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED 
>> >= 1070
>>   @property (weak) NSObject *delegate;
>> #else
>>   @property (assign) NSObject *delegate;
>> #endif
>> 
>> However, the value of MAC_OS_X_VERSION_MIN_REQUIRED is always 1070 despite 
>> of set Deployment Target (I compile on 10.11).
>> Why is it so and what solution could I use in my situation?
>> 
>> Best Regards,
>> Ilya Kulakov
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
>> 
>> This email sent to mail...@xenonium.com
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Value of the MAC_OS_X_VERSION_MIN_REQUIRED macro

2016-02-20 Thread Jean-Daniel Dupas
It is unsafe to use availability conditional in headers.
You can’t guarantee that the framework client will has the same settings that 
what was used to compile the framework.

That said, if you want to use weak when compiling for ARC and assign otherwise, 
you can just use #if __has_feature(objc_arc)


> Le 20 févr. 2016 à 19:00, Ilya Kulakov  a écrit :
> 
> Hi,
> 
> I would like to add support for ARC's weaks to my framework that supports Mac 
> OS X down to 10.6
> 
> My current solution is:
> 
> #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED 
> >= 1070
>@property (weak) NSObject *delegate;
> #else
>@property (assign) NSObject *delegate;
> #endif
> 
> However, the value of MAC_OS_X_VERSION_MIN_REQUIRED is always 1070 despite of 
> set Deployment Target (I compile on 10.11).
> Why is it so and what solution could I use in my situation?
> 
> Best Regards,
> Ilya Kulakov
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
> 
> This email sent to mail...@xenonium.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Value of the MAC_OS_X_VERSION_MIN_REQUIRED macro

2016-02-20 Thread Ilya Kulakov
Hi,

I would like to add support for ARC's weaks to my framework that supports Mac 
OS X down to 10.6

My current solution is:

#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 
1070
@property (weak) NSObject *delegate;
#else
@property (assign) NSObject *delegate;
#endif

However, the value of MAC_OS_X_VERSION_MIN_REQUIRED is always 1070 despite of 
set Deployment Target (I compile on 10.11).
Why is it so and what solution could I use in my situation?

Best Regards,
Ilya Kulakov


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com