bear with me. this is all black magic to me (i understand the theory, but my practice is very very shaky). i am working with the addon "Aloft" (nameplate mod, heavily modularized), pulled off WoWAce.
the addon otherwise seems to "work", but in trying to figure out some flow of control, i added some tracing to a module, and things ran amok. i have simplified the code a few lines at a time, until it equates to the example below, and the problem persists.
so, the module is declared fairly simply:
local AloftModule = Aloft:NewModule("AloftModule", "AceEvent-2.0", "AceHook-2.1")
there is a hook function basically like this:
it is being hooked (in the module, during module initialization) as follows:
my results (to ChatFrame7) consist of what appears to be an infinite loop:
i have done a "tostring(frame)" in these diagnostics, and the same pointer value (i.e. the same frame) is involved throughout. i have also commented out the invocation to "self.hooks[this]["OnUpdate"](this)". this being Aloft, the frame involved is a nameplate frame (specifically, the underlying nameplate frame supplied by the WoW client... this is in the process of trying to plug Aloft into these underlying nameplate frames).
it really looks like a single call to AceHook-2.1:HookScript() churns forever.
i hope i am missing something that is obvious to others, and that this has a simple resolution (whether i understand it or not :-)).
OnUpdate is actually being called on _every_ frame the game renders, so you get the message all the time. If it was a real infinite loop, the UI would lock up, and the game would crash after a while
i am watching a particular frame, and dumping "tostring(frame)" into the output, the pointer value never changes. so, this is presumably the OnUpdate event stream for a single specific frame.
however, the events (for that specific frame) are arriving at a suspiciously regular rate (right at 30 per second). i also did a debugstack() call as part of my output, and the call stack is rooted at the OnUpdate handler function and never changes, so you are absolutely correct, its not tail recursion.
i suspect this is just my ignorance. the frames i am watching are Blizzard's nameplate frames (which Aloft plugs all of its functionality into). 30 "updates" a second is probably not out of line. i am very new to all of this, and simply have no idea what to expect.
i probably just need to throttle this, rather than calling Frame:SetAlpha() 30 times a second (and all the other crap that is being done).
however, if 30 times a second is actually not "sane", or if there would be a more reasonable GUI-ish event to trigger off of, it would be a good thing to know...