[m-dev.] EDCGs

Peter Nicholas MALKIN pnmalk at cat.cs.mu.OZ.AU
Tue Dec 21 15:47:42 AEDT 1999


Hi,

On Tue, 21 Dec 1999, Peter Schachte wrote:

> Here's my attempt to be objective about the different proposals.  I'll
> also give my subjective catagorization of whether each aspect is a pro
> (+) or a con (-) of that approach, and put them in my estimated order
> of decreasing importance.  Corrections, additions, and other views
> welcome.
> 
> 
> Latest EDCG proposal
>      -	indirect semantics (semantics can only be understood as a
> 	transformation of the code adding arguments, not by thinking
> 	about the code as written)
>      -	setting or getting the variable currently associated with a
> 	name can only be done as a separate goal, not as part of a
> 	goal (eg, it takes two goals to increment a hidden variable:
> 	one to get the "current variable", and another to reset it)
>      -	bulky syntax and declarations

It would be possible to implement as part of EDCGs as similar syntax to the
"lexically later" proposal. 

Instead of the operators `>:' and `<+', `$' and `$$' could be used (as suggested
by Peter Schachte). Where `$' proceeded by a hidden variable name indicates the
current variable the hidden represents and `$$' represents a new variable for
the hidden to represent 

This means that setting or getting a variable does not have to be done as
separate goals.

For instance:

:- htype(app, list(int)).
:- hmode(app, changed(in, out)).

:- pred append(int) +hidden(changed(app)).
:- mode append(in).

append([]).
append(A.As) -->>
        append(As),
        $$app = A.$app.

Peter

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list