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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!news.glorb.com!news2.glorb.com!news.mv.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Type of the target of an assignment shall not be abstract Date: Tue, 23 Feb 2010 16:19:55 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <770863d9-14ae-4a05-b924-2dfeda7a96a8@f15g2000yqe.googlegroups.com> <39f56354-a2e2-4133-bbad-9343b2f22119@k6g2000prg.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls4.std.com 1266959983 26198 192.74.137.71 (23 Feb 2010 21:19:43 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 23 Feb 2010 21:19:43 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:chgVH4cy15BW95VMZUnSYUJ8ZuI= Xref: g2news1.google.com comp.lang.ada:9298 Date: 2010-02-23T16:19:55-05:00 List-Id: "Hibou57 (Yannick Duch�ne)" writes: > Le Mon, 15 Feb 2010 18:05:09 +0100, Adam Beneschan a > �crit: >> >> This is indeed illegal, although offhand I'm not sure it should be. > You cannot create an instance of an abstract type, initialized or not, > so assignment is unlikely to be legal. Whatever it is of instantiation > or assignment, this would not make no sense with an abstract type, as > some method would not be defined. Well, to be honest, one alternative > could have been to allow such a thing and simply disallow invocation of > abstract methods (Borland Turbo Pascal did this), but then, what about > if the object is passed as a class-wide parameter ? The method > receiving the it as a class-wide parameter may access an abstract > method. Allowing instantiation of abstracts and disallowing to pass it > where class-wide is expected, would not have been clean. I think it would make sense to allow creation of objects of an abstract type, if you forbid conversion to class-wide (including the case you mention, where there's an implicit conversion to class-wide when passing a specific actual to a class-wide formal). I guess assignments need to be forbidden, too, as somebody mentioned in this thread -- in case there's an abstract Adjust. The one case where I've wanted this feature is when I want to use a function call as the ancestor part of an extension aggregate, where the ancestor is abstract. I don't like being forced to use default values in this case. Alternatively, you could use a run-time check (any call to an abstract subprogram raises an exception). Probably a bad idea! - Bob