[mercury-users] Handy Programming tool for Mercury.

Richard A. O'Keefe ok at atlas.otago.ac.nz
Mon May 24 11:53:31 AEST 1999


Lee wrote:

	Of course there are times when we don't have control over the input,
	which makes tools for string manipulation desirable.

There's a fundamental law of programming:

    STRINGS ARE WRONG.

Strings are what you use for unstructured data, and for processing
purposes, you want to get some structure in there as fast as possible.
Even for things like file names, Lisp-style pathname records are
more useful than raw strings.  I'm afraid that even if you _don't_
have control over the input, I don't see "tools for string
manipulation" as appropriate.  What you should do is write a _grammar_,
so you need tools for parsing sequences of characters, but you _don't_
want to store undigested chunks of input as strings if you are going to
do anything other than just write them out again unmodified.  Oh yes,
you also want to write grammars to convert structured data to text,
but in both cases, we're talking about _streams_, not _strings_.

I've put a lot of effort into studying ISO 10646/Unicode and indeed
odd things like ISO 2022, and trust me on this:  existing international
standards for text are so amazingly nasty that you want to have as
little to do with raw text as possible.  Samples:
    - how many representations of the digit zero are there?
    - how many zero-width characters are there and why?
    - what's the difference between K (212A) and K (004B)?
    - in what way is ISO Latin 1 *NOT* an extension of ASCII?
--------------------------------------------------------------------------
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