Auditor tagging
From Erights
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, it should be made possible to do so without inefficient gimmicks.
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
Proposals
- Change the return value of Auditor#audit/1 and __auditedBy to be 'optTag :Data' instead of 'approved :boolean'. [1] --Kevin Reid 10:10, 9 March 2008 (CDT)
- Distinguishing between null and other Data is a bit unclean, since null is also valid Data. Instead, how about if the annotation is either null or a FinalSlot containing Data. --markm 22:40, 13 March 2008 (CDT)