comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: others clause
Date: 1996/09/03
Date: 1996-09-03T00:00:00+00:00	[thread overview]
Message-ID: <dewar.841801496@schonberg> (raw)
In-Reply-To: 50d4fc$elf@fozzie.sun3.iaf.nl


"Mike Bishop (mbishop@ghgcorp.com) wrote:
`` In fact, using others is a good idea even when all values are
   explicitly covered. If you add more values to the type but forget to
   modify the case statement, you can still handle the new values in
   the others choice. ''"

This seems a terrible idea to me. One of the great advantages of the
case statement in Ada is precisely the check that you have explicitly
covered every alternative.

I prefer to avoid others choices whereever possible, and instead write
out the list of alternatives that corresponds to what naturally might
otherwise be written as others. Then each time you add a case, your
compiler forces you to visit each case statement and think about whether
or not it belongs in the "others" branch.





  reply	other threads:[~1996-09-03  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-29  0:00 others clause Chris Sparks
1996-08-30  0:00 ` Mike Bishop
1996-08-31  0:00   ` Robert A Duff
1996-09-02  0:00   ` Geert Bosch
1996-09-03  0:00     ` Robert Dewar [this message]
1996-09-02  0:00   ` Brian Rogoff
1996-09-03  0:00   ` Adam Beneschan
1996-08-31  0:00 ` Robert Dewar
1996-09-02  0:00 ` Stephen Bull
replies disabled

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