Package net.hydromatic.morel.eval
Interface EvalEnv
-
- All Known Subinterfaces:
MutableEvalEnv
- All Known Implementing Classes:
EvalEnvs.ArraySubEvalEnv,EvalEnvs.MapEvalEnv,EvalEnvs.MutableArraySubEvalEnv,EvalEnvs.MutablePatSubEvalEnv,EvalEnvs.MutableSubEvalEnv,EvalEnvs.PatSubEvalEnv,EvalEnvs.SubEvalEnv
public interface EvalEnvEvaluation environment.Whereas
Environmentcontains both types and values, because it is used for validation/compilation, EvalEnv contains only values.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default EvalEnvbind(String name, Object value)Creates an environment that has the same content as this one, plus the binding (name, value).default MutableEvalEnvbindMutable(String name)Creates an evaluation environment that has the same content as this one, plus a mutable slot.default MutableEvalEnvbindMutableArray(List<String> names)Creates an evaluation environment that has the same content as this one, plus a mutable slot or slots.default MutableEvalEnvbindMutablePat(Core.Pat pat)Creates an evaluation environment that has the same content as this one, plus mutable slots for each name in a pattern.default EvalEnvfix()Converts this environment to a non-mutable environment.ObjectgetOpt(String name)Returns the binding ofnameif bound, null if not.default Map<String,Object>valueMap()Returns a map of the values and bindings.voidvisit(BiConsumer<String,Object> consumer)Visits every variable binding in this environment.
-
-
-
Field Detail
-
SESSION
static final String SESSION
The name of the variable that contains theSession.- See Also:
- Constant Field Values
-
-
Method Detail
-
bind
default EvalEnv bind(String name, Object value)
Creates an environment that has the same content as this one, plus the binding (name, value).
-
bindMutable
default MutableEvalEnv bindMutable(String name)
Creates an evaluation environment that has the same content as this one, plus a mutable slot.
-
bindMutablePat
default MutableEvalEnv bindMutablePat(Core.Pat pat)
Creates an evaluation environment that has the same content as this one, plus mutable slots for each name in a pattern.
-
bindMutableArray
default MutableEvalEnv bindMutableArray(List<String> names)
Creates an evaluation environment that has the same content as this one, plus a mutable slot or slots.If
nameshas one element, callingMutableEvalEnv.set(Object)will populate the slot will be filled by an object; ifnameshas more than one element,setwill expect to be given an array with the same number of elements.
-
visit
void visit(BiConsumer<String,Object> consumer)
Visits every variable binding in this environment.Bindings that are obscured by more recent bindings of the same name are visited, but after the more obscuring bindings.
-
fix
default EvalEnv fix()
Converts this environment to a non-mutable environment.
-
-