From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dc9636dd2392f5bd X-Google-Attributes: gid103376,public From: synoptik@home.com (A. Logue) Subject: Re: Problem with function return Date: 2000/04/03 Message-ID: <8F0AB9788synoptikdamudderfuck@news>#1/1 X-Deja-AN: 605840520 References: <38e7a0c8$0$17676@businessnews.de.uu.net> X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.ab.home.com 954720897 24.67.75.188 (Sun, 02 Apr 2000 17:14:57 PDT) Organization: @Home Network Canada User-Agent: Xnews/2.06.20 NNTP-Posting-Date: Sun, 02 Apr 2000 17:14:57 PDT Newsgroups: comp.lang.ada Date: 2000-04-03T00:00:00+00:00 List-Id: PhyrePhox@firemail.de (Amgarp) wrote in <38e7a0c8$0$17676@businessnews.de.uu.net>: >Hi, > >please help me with the following Problem: > >Main programm: > >type color is (red,gree,blue); > >col:color; > >col:=some_function(parameter); > >Now, "some_function" returns of course a color type, >but when the parameter is bad(e.g. an empty string), an exception will be >raised. > >What should the function return then? 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 clients deal with the result. i.e. ignore and carry on, delay and retry, etc.