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!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!us.feeder.erje.net!news.snarked.org!newsfeed.news.ucla.edu!usenet.stanford.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Suggestion: Allow functions returning abstract types in certain situations Date: Wed, 21 May 2014 18:09:00 -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 1400710140 6066 192.74.137.71 (21 May 2014 22:09:00 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 21 May 2014 22:09:00 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:9ZmxupBeYfjGUlsYaBTjSM2OCoE= Xref: news.eternal-september.org comp.lang.ada:19962 Date: 2014-05-21T18:09:00-04:00 List-Id: "Dan'l Miller" writes: > The size of an abstract type is not known in this situation. The size of the abstract type is know from the (possibly private) record or record extension. >> package Pack1 is >> type T1 is abstract tagged record ... end record; >> function Func (X : Integer) return T1; -- not currently legal > > This whole topic seems to be going nowhere fast. The size of T1's > eventual concrete type (i.e., some member of T1'Class) cannot be known > by Func (nor in general by callers of Func). There could be many such > eventual concrete types of T1; hence the insurmountable question will > always be: which member of T1'Class was instantiated concretely? No, no, I think you are misunderstanding the suggested language change. Func is returning a T1, whose size is perfectly well known to the compiler. It's not returning some other member of T1'Class. Anyway, this: function Class_Wide_Func (X : Integer) return T1'Class; -- currently legal IS legal, and it CAN return an object whose tag is anything in the class. The size in this case is determined at the "return" in the body. - Bob