[m-rev.] for review: mercury implementation of string.m

Michael Day mikeday at bigpond.net.au
Mon Jun 17 16:01:50 AEST 2002


> > That's fine, but you've chosen the wrong primitives to base the rest
> > of the operations on. Mercury strings are not lists. string__first_char
> > is an unnatural operation for strings, and expressing algorithms which
> > iterate over strings in terms of it will cause unacceptable inefficiency.
> 
> Couldn't agree more.

first_char is fairly natural for C strings, isn't it? For example:

for (char *p = str; *p; ++p) { putchar(p); }

That's like calling first_char repeatedly, and sharing the strings rather
than making a copy each time. I thought the limitations of first_char on
Mercury were due to alignment requirements?

Michael

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list