Classes incompatible with weak references

2012-08-13 Thread Ben
I see in the documentation - and from a compiler error - that some classes are not compatible with weak references. What makes these classes incompatible? Perhaps I'm using the wrong search terms, but I can't seem to find information on why this should be the case. Can anyone shed some light on

Re: Classes incompatible with weak references

2012-08-13 Thread Kyle Sluder
On Aug 13, 2012, at 8:42 AM, Ben wrote: > I see in the documentation - and from a compiler error - that some classes > are not compatible with weak references. > > What makes these classes incompatible? They have custom implementations of -retain and -release. When NextSTEP was first released

Re: Classes incompatible with weak references

2012-08-13 Thread Jean-Daniel Dupas
Le 13 août 2012 à 17:56, Kyle Sluder a écrit : > On Aug 13, 2012, at 8:42 AM, Ben wrote: > >> I see in the documentation - and from a compiler error - that some classes >> are not compatible with weak references. >> >> What makes these classes incompatible? > > They have custom implementati

Re: Classes incompatible with weak references

2012-08-13 Thread John McCall
On Aug 13, 2012, at 9:29 AM, Jean-Daniel Dupas wrote: > Le 13 août 2012 à 17:56, Kyle Sluder a écrit : >> On Aug 13, 2012, at 8:42 AM, Ben wrote: >> >>> I see in the documentation - and from a compiler error - that some classes >>> are not compatible with weak references. >>> >>> What makes th

Re: Classes incompatible with weak references

2012-08-13 Thread Jean-Daniel Dupas
Le 13 août 2012 à 19:54, John McCall a écrit : > On Aug 13, 2012, at 9:29 AM, Jean-Daniel Dupas wrote: >> Le 13 août 2012 à 17:56, Kyle Sluder a écrit : >>> On Aug 13, 2012, at 8:42 AM, Ben wrote: >>> I see in the documentation - and from a compiler error - that some classes are no

Re: Classes incompatible with weak references

2012-08-13 Thread Kyle Sluder
On Mon, Aug 13, 2012, at 11:30 AM, Jean-Daniel Dupas wrote: > > Thanks for the details. I know what the fragile ABI, and the modern ABI > are but where I don't agree is when Kyle says that it was not possible to > add a refcount ivar when retain/release was introduced. As retain/release > was alre

Re: Classes incompatible with weak references

2012-08-13 Thread Mike Abdullah
On 13 Aug 2012, at 19:30, Jean-Daniel Dupas wrote: > > Le 13 août 2012 à 19:54, John McCall a écrit : > >> On Aug 13, 2012, at 9:29 AM, Jean-Daniel Dupas wrote: >>> Le 13 août 2012 à 17:56, Kyle Sluder a écrit : On Aug 13, 2012, at 8:42 AM, Ben wrote: > I see in the documenta

Re: Classes incompatible with weak references

2012-08-13 Thread Kyle Sluder
On Mon, Aug 13, 2012, at 02:47 PM, Mike Abdullah wrote: > An idea I've vaguely wondered about would be turning the isa variable > into a tagged pointer. If you know nothing is accessing it directly (to > do so was deprecated with the modern runtime), then, say, the last 4 bits > of the pointer coul

Re: Classes incompatible with weak references

2012-08-13 Thread Ken Ferry
On Aug 13, 2012, at 9:29 AM, Jean-Daniel Dupas wrote: > > Le 13 août 2012 à 17:56, Kyle Sluder a écrit : > >> On Aug 13, 2012, at 8:42 AM, Ben wrote: >> >>> I see in the documentation - and from a compiler error - that some classes >>> are not compatible with weak references. >>> >>> What

Re: Classes incompatible with weak references

2012-08-15 Thread Vincent Habchi
Le 13 août 2012, à 23:47, Mike Abdullah scripsit: > An idea I've vaguely wondered about would be turning the isa variable into a > tagged pointer. If you know nothing is accessing it directly (to do so was > deprecated with the modern runtime), then, say, the last 4 bits of the > pointer could

Re: Classes incompatible with weak references

2012-08-15 Thread Mike Abdullah
On 13 Aug 2012, at 16:56, Kyle Sluder wrote: > On Aug 13, 2012, at 8:42 AM, Ben wrote: > >> I see in the documentation - and from a compiler error - that some classes >> are not compatible with weak references. >> >> What makes these classes incompatible? > > They have custom implementation

Re: Classes incompatible with weak references

2012-08-15 Thread Stevo Brock
Ahh the Atari ST… Now those are fond memories indeed… -Stevo Brock Sunset Magicwerks, LLC www.sunsetmagicwerks.com 818-609-0258 On Aug 14, 2012, at 12:09 AM, Vincent Habchi wrote: > Le 13 août 2012, à 23:47, Mike Abdullah scripsit: > >> An idea I've vaguely wondered about would be turni

Re: Classes incompatible with weak references

2012-08-15 Thread Kyle Sluder
On Tue, Aug 14, 2012, at 12:09 AM, Vincent Habchi wrote: > Using part of pointer to do something else than record an address is > perilous. NSNumber does exactly that on 10.7 and higher. Tagged pointers are a well-understood technique. You just have to be careful not to dereference them directly.

Re: Classes incompatible with weak references

2012-08-15 Thread Charles Srstka
On Aug 14, 2012, at 2:09 AM, Vincent Habchi wrote: > Le 13 août 2012, à 23:47, Mike Abdullah scripsit: > >> An idea I've vaguely wondered about would be turning the isa variable into a >> tagged pointer. If you know nothing is accessing it directly (to do so was >> deprecated with the modern

Re: Classes incompatible with weak references

2012-08-15 Thread Britt Durbrow
That exists already in Lion with NSNumber objects: some types of pointers to NSNumbers actually use the low bits of the pointer to indicate the type and the rest of the pointer to pack the value; resulting in not needing to actually allocate an object off the heap (which is why direct isa access

Re: Classes incompatible with weak references

2012-08-16 Thread Jean-Daniel Dupas
Le 14 août 2012 à 09:09, Vincent Habchi a écrit : > Le 13 août 2012, à 23:47, Mike Abdullah scripsit: > >> An idea I've vaguely wondered about would be turning the isa variable into a >> tagged pointer. If you know nothing is accessing it directly (to do so was >> deprecated with the modern

Re: Classes incompatible with weak references

2012-08-16 Thread Vincent Habchi
On 16 août 2012, at 03:11, Britt Durbrow wrote: > objects must be 16-byte aligned - and that alignment requirement isn't likely > to go down, but rather up in the future; using the low bits doesn't really > cause the same issue that using the high bits did. Well, I partly disagree. There is n

Re: Classes incompatible with weak references

2012-08-16 Thread Britt Durbrow
On Aug 16, 2012, at 4:37 AM, Vincent Habchi wrote: > On 16 août 2012, at 03:11, Britt Durbrow > wrote: > >> objects must be 16-byte aligned - and that alignment requirement isn't >> likely to go down, but rather up in the future; using the low bits doesn't >> really cause the same issue that