[mercury-users] string__first_char

Michael Day mcda at students.cs.mu.oz.au
Mon Oct 16 15:26:31 AEDT 2000


> ISO 10646 characters (see 'wchar_t' in C or C++) are 31-bit codes.
> The 16-bit barrier was actually breached within the last year or two.
> I fail to see why processing 31-bit characters in a word-aligned way
> should be "uncomfortably slow".

Well this is precisely what I was going to suggest; if strings in Mercury
must be word aligned, why not use 32-bit characters (at least on my 32-bit
word sized machine :). I was assuming that Mercury currently uses 8-bit
characters, otherwise this word alignment wouldn't be an issue.

As for uncomfortably slow, I was thinking of the list routines such as
append, which compile down to code basically identical to that which you
would write in C. Using first_char on a string results in code that feels
like it should generate an efficient enough loop, but doesn't. That seems
unfortunate, especially in situations when foldl is not an option.

> More to the point, working with strings is a mistake in any programming
> language.  Strings are the ultimate data UNstructure.  The only thing they
> are really good at is holding uninterpreted data that you are going to hand
> straight back to the source you got it from.

How about holding uninterpreted data that you are going to attempt to
interpret? :)

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



More information about the users mailing list