[e-lang] Adding data to auditor approvals

Kevin Reid kpreid at mac.com
Tue Mar 4 19:38:29 EST 2008


It is possible for an auditor to tag an object with arbitrary data,  
by encoding it in a pattern of approvals by additional auditors (see  
code below).

Since this is possible, and could be useful, should we extend the  
auditing protocol to allow it to be done in a straightforward way?

For example, changing the return value of Auditor#audit/1 and  
__auditedBy to be 'optTag :Data' instead of 'approved :boolean'.


   def makeStamp() { return def stamp { to audit(_) { return true } } }
   def bits := accum [] for i in 0..!4 { _.with(makeStamp()) }
   def encodingAuditor {
     to audit(a :Audition) :boolean {
       def toEncode := (a.getSource().getOName() \
                         .getOptName().last() - '0') % (2**bits.size())
       for i => bit in bits {
         if ((toEncode & (1 << i)) > 0) {
           a.ask(bit)
         }
       }
       return true
     }
     to retrieve(specimen :any) :int {
       var result := 0
       for i => bit in bits {
         if (__auditedBy(bit, specimen)) {
           result |= (1 << i)
         }
       }
       return result
     }
   }

   ? def x7 implements encodingAuditor {}
   # value: <x7>

   ? encodingAuditor.retrieve(x7)
   # value: 7

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list