[Seaside] Re: Why isn't this a weak dictionary of some ilk?

Lukas Renggli renggli at gmail.com
Thu Apr 23 07:51:03 UTC 2009

> The reasoning makes sense to me. I have one question though: Do you actually
> require finalization or is this "just" for caching?

Let me explain what WeakDictionary was exactly used for:

* Seaside 2.0 -- 2.7

To backtrack (with the back and forward buttons of the web browser) a
model object, that object had to be registered in a session global
registry. This registry would create a snapshot of all registered
objects per request. It did so by adding all registered objects to a
WeakIdentityKeyDictionary using the original object as key and the
object copy as value. After a configurable number of requests old
snapshots would be thrown away. Some of the registered objects that
were carried on from request to request but not referenced from the
application code would then automatically disappear from these
snapshots. No finalization of the objects themselves is required.

* Seaside 2.8 --

In todays versions of Seaside backtracked model objects have to be
declared. For every request Seaside collects all the backtracked
objects and creates a snapshot object without weak data structures.
This is memory efficient and works well in most cases, however in some
rare situations it can give unexpected results as objects are only
backtracked as long as they are declared as backtracked.


Lukas Renggli

More information about the seaside mailing list