org.erights.e.elib.slot
Interface SlotGuard

All Known Subinterfaces:
Guard
All Known Implementing Classes:
BaseGuard, ConstList, SlotDefiner

public interface SlotGuard

Untamed: A SlotGuard creates the slot used to implement a variable, and thereby serves as the dynamic equivalent of a variable declaration.

The made Slot may constrain the values it will accept (as a type declaration would) and it may constrain how it may be mutated (eg, "final").

Author:
Mark S. Miller

Method Summary
 String getName()
          Enabled: All E guards should respond to "getName()"
 Slot makeSlot(Object specimen, OneArgFunc optEjector)
          Enabled: The specimen is the candidate initial value of the variable.
 

Method Detail

makeSlot

public Slot makeSlot(Object specimen,
                     OneArgFunc optEjector)
Enabled: The specimen is the candidate initial value of the variable. Either a coercion of specimen meets the constraints, in which case a Slot is returned with the coerced value as its initial value, or we fail (according to optEjector) with a problem explaining why not.

If optEjector is null, then throw the problem. Otherwise, call optEjector with the problem. optEjector should perform a non-local exit, and so should not return. If optEjector returns anyway, then throw the problem after all.


getName

public String getName()
Enabled: All E guards should respond to "getName()"



comments?