comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: I'm facing an issue with: call to abstract procedure must be dispatching
Date: Wed, 9 Dec 2015 09:48:58 +0100
Date: 2015-12-09T09:48:58+01:00	[thread overview]
Message-ID: <1xwqj9emwk6ny$.jgh59gu8uwmv$.dlg@40tude.net> (raw)
In-Reply-To: 112596d0-d4ee-46e9-a02d-8de837aff352@googlegroups.com

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

  parent reply	other threads:[~2015-12-09  8:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 16:45 I'm facing an issue with: call to abstract procedure must be dispatching Serge Robyns
2015-12-08 16:59 ` G.B.
2015-12-08 17:04 ` Dmitry A. Kazakov
2015-12-08 17:24   ` Serge Robyns
2015-12-08 17:42     ` Dmitry A. Kazakov
2015-12-08 18:00       ` Serge Robyns
2015-12-08 18:22         ` Dmitry A. Kazakov
2015-12-08 20:21           ` Serge Robyns
2015-12-08 21:08             ` Dmitry A. Kazakov
2015-12-08 21:55               ` Serge Robyns
2015-12-08 22:43                 ` Serge Robyns
2015-12-08 22:55                   ` Jeffrey R. Carter
2015-12-09 23:03                     ` Randy Brukardt
2015-12-10  8:38                       ` Serge Robyns
2015-12-10 23:43                         ` Randy Brukardt
2015-12-09  8:48                 ` Dmitry A. Kazakov [this message]
2015-12-09 10:53               ` G.B.
2015-12-09 12:03                 ` Dmitry A. Kazakov
2015-12-09 13:42                   ` G.B.
2015-12-09 14:23                     ` Dmitry A. Kazakov
2015-12-08 22:55             ` Jeffrey R. Carter
2015-12-08 23:04               ` Serge Robyns
2015-12-08 23:42                 ` Jeffrey R. Carter
2015-12-09 13:40                 ` Jere
2015-12-09 13:48                   ` G.B.
2015-12-09 15:33                     ` Jere
2015-12-13 21:37                 ` Shark8
2015-12-14  2:20                   ` Jeffrey R. Carter
2015-12-15  7:26                     ` Shark8
2015-12-08 17:30 ` Jeffrey R. Carter
2015-12-08 17:48   ` Serge Robyns
2015-12-08 18:46     ` Jeffrey R. Carter
2015-12-08 20:28       ` Serge Robyns
2015-12-08 22:20     ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox