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: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!feeder.erje.net!eu.feeder.erje.net!zen.net.uk!dedekind.zen.co.uk!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Suggestion: Allow functions returning abstract types in certain situations Date: Thu, 22 May 2014 09:22:36 +0200 Organization: cbb software GmbH Message-ID: <8zl191j3jpi3.12xzqioq4t4hy.dlg@40tude.net> References: <06f66a19-00f1-405f-a517-05d18a021b65@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: QTaafVZuunHujkJPndFR7g.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 X-Original-Bytes: 2027 Xref: number.nntp.dca.giganews.com comp.lang.ada:186556 Date: 2014-05-22T09:22:36+02:00 List-Id: On Wed, 21 May 2014 19:19:21 -0400, Robert A Duff wrote: > Adam Beneschan writes: > >> Hmmm... I'd worry that if we allowed an object with an abstract-type >> tag to exist even for a little while, something in the language >> semantics might require Initialize, Adjust, or Finalize to be called >> on it, which could be bad if, for example, it tried to redispatch to >> an abstract body. > > Not sure what you mean about "redispatch". You can't [re]dispatch > without converting to class-wide. Actually you can: 1. The Rosen's trick. You put a class-wide access discriminant into the abstract type and dispatch on it. 2. Consider: type T is tagged ...; -- Non-abstract type S is abstract new T with ...; -- Abstract You convert to T, then that to T'Class and then dispatch on that. Never needed S'Class to make it crash. Morale. Type semantics must be respected. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de