Request:Remove method in type Object to be derived

BlitzMax Forums/BlitzMax Programming/Request:Remove method in type Object to be derived

Fabian.(Posted 2006) [#1]
Look at the following list of methods:
brl.audio.TChannel.Stop
brl.gnet.TGNetObject.Close
brl.gnet.TGNetHost.Close
brl.gnet.TGNetPeer.Close
brl.graphics.TGraphics.Close
brl.linkedlist.TLink.Remove
brl.linkedlist.TList.Clear
brl.map.TNode.Clear
brl.map.TMap.Clear
brl.maxgui.TGadget.Free
brl.socket.TSocket.Close
brl.stream.TIO.Close
brl.timer.TTimer.Stop
pub.freeprocess.TProcess.Close
Though they're doing different things (close system handle, remove cyclic links...) it's almost the same: You should call these methods if you don't work with these objects any more.
So it would be an idea to have a Remove method in the Object class, which could be overridden by user defined types. The default implementation would be just to do nothing. But for the classes I posted above it could call these methods I listed. So instead of "FreeGadget gadget" you could write "gadget.Remove", instead of "CloseStream stream" you could write "stream.Remove"...
The advantage of this feature is that you now can close system handles associated with an object/remove cyclic references without knowing the object's type.

It's not the most important thing, but it would be nice to have it.