mirror of
https://github.com/swarm-game/swarm.git
synced 2024-09-19 03:19:53 +03:00
add a comment about execution of 'run'
This commit is contained in:
parent
3679dadd06
commit
e85d90c6f6
@ -201,7 +201,23 @@ execConst Run [VString fileName] k r = do
|
||||
f <- liftIO $ T.readFile (into fileName) -- XXX handle file not existing
|
||||
case processCmd f of
|
||||
Left err -> error (into err) -- XXX
|
||||
Right t -> mkStep r $ In t M.empty (FExec : k) -- XXX write note
|
||||
Right t -> mkStep r $ In t M.empty (FExec : k)
|
||||
-- Note, adding FExec to the stack above is correct. run has the
|
||||
-- type run : String -> Cmd (), i.e. executing (run s) for some
|
||||
-- string s causes it to load *and immediately execute* the
|
||||
-- program in the file.
|
||||
--
|
||||
-- If we instead had
|
||||
--
|
||||
-- load : String -> Cmd (Cmd ())
|
||||
--
|
||||
-- then the code would be the same as for run, EXCEPT that we
|
||||
-- would NOT add the FExec to the stack above. The fact that
|
||||
-- there are two FExec frames involved in executing 'run' (one to
|
||||
-- execute the run command itself, and one to execute the thing it
|
||||
-- loads) corresponds to the fact that it is equivalent to (in
|
||||
-- pseudo-Haskell syntax) 'join . load'.
|
||||
|
||||
execConst Run args k _ = badConst Run args k
|
||||
|
||||
badConst :: Const -> [Value] -> Cont -> a
|
||||
|
Loading…
Reference in New Issue
Block a user