A stab at the sealer in E
Ka-Ping Yee
ping@lfw.org
Wed, 3 Nov 1999 14:04:45 -0800 (PST)
On Wed, 3 Nov 1999, Marc Stiegler wrote:
>
> ? def sealSystemMaker new() : any {
> > def privateCurrentContent := null
> > def sysUnsealer unseal(box) : any {
> > privateCurrentContent := null
> > box offerContent
> > def content := privateCurrentContent
> > privateCurrentContent := null
> > content
> > }
> > def boxMaker new(message) : any {
> > def box {
> > to offerContent {
> > privateCurrentContent := message
> > }
> > }
> > }
> > def sysSealer seal(message) : any {boxMaker new(message)}
> > [sysSealer,sysUnsealer]
> > }
Very interesting! I would have avoided doing something like
this for fear of a race condition when attempting to unseal
two different envelopes made by the same sealer -- but
with E's event model i guess this isn't a problem, is it?
This makes it a good example for your class. :)
I suppose you could call mine the "coat-check model" (you
get a unique token) in contrast to this "locked-box model"
(the unsealer has special access to get the content out of
the envelope). I believe you are correct about the garbage
collection -- when you run a coat check, there's always
the problem of not knowing when people will come back to
get their coats. So i think yours is the best solution.
This is eerily reminiscent of the alternative to EQ that
Dean proposed...
-- ?!ng
"The biggest cause of trouble in the world today is that the stupid people
are so sure about things and the intelligent folk are so full of doubts."
-- Bertrand Russell