[m-dev.] ./2

Simon Taylor stayl at cs.mu.OZ.AU
Fri Aug 11 17:23:04 AEST 2000


 
> One of the unintended consequences of using . for qualification is that
> you can't use it as a function name anymore.

I don't think this is too much of a problem. When the the module
qualification operator is changed, we should probably change the
name of the list constructor to something else (for example '[|]'),
and you could overload that.

> :- func (char.tokens) = tokens.
> :- mode ((out.out) = in) is semidet.
> 
> C.Toks = Toks0 :-
>     Toks0^curr < Toks0^max,
>     string__unsafe_index(Toks0^text, Toks0^curr, C),
>     Toks = Toks0^curr := (Toks0^curr + 1).

To write this without depending on the name of the
constructor used for lists, you could write it as:

:- func [char | tokens] = tokens.
:- mode [out | out] = in is semidet.

[C | Toks] = Toks0 :-
	Toks0^curr < Toks0^max,
	string__unsafe_index(Toks0^text, Toks0^curr, C),
	Toks = Toks0^curr := (Toks0^curr + 1).

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