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

Peter Wang novalazy at gmail.com
Tue Apr 27 12:42:11 AEST 2010


On 27 April 2010 12:10, Ralph Becket <rafe at csse.unimelb.edu.au> wrote:
>
> Ah, how is foo initialised to 123?

Ehm, not in a straightforward way.

Near the top of the file are these declaration, for mkinit_erl.

    % REQUIRED_INIT t:mercury__required_init
    % ENDINIT

and later:

    mercury__required_init() ->
      initialise_mutable_foo_0_p_0(),
      void.

    initialise_mutable_foo_0_p_0() ->
      V_1_1 = 123 ,
      set_foo_1_p_0(V_1_1 ).


For your pretty_printer change it will probably be easiest to rely on the
get_mutable message returning a value of `undefined' initially.  Untested:

get_pretty_printer_is_initialised() ->
  'ML_erlang_global_server' ! {get_mutable, t__mutable_variable_foo, self()},
  receive
    {get_mutable_ack, undefined} -> {no};
    {get_mutable_ack, Value} -> Value
  end.

Peter
--------------------------------------------------------------------------
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