[m-rev.] for review: state vars syntax in language reference

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jan 30 12:41:06 AEDT 2007


On Mon, 29 Jan 2007, Ondrej Bojar wrote:

> (Sorry for duplicit posting, my first attempt might have not got through.)
>
> Hi, all.
>
> After the last explanatory mail from Peter (Schachte), I blindly adopted
> his view.

I'm sure there's probably a suitably pithy saying about the dangers of
blindly adopting somebody else's views; I'm probably read it at the bottom
of one of Peter's mails ;-)

> Here is a proposal of changes to the reference manual for
> sweetening state vars modes.
>
> Breaking the link between syntax and semantics, I interpret
> "!type::svmode" as "!(type::svmode)", although the parse is different
> given current priorities.
>
> I have also included the proposal of "pure functions with side effects"
> with all the dangers these can bring (I am aware only of
> compiler-dependent order of evaluation), so please reject this section
> separately from the main part.
>
> I am attaching the diff twice, in the body and as an attachment, because
> I am afraid of line wrapping problems.
>
> Cheers, Ondrej.
>
>
> Index: reference_manual.texi
> ===================================================================
> RCS file:
> /home/mercury/mercury1/repository/mercury/doc/reference_manual.texi,v
> retrieving revision 1.379
> diff -u -r1.379 reference_manual.texi
> --- reference_manual.texi	15 Jan 2007 02:23:58 -0000	1.379
> +++ reference_manual.texi	29 Jan 2007 07:41:42 -0000
> @@ -937,13 +937,9 @@
>  condition and then-goal of the if-then-else expression, hence
> @samp{!:@var{X}}
>  may appear therein.
>
> -There are three restrictions concerning state variables in lambdas: first,
> - at samp{!@var{X}} is not a legitimate function result, since it stands
> for two
> -arguments, rather than one; second, @samp{!@var{X}} may not appear as a
> -parameter term in the head of a lambda since there is no syntax for
> specifying
> -the modes of the two implied parameters; third, @samp{!@var{X}} may not
> appear
> -as an argument in a function application since this would not make
> sense given
> -the usual interpretation of state variables and functions.
> +Special syntax for has been introduced to simplify predicate and
> function mode
> +declarations for state variables (@pxref{Predicate and function mode
> +declarations with state variables}).

This special syntax needs to be usable in places other than predicate
and function declarations, for example:

- lambda expressions (you've done these already)

- method declarataions within typeclass declarations.

- mode specific clauses

- mode lists in foreign_export declarations

Julien.
--------------------------------------------------------------------------
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