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

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Nov 12 00:48:43 AEDT 2000


On 11-Nov-2000, Michael Day <mikeday at corplink.com.au> wrote:
> 
> > 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.

Sounds like a good idea.

> Or should they be functions, with predicate wrappers? <shrug>

<shrug> is right.  I'd probably use predicates with function wrappers,
simply for consistency with elsewhere.

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

Ah, I see.

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

That sounds fine.

> (This function declaration doesn't appear in the interface
> documentation for the module (unfortunately)

Yes.  I probably shouldn't have let that change of Ralph's which added
the function declarations in the wrong place get past code review.

Any volunteers for fixing that one?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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