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

Michael Day mikeday at corplink.com.au
Sat Nov 11 23:40:01 AEDT 2000


> I suggest using `set_char' (and `set_char_det', `unsafe_set_char').

set_char is pretty ugly (I mean considering its inverse is index, not
get_char) but as set is entirely not obvious, consider it done.

> It might be better to make those functions rather than predicates.

Returning the new string? I'd rather use function wrappers in the style of
all the other string predicates, to allow them to be used in DCG
predicates. Or should they be functions, with predicate wrappers? <shrug>

> s/MR_Word/MR_Unsigned/
> 
> (MR_Word should be treated as an opaque type,
> if you want an unsigned type use MR_Unsigned.)

Done, and changed the code in index that I copied from. Diff to follow, in
case I broke anything.

> >  :- func string__length(string) = int.
> > +:- mode string__length(in) = uo is det.
> 
> You should add the `(ui) = uo' mode too.

I would rather not, as due to the current limitations of the ui mode it
seems that I would need to do it using pragma c_code, which would
basically require duplicating all the code from length/2. It seems neater
to add one mode line once ui modes work, given that lack of this feature
has obviously not troubled anyone in the past. Should I add a comment to
that effect? (This function declaration doesn't appear in the interface
documentation for the module (unfortunately) so any comment won't scare
off users).

Michael

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