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!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: I'm facing an issue with: call to abstract procedure must be dispatching Date: Wed, 9 Dec 2015 09:48:58 +0100 Organization: cbb software GmbH Message-ID: <1xwqj9emwk6ny$.jgh59gu8uwmv$.dlg@40tude.net> References: <8bc7fd76-f00a-4eea-9715-470af028fc84@googlegroups.com> <1krm4xun4e4ny.jmh9kvf6s0a9.dlg@40tude.net> <12dc7aea-933d-4271-95bd-10df808917e4@googlegroups.com> <5hfb2q9imjfu.zs3xp9gxw0d3.dlg@40tude.net> <5788b259-8886-4ee2-8c3d-7799abfd840e@googlegroups.com> <14acd8b0-a5e9-40fd-b7cc-d319f914d507@googlegroups.com> <112596d0-d4ee-46e9-a02d-8de837aff352@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: bqgfK7NL3xTHnr0WRaLl4g.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:28729 Date: 2015-12-09T09:48:58+01:00 List-Id: On Tue, 8 Dec 2015 13:55:31 -0800 (PST), Serge Robyns wrote: > On Tuesday, 8 December 2015 22:09:13 UTC+1, Dmitry A. Kazakov wrote: >> On Tue, 8 Dec 2015 12:21:31 -0800 (PST), Serge Robyns wrote: >> >> If you really need mix-in then better do it like this: >> >> type T_Abstract_Data_Store >> ( Clients : not null access T_Abstract_Client'Class; >> Store2 : not null access T_Abstract_Store2'Class >> ) is abstract tagged limited record >> >> This would add a bit more safety, much needed when using access types. > > Was considering this option, I haven't used this construct yet. This is a > place where reading the ALRM just gives headaches without a clue of the > use cases. Discriminant is a kind of read-only component with additional checks ensuring it defined when the object is created. >From the SW POV discriminant is more an interface thing, while components are pure implementation. When you declare something with an access discriminant you announce that the client must take care of handling the object the discriminant refers. You basically put the burden on the client's shoulders, but also hint the compiler that it must check things like that the target object don't leave the scope prematurely. > And guess what, I just have been hit by a forgotten assignment Right, this is a safety check. Limited types have no assignment. Considering components or discriminants access types you should define the semantics of assignment. Is it shallow copy or deep copy? That normally would rule out anonymous access types. Communication objects rarely need to be copyable. If they have to, the best way is to add a handles layer to the reference-counted limited objects and copy the handles. Interfaces is a help here. You can make the handle and the target object to implement the same interface. The handle's implementation would delegate to the target's implementation. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de