[e-lang] Announcing E 0.8.30d

Mark Miller markm at caplet.com
Wed Aug 18 21:40:41 EDT 2004


At 11:03 AM 8/16/2004  Monday, marcs wrote:
>Since I haven't explictly stated my opinion about foo::blah and foo.blah
>yet, let me just go ahead and state it even though people probably know what
>I'm going to say.
>
>Before I return to my harpie role, let me just admit that I think the
>currying is really clever. A couple questions: What would "interp.exitAtTop"
>look like in a debugger? Does it present any interesting persistence
>problems? 
[...]
>Trying to invent a purpose for every piece of punctuation on the keyboard is
>a game for languages working on Version 3, with a couple million programmers
>who already have the sunk cost of having learned everything else already.

Sure -- that's what these pragma switches are for -- to reserve productions 
in the grammar, so we don't paint ourselves into a corner, so that we *can* 
turn such things on in a Version 3 or whatever, and so we can play with them 
prior to making any such decision.

So just in case anyone's confused: Neither the verb-curry nor the new 
dot-props features are an official part of E, just as the old dot-props that 
these replace was not. Any E program that uses these pragma switches to turn 
on these features and uses them is not considered a valid E program.


>Compare it with the really new stuff for Voluntary Oblivious Compliance (about which
>I will write more here in a week or two). 

Here's a draft of a possible implementation. Add it as 
src/esrc/org/erights/e/elib/sealing/makeVOCPair.emaker, and it should work 
as shown by the updoc session at the bottom. You may wish to start your 
explanation with this.

The notion of Voluntary Oblivious Compliance comes from Alan Karp et al's 
"Client Utility" (aka E-Speak beta 2.2), whose abstractions inspired those 
presented below.

The rights amplification technique used here is an adaptation of a technique 
invented by MarcS (see the similar
src/esrc/org/erights/e/elib/sealing/makeBrand.emaker )

-------------------------------------------
#!/usr/bin/env rune

# Copyright 2004 Hewlett Packard, Inc. under the terms of the MIT X license
# found at http://www.opensource.org/licenses/mit-license.html ................

def makeVOCPair(brandName :String) :near {

    var myTempContents := def none {}

    def brand {
        to __printOn(out :TextWriter) :void {
            out.print(brandName)
        }
    }

    def ProveAuth {
        to __printOn(out :TextWriter) :void {
            out.print(`<$brandName prover>`)
        }
        to getBrand() :near { return brand }
        to coerce(specimen, optEjector) :near {
            def sealedBox {
                to getBrand() :near { return brand }
                to offerContent() :void {
                    myTempContents := specimen
                }
            }
            return sealedBox
        }
    }
    def CheckAuth {
        to __printOn(out :TextWriter) :void {
            out.print(`<$brandName checker template>`)
        }
        to getBrand() :near { return brand }
        match [`get`, authList :any[]] {
            def checker {
                to __printOn(out :TextWriter) :void {
                    out.print(`<$brandName checker>`)
                }
                to getBrand() :near { return brand }
                to coerce(specimenBox, optEjector) :any {
                    myTempContents := null
                    if (specimenBox.__respondsTo("offerContent", 0)) {
                        # XXX Using __respondsTo/2 here is a kludge
                        specimenBox.offerContent()
                    } else {
                        myTempContents := specimenBox
                    }
                    for auth in authList {
                        if (auth == myTempContents) {
                            return auth
                        }
                    }
                    myTempContents := none
                    throw.eject(optEjector,
                                `Unmatched $brandName authorization`)
                }
            }
        }
        match [`__respondsTo`, [`get`, _]] {
            true
        }
        match [`__respondsTo`, [_, _]] {
            false
        }
        match [`__getAllegedType`, []] {
            null.__getAllegedType()
        }
    }
    return [ProveAuth, CheckAuth]
}


    ? def [ProveAuth, CheckAuth] := <elib:sealing.makeVOCPair>("voc")
    # value: [<voc prover>, <voc checker template>]

    ? def f1 := <file:~/.bashrc>
    # value: <file:c:/Documents and Settings/MILLERM1/.bashrc>

    ? def f2 := <file:~/Desktop>
    # value: <file:c:/Documents and Settings/MILLERM1/Desktop/>

    ? def foo(f :CheckAuth[f1,f2]) :void {
    >     println(f.getPath())
    > }
    # value: <foo>

    ? foo(f1)
    # stdout: c:/Documents and Settings/MILLERM1/.bashrc

    ? def f3 := <file:~>
    # value: <file:c:/Documents and Settings/MILLERM1/>

    ? foo(f3)
    # problem: Unmatched voc authorization

    ? foo(f1 :ProveAuth)
    # stdout: c:/Documents and Settings/MILLERM1/.bashrc

    ? foo(f3 :ProveAuth)
    # problem: Unmatched voc authorization

    ? def bar(f) :void {
    >     println(f.getPath())
    > }
    # value: <bar>

    ? bar(f1)
    # stdout: c:/Documents and Settings/MILLERM1/.bashrc
    
    ? bar(f1 :ProveAuth)
    # problem: <NoSuchMethodException: <a sealedBox>.getPath/0>
------------------------------------------




-- 
Text by me above is hereby placed in the public domain

        Cheers,
        --MarkM




More information about the e-lang mailing list