[E-Lang] ERTP-aware MintMaker

steve jenson stevej@sieve.net
Tue, 13 Feb 2001 15:05:03 -0800


Hello,

Yesterday and today MarkM and myself have been working on a MintMaker that
conforms to the ERTP specification. We wanted to put this on the list for
people to shoot holes in.

Please attack with vigor!

? define MintMaker(name) :any {
>     define [sealer,unsealer] := BrandMaker pair(name)
>     var delayedMint := null
>     define issuer {
>         to printOn(out) { out print(`<$name's issuer>`) }
>         to makePurse() :any {          
>            delayedMint makePurse(0)
>         }
>         to sturdyVouch(other) :any { 
>         // can't be done until persistence is added
>             throw("method sturdyVouch() not yet implemented")
>         }
>         to vouch(other) :any {
>             unsealer unseal(other.sealed)
>         }
>         to makeAssay(quantity :(any >= 0)) :any{
>             delayedMint makeAssay(quantity)
>         }
>      }
>     define mint {
>         to printOn(out) { out print(`<$name's mint>`) }
>         to makeAssay(quantity :(any >= 0)) :any { 
>             
>             define assay {
>                 to printOn(out) { out print(`<Assay: $name Quantity: $quantity>`) }
>                 to getQuantity :any { quantity }
>                 to getSealed :any { sealer seal(assay)}
>                 to compareTo(other) :any {  
>                     quantity compareTo(other.quantity)
>                 }  
>                 to transfer(var src,var dest) { 
>                     src := issuer vouch(src)
>                     dest := issuer vouch(dest)
>                     unsealer unseal(src.decr)(quantity)
>                     unsealer unseal(dest.incr)(quantity)
>                 }
>                 to getIssuer :any { issuer }
>             }     
>         }
>         to getIssuer :any { issuer }     
>         to makePurse(var quantity :(any >= 0)) :any { 
>             
>             def Decr(amount :(0..quantity)) { quantity -= amount } 
>             def Incr(amount :(any >= 0)) { quantity += amount }
>             def Purse {
>                 to printOn(out) { out print(`Purse Quantity: $quantity`) }
>                 to getPurseValue :any { quantity }
>                 to getSealed :any { sealer seal(Purse)}
>                 to getIssuer :any { issuer }
>                 to getAssay :any { mint makeAssay(quantity) }
>                 to depositAll(src) :any { 
>                     def assay := issuer vouch(src.assay)
>                     assay transfer(src,Purse)
>                     assay
>                 }
>                 to getIncr :any { sealer seal(Incr) }
>                 to getDecr :any { sealer seal(Decr) }
>            }
>         }
>      }
>     delayedMint := mint
>  }


ciao,
steve

--
steve jenson
PGP key available upon request