Comments on FC00 paper

Marc Stiegler
Tue, 2 Nov 1999 15:27:49 -0700

I have this suspicion this is a trick question. But here is a quicky
implementation, attached at the bottom.

I note that though it is easy to build such a thing, in E it seems unuseful.
In E, handing someone the sealedBox transfers, as nearly as I can tell, the
same set of capabilities that just handing someone the object inside the box
transfers. A slightly fancier version of this would allow you to be informed
when someone breaks the seal, which is a new functionality, and might be
useful in some kinds of contracting relationships ("you only have to pay me
if you actually use it" arrangements). Hmmmm...could this be the basis for
an arrangement in which you offer a single resource for sale in several
different markets, and when one agent actually uses (sells) the resource,
all your other agents in the other markets are informed and know not to sell
it any more?


----- Original Message -----
> How would you implement them [sealers and unsealers] in E?


? // Sealed Box Maker, with sealer and unsealer
? // This minimal version holds one item in the box,
? // and that item is whichever item was put in most recently,
? // it can only be retrieved once (to prevent forwarding of
? // a modified version of the item if the item is mutable);
? // once the seal is broken, the box is empty
? def sealedBoxMaker new() : any {
>     def boxContent := null
>     def sealer seal(message) {boxContent := message}
>     def unsealer unseal() : any {
>         def unsealedContent := boxContent
>         boxContent := null
>         unsealedContent
>     }
>     def sealedBox {
>         to getSealer : any {sealer}
>         to getUnsealer : any {unsealer}
>     }
> }
# value: <sealedBoxMaker>

? def sealedBox1 := sealedBoxMaker new()
# value: <sealedBox>

? def sealerForBox1 := sealedBox1 getSealer
# value: <sealer>

?  def unsealerForBox1 := sealedBox1 getUnsealer
# value: <unsealer>

?  sealerForBox1 seal("Here is a sealed message")
?  def unsealedMessage := unsealerForBox1 unseal
# value: Here is a sealed message