[Xotcl] Annoucing new init+destroy scheme

Uwe Zdun uwe.zdun at uni-essen.de
Wed Feb 7 17:25:03 CET 2001


Dear XOTcl Community,

Annoucing new init+destroy scheme: Due to constant questions and problems
regarding object destroy + creation + recreate, we have decided to provide
a new destroy scheme in XOTcl 0.84. It will have only slight observable
differences to the current destroy scheme, but is more flexible and
allows for recreation.

I'll explain how it is currently implemented:

"create" and "alloc" are both now Class instprocs handling creation for their
instances. I.e.
  [self] alloc 
is wrong ... correct is now:
  <className> alloc [self]

There is a new method "instdestroy" on Class that handles physical destruction
of an object. The method "destroy" on Object has now the behavior:

  Object instproc destroy args {
    [[self] info class] instdestroy [self]
  }

Everything is written in C ... I'll use XOTcl code just for explanation...

"create" now distinguishes between:

1) creating a new object:
  calls alloc + <doInitializations>
   
2) recreating an existing object
  calls:
    [self] class <givenClass>
    [self] cleanup            ;# resets <self> into a state 
                                 as after original <init>
    <givenClass> recreate [self]


"recreate" is a new method that can be customized. Its default behaviour
is:
    <doInitializations>

<doInitializations>  is called in C and is the same for recreate and (1):
  - search for parameter default values
  - call "-" initialization methods
  - call "init"

each of those will have a method call that can be changed, intercepted, etc. 
Of course, you can also overload or intercept cleanup, recreate, instdestroy, 
etc.
  
Comments?

Greetings, Uwe


-- 
Uwe Zdun
Specification of Software Systems, University of Essen
Phone: +49 201 81 00 332, Fax: +49 201 81 00 398
zdun at xotcl.org, uwe.zdun at uni-essen.de




More information about the Xotcl mailing list