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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Quick question regarding limited type return syntax Date: Sat, 2 Aug 2014 09:34:04 +0200 Organization: cbb software GmbH Message-ID: <20m59uxjlygw$.2mpabkt469vp.dlg@40tude.net> References: <166aaec5-5e9c-40e0-9b07-9b9c7d5f7f33@googlegroups.com> <16a6846f-2964-438a-ab9b-2029075f7924@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: qHNcUCBwwd01dPSBp/L1cg.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: news.eternal-september.org comp.lang.ada:21394 Date: 2014-08-02T09:34:04+02:00 List-Id: On Sat, 02 Aug 2014 10:11:59 +0300, Niklas Holsti wrote: > More elegantly IMO, the language could allow a default initialization > expression to be assigned in the type or subtype declaration: > > type My_Type is := ; This suggests assigning something to the type. (The only way to have default initialization is by having a default constructor. Which is just same.) BTW, type Integer is range ... := 0; subtype Positive is Integer range 1..Integer'Last; X : Positive; -- Oops! [...] > Randy's suggestion for an explicit indication that an object is > default-initialized is an orthogonal isssue. Yes, and it would have sense if implicitly uninitialized objects were illegal. Unfortunately they are not. > IMO the risk of using uninitialized variables, and the resulting > non-deterministic bugs, is one of the major remaining holes in the > safety of Ada. All initialization/finalization issues are. E.g. parent's Initialize not called. Finalization deadlock with task components. Dispatching calls through class-wide access discriminants upon initialization/finalization. The holes are as big as the hull... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de