comp.lang.ada
 help / color / mirror / Atom feed
From: Adrian Knoth <adi@thur.de>
Subject: Re: character matching
Date: 15 Aug 2004 21:02:21 GMT
Date: 2004-08-15T21:02:21+00:00	[thread overview]
Message-ID: <slrnchvjqt.7ah.adi@ppc201.mipool.uni-jena.de> (raw)
In-Reply-To: 87zn4wtpvi.fsf@insalien.org

Ludovic Brenta <ludovic.brenta@insalien.org> wrote:

> type Category is (Whitespace, Punctuation, Letter, Digit, Other);

I support Steve's suggestion. Yours has the advantage of showing
how simple things can be done. I guess this is useful for learning
purposes but may contain more mistakes than the Annex-A-solution ;)


>       when others =>                              return Other;

> (note that in Ada, a "case" statement is required to process all
> possible values of the case_expression (here, C); the compiler will
> tell you if you forgot some values, unless as above you use "when
> others").

Which is considered BAD because when you change the range of a type
your case still works but may misbehave for the new values. Without
the "when others"-line the compiler forces you to adapt your routines
to the new range.

I know you know that, it's just for the original poster (John?).


-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Wie kommts das am Ende des Geldes noch soviel Monat �brig ist?



  reply	other threads:[~2004-08-15 21:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-13  5:23 character matching John J
2004-08-13 10:33 ` David C. Hoos
2004-08-13 11:12 ` Nick Roberts
2004-08-13 18:41 ` Jeffrey Carter
2004-08-15 12:36 ` John J
2004-08-15 14:52   ` Ludovic Brenta
2004-08-15 21:02     ` Adrian Knoth [this message]
2004-08-16 22:26       ` Ludovic Brenta
2004-08-15 17:21   ` Steve
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox