Handle delay, function, and/or command types in read
#2232
Labels
C-Moderate Effort
Should take a moderate amount of time to address.
L-Commands
Built-in commands (e.g. move, try, if, ...) in the Swarm language.
L-Parsing
Parsing the Swarm language from a string into an AST.
L-Pretty-printing
Pretty-printing ASTs or values into a string representation.
S-Nice to have
The bug fix or feature would be nice but doesn't currently have much negative impact.
Z-Feature
A new feature to be added to the game.
As implemented in #2224 , the
read
command can only handle first-order values with no captured environment, which excludes delay types, function types, and commands. In some cases, however, handling these would be straightforward, for exampleformat move == "move"
andread "move" : Cmd Unit
should be easy to implement. In other cases it is a bit tricker, and might even require fixing some bugs informat
. For example, currently we pretty-print function closures usinglet
bindings:In order to
read
such values we would need to specially handlelet
bindings to turn them into an environment (or possibly simply run the resultingTerm
through the interpreter until it becomes aValue
--- but we would have to be careful to only do this for terms that we can statically tell will really turn into values in finite steps, since otherwiseread
would essentially beeval
and could cause the game to hang).In other cases, however, it looks like
format
doesn't actually do the right thing. For example, delayed values can also close over the environment, but this does not currently get formatted withlet
:The text was updated successfully, but these errors were encountered: