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: border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Why no abstract non-tagged types? Date: Fri, 21 Feb 2014 09:33:41 +0100 Organization: cbb software GmbH Message-ID: References: <90153ba2-ffe8-4696-8459-d81a0f703c9e@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: I5Na6+WsEzT8WoegI0VZTA.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:185049 Date: 2014-02-21T09:33:41+01:00 List-Id: On Thu, 20 Feb 2014 19:04:08 -0800 (PST), Britt wrote: > Recently I've been wishing I could declare some otherwise conventional > enumeration types as "abstract" so they could only be used as a template > for derived types. Abstract enumeration is a different thing. That is when elements of the enumeration are abstract primitive operations as well as T'Pos, T'Val etc to be defined by derived implementation types. > Such abstract types couldn't be used directly for object declarations. For example: > > type Valve_State_Base_Type is abstract (Unknown, Open, Closed); -- in Ada 202X Why not: type Valve_State_Base_Type is [abstract] private; -- Legal Ada [ function Unknown return Valve_State_Base_Type is abstract; function Open return Valve_State_Base_Type is abstract; function Closed return Valve_State_Base_Type is abstract; ] > type Vent_Valve_State_Type is new Valve_State_Base_Type; -- a legal derivation Classes of scalar and by-value types is my no.1 wish for Ada 20XX. That would cover enumerations as well. It will never happen, I am afraid. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de