org.erights.e.elib.tables
Interface Selfless

All Superinterfaces:
Marker
All Known Subinterfaces:
DeepPassByCopy
All Known Implementing Classes:
AstroTag, ConstList, ConstMap, ConstSet, Deflector, NetConfig, Node, ObjectID, QAstroArg, QuasiContent, SourceSpan, Term, Twine

public interface Selfless
extends Marker

Untamed: Selfless objects have no eq-identity -- only value-based identity. There are two varieties of Selfless objects: 1) Transparent Selfless objects are those implement the interface 'Selfless'. 2) Honorary Selfless object are instances of the classes listed in the list of honorary classes below (and therefore instances of any subclasses of those classes). In addition, null and all arrays are honorary Selfless objects.

Transparent Selfless objects are tested and hashed for sameness based only on their getSpreadUncall(). Two transparent Selfless object are the same exactly when their getSpreadUncall()s are the same. Two honorary Selfless objects are tested and hashed for sameness based on their Java .equals() and .hashCode() methods, which is trusted to be commutative. By contrast, selfish objects are tested and hashed for sameness using Java's EQ (Java's "==") and System.identityHashCode(). See Equalizer.same() for the authoritative sameness semantics.

Selfless object tend to be PassByConstruction, but this is not mandated. For example, Equalizer instances are Selfless but not PassByConstruction.

Arrays and null are also effectively Selfless objects, even though they can't be listed by honorary class below. Honorary selfless objects tend to be transparent, but SturdyRef and Equalizer are not.

PassByProxy objects (actual or HONORARY) may not be Selfless (actual or HONORARY). XXX Must find a way to enforce this.

Author:
Mark S. Miller
See Also:
org.erights.e.elib.ref.Ref#isSameEver, net.captp.jcomm.SturdyRef

Field Summary
static ConstSubclassSet HONORARY
          Enabled: HONORARY (effectively) contains all the classes named in HONORED_NAMES and all their subclasses.
static String[] HONORED_NAMES
          Enabled: List of Java library classes that are compared using equals() and hashCode().
 
Method Summary
 Object[] getSpreadUncall()
          Enabled: Two Selfless objects are the same iff their getSpreadUncall()s are the same.
 

Field Detail

HONORED_NAMES

public static final String[] HONORED_NAMES
Enabled: List of Java library classes that are compared using equals() and hashCode().

This is because, since they are JavaSoft's, we obviously can't go back and modify them to implement the Selfless interface, but we also obviously want people to be able to use them as if we had.


HONORARY

public static final ConstSubclassSet HONORARY
Enabled: HONORARY (effectively) contains all the classes named in HONORED_NAMES and all their subclasses.

Method Detail

getSpreadUncall

public Object[] getSpreadUncall()
Enabled: Two Selfless objects are the same iff their getSpreadUncall()s are the same.

To make this work, we need an adequately strong convention as to what should be placed in this array. The convention is an element array describing the canonical expression for recreating the object. The elements are recipient, verb, and then the args. The described invocation

    recipient.verb(args...)
should create an object identical to this one. This should avoid collisions, since an object that isn't the same as this one could not correctly choose the same expression. Since the TCB depends on the correctness of getSpreadUncall(), all the implementors are considered in the TCB.



comments?