Adding data to auditor approvals

Kevin Reid <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
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/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.