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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: formal array types and default values Date: Wed, 3 Jan 2018 15:16:34 -0600 Organization: JSA Research & Innovation Message-ID: References: <053b2370-5c15-4662-a9e3-e1464de206a1@googlegroups.com> <5c75fcdd-c965-4d03-9161-3576212e674d@googlegroups.com> Injection-Date: Wed, 3 Jan 2018 21:16:35 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="13584"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:49737 Date: 2018-01-03T15:16:34-06:00 List-Id: "Mehdi Saada" <00120260a@gmail.com> wrote in message news:5c75fcdd-c965-4d03-9161-3576212e674d@googlegroups.com... > Let's make it a proposal for the next norm then. I'm half serious: > depending on the difficulty, > which I know nothing of, I am ok to help, however I can. > Such a nice (and logical) feature, would a shame not to do. You mean a useless feature. :-) (See my response to Niklas about the difficulty.) The primary purpose of Default_Value is to detect errors. Specifically, most enumeration types have (or could have) a value that means Unknown or Uninitialized. For instance: type My_Color is (Unknown, Black, Red, Green, Blue, White) with Default_Value => Unknown; With this declaration, any programming errors that fail to set an object of My_Color will show up as a value of "Unknown". Which can be reliably detected. Other uses of default values are evil, because they hide an operation that should always be explicit. For instance: type Evil_Integer is new Integer with Default_Value => 0; Since 0 is a legal, useful value of type Evil_Natural, some code might work by accident when an uninitialized object happened to get the right value by default. That sort of thing will not help future readers. Randy.