At 01:13 AM 3/27/2001 -0600, Ian Bicking wrote:
>Chuck Esterbrook <echuck@...> wrote:
> > DELETE AN OBJECT
> > In Python, you will do this to delete an object:
> > store.deleteObject(foo)
> > This complements the addition of an object to the store:
> > store.addObject(foo)
> > A convenience delete() method could be added to MiddleObject whose
> > implementation would essentially be self.store().delete(self). This
> allows for:
> > foo.delete()
>I don't particularly like this style (foo.delete()). Removing an
>object is the domain of the store, not of the object itself. I
>haven't looked at MiddleKit yet, so I don't know the particulars of
>what the object knows, but this definately can't extend everywhere.
>You can't tell a number to delete itself, and if an object is
>contained in multiple places, it is unclear which container it will be
>Also, the semantics of store.delete(obj) and obj.delete() are very
>different, and shouldn't have the same name.
Actually they would be the same:
As you can see "obj.delete()" is just a convenience method.
>Finally, I think garbage collection is a good thing -- only the
>garbage collector should destroy objects, because only the garbage
>collector knows when no one really cares about an object. If you
>should worry that an object has been deleted, you should test
>obj.store(). If you don't want to hold onto deleted objects, you
>should use a weak reference (though, unfortunately, you can only do
>that with Python 2.1). And if you *do* want to keep a deleted object,
>that should be possible. And if all these things are possible, then
>foo.delete() doesn't imply that. (remove might be a better term...?
>Remove is the opposite of add, delete is the opposite of create)
>Anyway, that's my opinion.
I see your point to an extent, but there are serious complications with
using a MiddleObject after you have removed it from the store. For example,
if you change the object, it will notify the store that has been modified.
The store will be confused because the object does not even exist.
I'll contemplate how hard it would be to disassociate the middle object
from the store. If it's reasonably feasible, then I can make the delete