View Single Post
11-25-09, 03:54 PM   #19
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Originally Posted by Torhal View Post
I do not see any benefit in having this exist as a library - the caching code is simple and small enough to be included directly within the AddOn. Also, indiscriminately setting all scripts to nil and removing the global name can cause an assortment of issues. If you're making a named frame, or setting scripts to it, you're generally going to want to keep it around so removing either makes no sense. Also, you cannot determine the intent of such a library's users - they may want the ability to safely add and remove frames for a frame factory, but not do all of the things you are doing.

The code I pasted here is ripped from my own LibQTip library, which manages its OWN frames since it knows all the attributes which are set on them. A general-purpose library that attempts to do such a thing will ultimately fail. AddOn A does this:

Code:
frame.this_is_awesome = function(self, arg1) DoStuff() end
and then releases the frame to the general-purpose frame-recycling library. AddOn B grabs that frame from the lib's cache, does other stuff to it, and shoves it back when done. After all of this modification and passing around, the frames will end up using more memory overall than a discrete AddOn-specific cache would ever dream of, since it has absolutely no knowledge of what the AddOns that use it are doing to the frames and therefore has no way to properly clean them up.
Your right (damn, sometimes that's really hard to say you know?)
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote