[m-dev.] io syntax change

Peter Ross peter.ross at miscrit.be
Tue Nov 28 22:59:33 AEDT 2000


Dominique and I were discussing today about using the ideas from the
purity syntax for predicates which do io.

For example:

:- io pred write_char_list(list(char)::in) is det.
:- io pred write_char(list(char)::in) is det.

write_char_list([]).
write_char_list([H|T]) :-
    io write_char(H),
    io write_char_list(T).

The advantages of this syntax are:
    * it is quite a simple syntactic transformation
    * it frees up the DCG notation for some other state
    * in a lot of ways io is such a special case that IMHO having a
      seperate syntactic construct is a good thing.
    * I find it quite light weight

The disadvantages are
    * I haven't thought about it a lot
    * does it interact well with higher order code

Let me know what you think.
--------------------------------------------------------------------------
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