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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!zen.net.uk!dedekind.zen.co.uk!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Style Question: normal record vs discriminated null-record. Date: Tue, 3 Jun 2014 09:19:42 +0200 Organization: cbb software GmbH Message-ID: <1rdxcdjn66fey.1g04zftyyg2jr$.dlg@40tude.net> References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: QTaafVZuunHujkJPndFR7g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:186713 Date: 2014-06-03T09:19:42+02:00 List-Id: On Mon, 02 Jun 2014 20:44:24 -0600, Shark8 wrote: > Ok, given some sort of alert-system (meaning there shouldn't be any/much > in the way of value manipulation of those objects) is it preferable to > use a discriminated null-record or a record with normal components? > > Type Grievousness is (Warning, Error); > Type Circumstance is (Expired_Data, Bad_Request, Malformed_Data); > > Type Alert_1(Severity : Grievousness; Condition : Circumstance) is > null record; > > Type Alert_2 is record > Severity : Grievousness; > Condition : Circumstance; > end record; My rule of thumb - discriminants whenever possible, components as a fallback. I wished Ada allowed discriminants of any type. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de