[m-dev.] EDCGs and Higher Order Programming
Ralph Becket
rbeck at microsoft.com
Thu Jan 27 01:59:35 AEDT 2000
Thanks for the update. Just for the record, I'm very
uneasy about the whole EDCG thing.
It seems to me that EDCGs are a leap *away* from
declarative programming in the sense that code using
them can no longer be directly associated with logical
formulae without reference to some auxiliary machinery.
DCGs at least have { big red warning signs } indicating
where strange things are afoot. I admit that code
using EDCGs looks much simpler and it may be a good
thing on that basis, but I really don't like the shift
to a less declarative `flavour'.
The functional programming community seem to avoid the
need for this sort of thing by having good mechanisms
for boxing up bits of state; now we have the record
syntax, surely that (plus DCGs) should be sufficient to
achieve the same thing?
> But reusing list__foldl is more difficult.
> For that, you would need to write something like
>
> write_strings(Strs) -->>
> WriteStringPred = (pred(S::in, A0::di, A::uo) is det :-
> (io is changed(A0, A) -->>
> io__write_string(S))),
> list__foldl(WriteStringPred, Strs, $io, $=io).
This is terrible! I make good use of higher order
programming and I'm hampered enough as it is by the
mode system (the polymorphic modes extension is
eagerly awaited) without having to jump through hoops
like this one!
Cheers,
Ralph
--------------------------------------------------------------------------
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