[TransWarp] SkinScript-to-Jars phrasebook, deleting objects, and terminology

Phillip J. Eby pje at telecommunity.com
Sun Jun 30 18:06:54 EDT 2002

At 04:10 PM 6/30/02 -0400, Phillip J. Eby wrote:

>Abstract method     ZPatterns/SkinScript Equivalent
>---------------     ---------------------------------------------------
>load()              WITH ... COMPUTE ...
>defaultState()      INITIALIZE OBJECT WITH ...
>new()               WHEN OBJECT ADDED ...
>save()              WHEN OBJECT CHANGED STORE attrs USING ...
>ghost()             no real equivalent

Actually, there *is* an equivalent to ghost().  It's the ability to set 
what class a Rack will use for its contained items.  For some reason that 
didn't come to mind right away.  One big difference is that ghost() has the 
option of dynamically deciding what class to use.

Now that I've thought of this, I've added a boilerplate definition of 
"ghost()" to AbstractJar, so that if your jar is monomorphic (i.e., only 
ever returns objects of one class), you need only supply that class in the 
'defaultClass' attribute of the jar.  The boilerplate version even handles 
the __setstate__ for preloadState().

This means that the absolute minimum you need to implement a (read-only) 
jar is to set 'defaultClass' and define 'load()'.  If you want a writeable 
jar, you have to add 'save()', with 'new()' and 'defaultState()' if you 
want to support creating new objects.  You only need to define 'ghost()' 
and 'thunk()' if you need polymorphic storage and cross-DB references, 

I think we're now at the level of having 99% of the boilerplate written for 
you (that isn't specific to a particular back-end).  :)

Given Roche's confusion over what the 'ghost()' method was for, I think I 
might change the name to '_rawInstance()' or something like that, to mean 
"return a new, possibly initialized instance for this oid and state, if 
any".  But for the moment it's still "ghost()".

More information about the PEAK mailing list