Slot

From Erights

(Difference between revisions)
Jump to: navigation, search
(isFinal/0: added an hidden comment. You might want to incorporate it into the maintext))
m (Reverted edits by Zarutian (Talk); changed back to last version by Kevin Reid)
Line 25: Line 25:
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.
-
<!-- so an FinalSlot acts like an write once read many memory, no? -~~~~ -->
 
Note that final implies read-only, but read-only does not imply final.
Note that final implies read-only, but read-only does not imply final.

Revision as of 00:06, 24 March 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

get() :any

Returns the current value of this slot.

put/1

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

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

readOnly() :Slot

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

Personal tools
more tools