Theocacao
Leopard
Design Element
Comment on "Lazy Loading of KVO Observed Properties"
by Jonathan — Jun 19
Personally I would not notify observers about lazy loading (since the whole purpose of having accessor methods is to allow you to do stuff under the hood without the user knowing). I have run into the nil problem before, and I hacked around it by converting to an (the, actually) NSNull internally. It's a far from perfect solution, but I thought I might as well throw it out seeing as there are some others of questionable elegance floating around. ;)

Keep in mind that with alignment a BOOL sandwiched between two words takes up a word of space, and space is at a premium with RAM being so (relatively) slow compared to cache. Group BOOLs in groups of 4 or 8 to get around that.

It would also be interesting to make a BlackHole class that tried to emulate the behavior of messaging to nil... though by virtue of not being standard it would be strictly limited to internal implementations and might not help that much, and NSInvocation generation is painfully slow in the present implementation.
Back to "Lazy Loading of KVO Observed Properties"
Design Element

Copyright © Scott Stevenson 2004-2015