comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Problem with function return
Date: 2000/04/03
Date: 2000-04-03T00:00:00+00:00	[thread overview]
Message-ID: <8c96al$rr5$1@nnrp1.deja.com> (raw)
In-Reply-To: 8F0AB9788synoptikdamudderfuck@news

In article <8F0AB9788synoptikdamudderfuck@news>,
  synoptik@home.com (A. Logue) wrote:

> At work we have an informal standard to declare a "Nil" kind
> as the first kind for all enumerated types.  For example

>    type color_kind is (nil, red, green, blue);

> This works great in many cases where the return type cannot be
> determined
> (for whatever reason), simply return a nil kind and let the
> function's

This seems a bad idea to me, it will result in C-like errors
of the caller forgetting to check for an error, yes it may
be caught, but it is much to easy for it to get swallowed
up, e.g. by the else clause of an if.

Much better to raise an exception. if the caller wants to handle
it they can put an exception handler at the call site. If they
don't want to handle it, or more likely they forget, then the
exception gets raised and unhandled, which is often better than
blindly carrying on!


Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~2000-04-03  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-02  0:00 Problem with function return Amgarp
2000-04-02  0:00 ` David Starner
2000-04-03  0:00 ` A. Logue
2000-04-02  0:00   ` Ray Blaak
2000-04-03  0:00     ` Robert Dewar
2000-04-03  0:00   ` Robert Dewar [this message]
2000-04-03  0:00     ` Mats Weber
replies disabled

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