Restrict reference passing and specify operations that can be performed on references. Confine an object inside a data structure Prevent representation exposure Statically enforced At compile-time
content TOO RESTRICTIVE! content iterator Iterator Cannot be used by the outside size iterator Iterator Cannot access internal representation Possibilty 1 Possibilty 2
to specify which action a remote object can execute on an object Ability to specify how many remote references can point to an object Annotate or tag values to achieve desirable behaviour Inwards Cardinality 0 = LOCAL OBJECT Make an object to be treaten immutable Limit the number of remote references
N. @cardinality: N N At each point in time, only N references can be used def futRef := waitFor: uniqueRef; when: futRef becomes: { |ref| // DO COMPUTATION // ref<-release() } Install listener to wait for reference to be obtained Regular future object Release reference so that it can be obtained by other actor Cardinality
the outside @readOnly Only read operations are allowed def profile := object: { def getName(){...}; def setName(n)@mutator{...}; } taggedAs: [readOnly] Annotate mutator method to indicate that it changes the object state Can only be executed locally
remote references to N. @cardinality: N N Organize remote references through various kind of ownership annotations. 2 dimensions Inwards Cardinality Type Of Access State of the object cannot be modified by the outside @readOnly Local objects cannot be remotely accessed Only 1 external reference is allowed at a time