[m-dev.] for review: teeny changes to string.m

David Overton dmo at cs.mu.OZ.AU
Fri Oct 27 23:46:44 AEDT 2000


On Fri, Oct 27, 2000 at 10:54:47PM +1100, Michael Day wrote:
> 
> > No, `ui' modes are not yet fully supported.  The reason it works in
> > this case its that the predicate is implemented using the C
> > interface, but you won't be able to use it much.
> 
> Given that it does work in this case and that it's useful (gives me the
> length of a string without trashing its uniqueness) is it worth applying?

Preserving the uniqueness is only going to be useful if you actually
want to do destructive update somewhere.  Since there are currently no
predicates in `string.m' which desctructively update strings, this
change by itself is not very useful, IMHO.

If you felt like adding `di' modes to some of the other predicates in
`string.m' that would be great.

But you will still need to be careful with how you use the `ui' modes
of `string__length'.  E.g. you are going to get mode errors even doing
something as simple as defining a `string__length' function in terms
of the predicate version.

> 
> > Actually, have you tested the function version of string__length with
> > `ui' mode?  This shouldn't compile with the current compiler.  (I just
> > tested it and it doesn't).
> 
> Oops, I tested the predicate version and assumed the function version
> would work too.

Rule number 1: always check to see if a change compiles.

> How about the part of the diff that changes the output mode to uo
> instead of out for the function?

Yes, the `uo' mode for the result is fine since `int's are always
unique.


David
-- 
David Overton      Department of Computer Science & Software Engineering
PhD Student        The University of Melbourne, Victoria 3010, Australia
+61 3 8344 9159    http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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