[m-rev.] For review: ensure proper initialisation of pretty_printer

Ralph Becket rafe at csse.unimelb.edu.au
Tue Apr 27 12:10:47 AEST 2010


Peter Wang, Tuesday, 27 April 2010:
> On 27 April 2010 11:50, Ralph Becket <rafe at csse.unimelb.edu.au> wrote:
> > Peter, can you show me how to set up a mutable variable in Erlang
> > under Mercury?
> 
> The following is the code generated for this declaration, with some
> simplification:
> 
>   :- mutable(foo, int, 123, ground, [untrailed, attach_to_io_state]).
> 
> 
> get_foo_1_p_0() ->
>   'ML_erlang_global_server' ! {get_mutable, t__mutable_variable_foo, self()},
>   receive
>     {get_mutable_ack, Value} ->
>       Value
>   end.
> 
> set_foo_1_p_0(X) ->
>   'ML_erlang_global_server' ! {set_mutable, t__mutable_variable_foo, X}.
> 
> 
> ! is the 'send' operator
> 
> 'ML_erlang_global_server' is the name of the process holding a table of globals
> 
> get_mutable, set_mutable, t__mutable_variable_foo are just atoms

Ah, how is foo initialised to 123?
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list