Slot

From Erights

(Difference between revisions)
Jump to: navigation, search
(use instance msgdoc template)
(Notable implementations: add CoercedSlot)
 
(5 intermediate revisions not shown)
Line 8: Line 8:
* [[SimpleSlot]]
* [[SimpleSlot]]
* [[GuardedSlot]]
* [[GuardedSlot]]
 +
* [[CoercedSlot]]
* [[LamportSlot]]
* [[LamportSlot]]
Line 13: Line 14:
{{instance msgdoc|get|0||[[any]]}}
{{instance msgdoc|get|0||[[any]]}}
 +
Returns the current value of this slot.
Returns the current value of this slot.
{{instance msgdoc|put|1|<var>newValue</var> :[[any]]|[[void]]}}
{{instance msgdoc|put|1|<var>newValue</var> :[[any]]|[[void]]}}
 +
Sets the current value to the (possibly coerced) provided value, if appropriate for this type of slot; [[throw]]s if not allowed.
Sets the current value to the (possibly coerced) provided value, if appropriate for this type of slot; [[throw]]s if not allowed.
{{instance msgdoc|isFinal|0||[[boolean]]}}
{{instance msgdoc|isFinal|0||[[boolean]]}}
 +
Says whether the Slot acts like a [[FinalSlot]] -- successive <code>[[#get/0|get]]()</code>s on the same slot will always give the same value.
Says whether the Slot acts like a [[FinalSlot]] -- successive <code>[[#get/0|get]]()</code>s on the same slot will always give the same value.
Line 24: Line 28:
{{instance msgdoc|readOnly|0||[[Slot]]}}
{{instance msgdoc|readOnly|0||[[Slot]]}}
 +
Returns a facet allowing get/0 but not put/1.
Returns a facet allowing get/0 but not put/1.
[[Category:Protocols]]
[[Category:Protocols]]
 +
[[Category:ELib specification]]

Latest revision as of 05:00, 8 November 2008

A Slot is an object which provides the behavior of the binding of a noun. "&" in the E language allows working with slots.

A slot can also be considered a zero-dimensional collection, i.e. one which has exactly one element.

Contents

Notable implementations

Protocol

get/0

Signature: get() :any

Returns the current value of this slot.

put/1

Signature: put(newValue :any) :void

Sets the current value to the (possibly coerced) provided value, if appropriate for this type of slot; throws if not allowed.

isFinal/0

Signature: isFinal() :boolean

Says whether the Slot acts like a FinalSlot -- successive get()s on the same slot will always give the same value.

Note that final implies read-only, but read-only does not imply final.

readOnly/0

Signature: readOnly() :Slot

Returns a facet allowing get/0 but not put/1.

Personal tools
more tools