[m-users.] di / uo -- some clarification please.

emacstheviking objitsu at gmail.com
Tue Aug 6 03:19:08 AEST 2019


Hello,

I seem to have somehow conflated the use of the state variable form !X with
the use of the modes "di" and "uo" because so far the the only place I have
used such notation has been with the special !IO state variable.

I now have a game loop:







*:- pred game_loop(    app_state::di,  app_state::uo,    game_state::di,
game_state::uo,    io::di,         io::uo)is det.game_loop(!AppState,
!GameState, !IO) :-*
*     :*
*     : game state and app state code...*

*     :    game_loop(!AppState, !GameState, !IO).*

This is condensed for clarity(!) but have I understood the concepts
correctly. My intention is that after one pass of the game loop the "old"
(di) application and game states can be junked i.e. their memory
deallocated as the new incarnations are now the current ones, ready for the
tail-cail back into the next iteration of the game loop.

Is that the correct use case?

The game state will contain all the mutable stuff for the game and the
application state is slightly higher level stuff like "should I terminate"
etc.

Thanks
Sean.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20190805/e2767a38/attachment.html>


More information about the users mailing list