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: border1.nntp.dca.giganews.com!nntp.giganews.com!ottix-news.ottix.net!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: abstract types and subprograms Date: Tue, 20 May 2014 12:27:49 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1400603264 17042 192.74.137.71 (20 May 2014 16:27:44 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 20 May 2014 16:27:44 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:VE+s0N0+UBl8vYyO00pXKGMThQ0= Xref: number.nntp.dca.giganews.com comp.lang.ada:186514 Date: 2014-05-20T12:27:49-04:00 List-Id: Victor Porton writes: > But does it make sense (philosophically, not accordingly the current > specification) to use a function which returns an abstract type for a record > extension aggregate? Yes, it makes sense to create objects of an abstract type, and the most likely place to use such a thing is as the ancestor part in an extension aggregate. So this rule could be relaxed. What should be forbidden is to convert such an object to a class-wide type (explicitly or implicitly), because that can lead to dangling dispatch (i.e. calling an abstract subprogram, which of course has no body). Other languages that don't clearly distinguish specific and class-wide types have to forbid creating objects of abstract type, and I guess Ada just copied that. > In my humble opinion, this use may be useful in a future Ada standard. I mentioned this idea to Tucker once, and as I recall he didn't much like it, but I'm not sure why. - Bob