[E-Lang] MintMaker failing in E 0.8.9

hal@finney.org hal@finney.org
Mon, 5 Feb 2001 15:20:57 -0800


I downloaded the Linux binary for E 0.8.9, but the MintMaker example from
http://www.erights.org/elib/capability/ode/ode-capabilities.html#simple-money
is not working for me.  I get the output below.  Looks like maybe
a problem with the guard on the balance parameter to makePurse?
Apologies if this is a known bug.

(The reason for the string of "> > > ..." is because I cut and pasted
the MintMaker code from the web page into the E window.)

Hal

===


? define BrandMaker := <import:org.erights.e.elang.sealing.Brand>
# value: <import:org.erights.e.elang.sealing.Brand>

? define MintMaker(name) :any {
                    define [sealer, unsealer] := BrandMaker pair(name)
                    define mint {
                        to printOn(out) { out print(`<$name's mint>`) }

                        to makePurse(balance : (any >= 0)) :any {
                            define decr(amount : (0..balance)) {
                                balance -= amount
                            }
                            define purse {
                                to printOn(out)    { out print(`<has $balance $name bucks>`) }
                                to getBalance :any { balance }
                                to sprout     :any { mint makePurse(0) }
                                to getDecr    :any { sealer seal(decr) }

                                to deposit(amount : integer, src) {
                                    unsealer unseal(src getDecr)(amount)
                                    balance += amount
                                }
                            }
                        }
                    }
                }> > > > > > > > > > > > > > > > > > > > > > 
# value: <MintMaker>

? define mint := MintMaker("Hal")
# value: <Hal's mint>

? define purse1 := mint makePurse(100)
# problem: <NoSuchMethodException: <class org.erights.e.elib.prim.EStaticWrapper:<import:org.erights.e.elib.slot.SimpleSlot>> compareTo/1>
#          
#   <import:org.erights.e.elib.slot.SimpleSlot> compareTo(0)
#   <Hal's mint> makePurse(100)
#   <interp> evalPrint(e`define purse1 := mint makePurse(100)`)