FROM : Scott Stevenson
DATE : Fri Apr 29 22:29:46 2005
On Apr 29, 2005, at 1:22 PM, John Brownlow wrote:
> Yeah, I've made pretty much everything in my app a custom subclass
> just so I can use proper accessors instead of the error prone
> -valueForKey.
Seems fine to me. :)
> How about over-riding -dealloc like this, in appropriate subclasses?
>
> - (void) dealloc
> {
> // regular dealloc stuff
>
> [[self managedObjectContext] deleteObject: self];
> }
>
> It seems like it would work and is reasonably elegant, but it seems a
> bit too obvious to be valid code! :)
This won't work because your object could be dealloc'd for a number of
different reasons. In fact, this would probably cause an infinite loop
or crash of some sort. For that matter, I don't think you're supposed
to override the stock -dealloc implementation.
- Scott
--
http://treehouseideas.com/
http://theocacao.com/ [blog]
DATE : Fri Apr 29 22:29:46 2005
On Apr 29, 2005, at 1:22 PM, John Brownlow wrote:
> Yeah, I've made pretty much everything in my app a custom subclass
> just so I can use proper accessors instead of the error prone
> -valueForKey.
Seems fine to me. :)
> How about over-riding -dealloc like this, in appropriate subclasses?
>
> - (void) dealloc
> {
> // regular dealloc stuff
>
> [[self managedObjectContext] deleteObject: self];
> }
>
> It seems like it would work and is reasonably elegant, but it seems a
> bit too obvious to be valid code! :)
This won't work because your object could be dealloc'd for a number of
different reasons. In fact, this would probably cause an infinite loop
or crash of some sort. For that matter, I don't think you're supposed
to override the stock -dealloc implementation.
- Scott
--
http://treehouseideas.com/
http://theocacao.com/ [blog]
| Related mails | Author | Date |
|---|---|---|
| John Brownlow | Apr 29, 20:53 | |
| Scott Stevenson | Apr 29, 21:07 | |
| John Brownlow | Apr 29, 21:49 | |
| Scott Stevenson | Apr 29, 22:03 | |
| John Brownlow | Apr 29, 22:22 | |
| Scott Stevenson | Apr 29, 22:29 | |
| Bill Bumgarner | Apr 29, 23:46 | |
| Johnny Deadman | Apr 30, 02:02 | |
| Scott Stevenson | Apr 30, 02:09 | |
| mmalcolm crawford | Apr 30, 02:10 | |
| Johnny Deadman | Apr 30, 02:16 | |
| Shawn Erickson | Apr 30, 02:21 | |
| mmalcolm crawford | Apr 30, 02:23 | |
| Shawn Erickson | Apr 30, 02:32 |






Cocoa mail archive

