*MaxGUI is a good example. Just forget freegadget once on a button that gets reassigned a new button and you will see why this stuff definitely is outdated way of programming - because you will see a button that does not react to your clicks*
Haha!
Wait a moment. MARK designed MaxGUI.
If ANYONE should know the ins and outs of Max, it's HIM.
So if MARK is stuck using FreeGadget that either says to me that OOP is flawed or Max's implementation of OOP is flawed. And why would Max's implementation of OOP be flawed in some findamental way that Mark is aware of because he encountered it when writing his GUI? You think he would have just made the neccessary changes to fix the problem.
That being the case, it sounds to me like your precious OOP is to blame.
Maybe the reason Mark has a FreeGadget is for the very same reason I have to have a Free function in my Sprite system:
Type Sprite
Global List:TList
Field Link
Function Create()
Local TS:Sprite
TS = New Sprite
' Store link pointer into list so we don't have to loop through 5000 sprites every time we want to free one.
Link = List.AddLast(TS)
End Function
Method Free()
Local LoopSprite:Sprite
' Stop all animation of this sprite.
StopAnimating()
' Stop animation of and free all children of this sprite. (Recursive)
' (I got lazy here. I should have kept a list of all children of a sprite with the sprite itself.)
For LoopSprite = EachIn SpriteList
If LoopSprite.Parent() = Self Then LoopSprite.Free()
Next
' Detach this sprite from parent.
SetParent(Null)
' Remove sprite's link from sprite list.
RemoveLink _Link
_Link = Null
End Method
End Type
Now, as you can see there I have my sprites in an internal list. This is so they can be sorted by order, and then looped through.
If you were to just release the sprite by forgetting about it in your own code, it would not be freed, because it is still in the internal sprite list.
There is NO WAY AROUND KEEPING THESE SPRITES IN THE LIST LIKE THIS. THEY HAVE TO BE SORTED BY ORDER BEFORE BEING DRAWN.
But let's assume you have some magical OOP method to solve this particular issue, with weak pointers or something, and as soon as you forget about the sprite, the list forget the sprite existed as well.
Furthermore, even if you solve this problem, you haven't really solved the problem, unless you can also apply that solution to the animation system. Because the animation system will ALSO have a link back to the sprite.
But let's say your animation system also forgets the sprite existed. The pointer to it just goes null. Hey, that's a lot like how pointers worked in Blitz 3D! Sound like a workable solution. All I have to do is check to see if the pointer has gone null and...
Hmm.... I wonder why the behavior changed?
Well MAYBE that is because according to you, that as long as that animation system WANTS to keep animating the sprite, it should be able to. Setting that pointer to null on it suddenly is a no-no right? Or did you just mean feeeing the memory the pointer points to without altering the pointer? If that is the case and setting the pointer to null at all locations (or only specified locations) is okay, then I have to wonder why it hasn't been implemented, because Mark has done it before, and it makes your perfect OOP world with no Free() functions possible.
Of course you still have to set pointers in your code to Null when you want to stop displaying a menu that you have saved a pointer to. Unless you have some magical OOP desing paradaigm that allows to to avoid that by sticking stuff in functions just right so that the pointers lose scope automagically. But I don't have time to design crazy stuff like that which will take 10x as long to code. Would be nice if my sprite system and a lot of my other custom types that need internal lists worked that way though.
Oh and no Sprite.Free() = Sprite which does not respond to your clicks because of that list. Same as MaxGUI.