Well, I wouldn't do this. My reason is because it introduces something
"unpredictable" when it comes time to shutdown your app. Unless you
have a reference to them, they could "fire" at the time when you're
trying to shutdown your app. This means that unless they're totally
self-contained, and un-reliant on any other objects that might need to
remain, it could cause some nasty NilObjectExceptions upon shutting
down. Of course you could manage this some, but it might cause some
fairly unreproducible glitches.
Or perhaps it is really late and I am missing something. But I don't
think I'd do it that way.
- Ryan Dary
Eric Williams wrote:
> Hello list -
>
> I have a situation which, oddly enough, seems to call for a circular
> reference, and I wanted some feedback on whether it's a good idea or
> not.
>
> The app needs to send it self a slightly delayed message - say, after
> a few seconds. I'm planning to deploy a Timer that calls back to an
> object's HandleTimedAction method. It's possible that several of
> these little timers could be necessary at once, and I don't want to
> keep track of them if I don't have to.
>
> Can I set up the timer with a property "myself as Timer" to make sure
> it doesn't go out of scope? Then, in the Timer's Action event, I can
> set the myself property to nil and it should just evaporate after the
> event ends (because no other object will hold a reference to it).
>
> Does anybody see any problem with this approach? Incidentally, I'm
> considering the circular reference setup to avoid a potential stack
> overflow. :)
>
> Eric Williams
> Oxalyn Software
> http://software.oxalyn.com/
>
> AE Monitor
> http://software.oxalyn.com/AEMonitor/
>
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|