[m-dev.] EDCGs and Higher Order Programming
Tyson Dowd
trd at cs.mu.OZ.AU
Fri Jan 28 13:11:02 AEDT 2000
On 27-Jan-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> On the other hand, using EDCGs, as currently suggested, I
> would be able to write
>
> p -->> a, b, c.
>
> My problem with this is that there's no record *here* of what
> the `side effects' of a, b, and c are. Perhaps it might be
> better to add some annotation:
>
> p -->>
> a changes(x, y),
> b changes(y, z),
> c changes(x, y, z).
>
> Here, at least, I'm making it quite explicit what is going on.
>
> I suspect I'm getting altogether too het up about this one.
> Maybe it just is a fact of life that "unadorned declarative
> code" + "lots of state munging" = "unreadable mess" and that
> we have to throw away "unadorned" in order to get "readable
> code" on the RHS.
I think this is the key point. EDCGs are low on syntax, and so hide a
lot of stuff from you -- hopefully it is being hidden because it is just
clutter. However, that information is still all available,
and a sufficiently advanced editing environment would be able
automatically show you the hidden information (something like the
annotations you have above).
So you can get easy to read and write code, but with the appropriate
tool support you can also get a full understanding of the code.
I think there is a danger that people could create a
difficult to read coding style by over-using EDCGs. But I'm guessing
it would probably be no more difficult to read than the expanded out version.
Using records and DCGs to tackle the clutter of multiple state arguments
is a nice little hack, but it mixes two sorts of concepts.
I think we need to see how EDCGs pan out. Many of the coding style
concerns people have may turn out to be simply pathological cases that
sane people wouldn't write.
Tyson.
--------------------------------------------------------------------------
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