[m-rev.] for review: bug fix for global variables
Ralph Becket
rafe at cs.mu.OZ.AU
Tue Dec 21 10:37:24 AEDT 2004
Mark Brown, Tuesday, 21 December 2004:
> Index: extras/references/tests/glob_test_2.m
> ===================================================================
> RCS file: extras/references/tests/glob_test_2.m
> diff -N extras/references/tests/glob_test_2.m
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ extras/references/tests/glob_test_2.m 20 Dec 2004 17:13:11 -0000
> @@ -0,0 +1,34 @@
> +:- module glob_test_2.
> +:- interface.
> +:- import_module io.
> +
> +:- pred main(io::di, io::uo) is det.
> +
> +:- implementation.
> +:- import_module std_util, reference.
> +
> +:- pragma c_header_code("
> + #include ""c_reference.h""
> +").
> +
> +:- pragma promise_pure(main/2).
> +
> +main -->
> + (
> + { impure update(trailed_global, 2) },
> + { semidet_fail }
> + ->
> + write_string("I didn't expect that to succeed!\n")
> + ;
> + { semipure value(trailed_global, Value) },
> + write_int(Value),
> + nl
> + ).
I believe the current convention is to use state variables for IO rather
than DCGs.
Otherwise, that looks fine to me.
-- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list