[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing .self() in constructor



On Wed, 29 Dec 1999, Tim Brown wrote:
> I think the only time you must use self() is if you want to make sure the
> locking mechanism is turned on and the changes get saved.   Other than that if
> the operation is read-only it sholdn't matter which one you use.  I only use
> self() if a in database call is modifying another in-database object.

The self() method was initially made to solve the problem that Tim described
above. It is the way to call a method of a higher lock level from a method of
the same (!) object that is in a lower lock level. The problem here is that
when you call "this.doSomething()" then "this" is the real reference and ozone
does not know anything about the call but it has to.

In the linked list example you probably can just use "this" because when you
give "prev/next" outside of the database object - by giving "this" as the direct
parameter of a method call - then it will *automaticly* converted to a proper
proxy object (self()). [Unfortunately this is not possible when calling
"this.doSomething()" - therefore we introduced self()]

I would really love to throw away the self() method. But then it would be up to
the programmer to keep track of the proper lock levels. (find out all transient
dependencies between update methods)


Falko
-- 
______________________________________________________________________
Falko Braeutigam                         mailto:falko@softwarebuero.de
softwarebuero m&b (SMB)                    http://www.softwarebuero.de