[m-rev.] for review: mercury implementation of string.m
Ralph Becket
rafe at cs.mu.OZ.AU
Mon Jun 17 16:50:19 AEST 2002
Michael Day, Monday, 17 June 2002:
>
> first_char is fairly natural for C strings, isn't it? For example:
>
> for (char *p = str; *p; ++p) { putchar(p); }
You can place all sorts of interpretations on this sort of code. The
fact remains that first_char is pretty much the same as
cons(char, list(char)), which suggests that construction and
deconstruction are both O(1). For Mercury strings this is not the case.
> 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?
We impose the constraint that pointers always point to the start of an
object, never to its interior. This is largely to support efficient
garbage collection.
- Ralph
--------------------------------------------------------------------------
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