From: Ehud Lamm <mslamm@mscc.huji.ac.il>
Subject: Re: Is there a language that Dijkstra liked? (was: Re: Software landmines (loops))
Date: 1998/10/29
Date: 1998-10-29T00:00:00+00:00 [thread overview]
Message-ID: <Pine.A41.3.96-heb-2.07.981029105421.106526B-100000@pluto.mscc.huji.ac.il> (raw)
In-Reply-To: 718lct$qk1$1@supernews.com
On Wed, 28 Oct 1998, Pat Rogers wrote:
> One does have to be careful, though. Consider:
>
> function Next( This : Some_Discrete_Type ) return
> Some_Discrete_Type is
> begin
> return Some_Discrete_Type'Succ(This);
> exception
> when Constraint_Error =>
> return Some_Discrete_Type'First;
> end Next;
>
> In such cases the explicit, hand-coded check is
> preferable, IMHO:
>
> function Next( This : Some_Discrete_Type ) return
> Some_Discrete_Type is
> begin
> if This = Some_Discrete_Type'Last then
> return Some_Discrete_Type'First;
> else
> return Some_Discrete_Type'Succ(This);
> end if;
> end Next;
>
In this example, I for one would think both approaches are viable. Maybe I
would even prefer the IF approach.
This is not the example for misusing valdity checks.
What I find ugy is things like this:
i:integer
if i<0 then <some error handling>
instead of
i:Natural
This kind of coding style doesn't allow the reader to stop checking for
himself the i is indeed always non negative.
Ehud Lamm mslamm@mscc.huji.ac.il
next prev parent reply other threads:[~1998-10-29 0:00 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-28 0:00 Is there a language that Dijkstra liked? (was: Re: Software landmines (loops)) John Woodruff
1998-10-28 0:00 ` Pat Rogers
1998-10-29 0:00 ` Ehud Lamm [this message]
-- strict thread matches above, loose matches on Subject: below --
1998-10-14 0:00 R. Kerr
1998-10-14 0:00 ` Matthew Heaney
1998-10-14 0:00 ` R. Kerr
1998-08-19 0:00 Software landmines (was: Why C++ is successful) adam
1998-08-19 0:00 ` Dan Higdon
1998-08-20 0:00 ` adam
1998-08-20 0:00 ` Software landmines (loops) Nick Leaton
1998-08-30 0:00 ` Matthew Heaney
1998-08-30 0:00 ` Robert Martin
1998-08-31 0:00 ` Andrew Hussey
1998-09-01 0:00 ` Gerry Quinn
1998-09-01 0:00 ` Robert Martin
1998-09-02 0:00 ` mfinney
1998-09-02 0:00 ` Robert Martin
1998-09-02 0:00 ` Ell
1998-09-02 0:00 ` Robert Martin
1998-09-02 0:00 ` Ell
1998-09-02 0:00 ` Robert Martin
1998-09-02 0:00 ` Ell
1998-09-02 0:00 ` Robert Martin
1998-09-03 0:00 ` Joe Gwinn
1998-09-06 0:00 ` Charles Hixson
1998-09-08 0:00 ` adam
1998-09-09 0:00 ` Gerry Quinn
[not found] ` <gio+van+no+ni+8-1609980034390001@dialup26.tlh.talstar.com>
1998-09-16 0:00 ` Biju Thomas
1998-09-16 0:00 ` Is there a language that Dijkstra liked? (was: Re: Software landmines (loops)) Rick Smith
1998-09-17 0:00 ` Markus Kuhn
1998-09-17 0:00 ` dewarr
1998-09-17 0:00 ` Biju Thomas
1998-09-18 0:00 ` dewarr
1998-09-18 0:00 ` Markus Kuhn
1998-10-09 0:00 ` Matthew Heaney
1998-10-09 0:00 ` Jay Martin
1998-10-09 0:00 ` Pat Rogers
1998-10-10 0:00 ` Dave Wood
1998-10-13 0:00 ` last.first
1998-10-23 0:00 ` Brian Mueller
1998-10-23 0:00 ` Ell
1998-10-23 0:00 ` midlamD
1998-10-23 0:00 ` Ell
1998-10-23 0:00 ` Arun Mangalam
1998-10-23 0:00 ` DPH
1998-10-24 0:00 ` Michael Stark
1998-10-24 0:00 ` Dale Stanbrough
1998-10-24 0:00 ` Ehud Lamm
1998-10-24 0:00 ` Dave Wood
1998-10-24 0:00 ` Tucker Taft
1998-10-24 0:00 ` Dave Wood
1998-10-26 0:00 ` Bill Ghrist
1998-10-27 0:00 ` Ell
1998-10-27 0:00 ` dewarr
1998-10-23 0:00 ` Gautier.DeMontmollin
1998-10-09 0:00 ` Pat Rogers
1998-10-11 0:00 ` Bertrand Meyer
1998-10-12 0:00 ` Pat Rogers
1998-10-12 0:00 ` Rod Chapman
1998-10-13 0:00 ` Robert I. Eachus
1998-09-17 0:00 ` Pat Rogers
1998-09-17 0:00 ` dewarr
1998-09-17 0:00 ` David C. Hoos, Sr.
1998-09-18 0:00 ` bengt
1998-10-09 0:00 ` Gautier.DeMontmollin
1998-10-21 0:00 ` Van Snyder
1998-10-22 0:00 ` biocyn
1998-10-26 0:00 ` Ehud Lamm
1998-10-26 0:00 ` Tucker Taft
1998-10-26 0:00 ` dennison
1998-10-26 0:00 ` Ehud Lamm
1998-10-26 0:00 ` Pat Rogers
1998-10-27 0:00 ` dennison
1998-10-27 0:00 ` bill
1998-10-27 0:00 ` Dave Wood
1998-10-28 0:00 ` norm
1998-10-27 0:00 ` dewarr
1998-10-27 0:00 ` Ehud Lamm
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox