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 15:23:32 +0100
Date: 2015-12-09T15:23:32+01:00	[thread overview]
Message-ID: <axesi0tuhqhe.1dpm6srreqwda.dlg@40tude.net> (raw)
In-Reply-To: n49avc$2qi$1@dont-email.me

On Wed, 9 Dec 2015 14:42:24 +0100, G.B. wrote:

> On 09.12.15 13:03, Dmitry A. Kazakov wrote:
>> You mean procedural types?
> 
> Not exactly procedural types. I'd like a reflection of a more
> clear cut distinction between when a(n MI-)type is needed for
> (M)dispatching versus when the (MI-)type is needed for materializing
> actual objects.

I think the problem is that you consider dispatching an interface-thing.
It is not. Dispatching is strictly an implementation.

It is important to understand that both primitive and class-wide operations
are defined on the whole class. It is the implementations of these that are
different. In particular a primitive operation has a body for each member
of the class. Dispatching is merely a mechanism of body selection. There
could be other mechanisms of body composition. For example body extension
as used in constructors, destructors, aggregates, assignment, stream I/O
operations.

>> The bottom line, you can have your lazy blocks only when not reusable and
>> weakly typed.
> 
> Put differently, at some point I can use "weakly" typed blocks
> for getting a job done that warrants just the necessary effort.

Yes, you can program C in Ada. The question is what for?

> For some perspective, dispatching can look a lot like a specially
> crafted procedural thing. I think that there are cases related
> to MD (as in the example of storing from Objects'Class into
> Databases'Class) when declaring a regular named (MI-)type would
> be going over the top.
> 
> procedure Demo is
> 
>     package Root is
>        type T is abstract tagged private;
>        procedure Op
>          (X : in out T; Val : Natural) is abstract;
>     private
>        type T is abstract tagged record
>           Identity : Natural; -- := ...;
>        end record;
>     end Root;
> 
>     package Twigs is
>        type A is new Root.T with record null; end record;
>        overriding procedure Op (X : in out A; Val : Natural);
> 
>        type B is new Root.T with record null; end record;
>        overriding procedure Op (X : in out B; Val : Natural);
>     end Twigs;
>     package body Twigs is separate;
> 
>     package X is
> 
>        procedure D12
>          (Left  : in out Root.T'Class;
>           Right : in out Twigs.B'Class);
> 
>        procedure D22
>          (Left  : in out Twigs.A'Class;
>           Right : in out Twigs.B'Class);
> 
>     end X;
>     package body X is separate;
> 
>     Va : Twigs.A;
>     Vb : Twigs.B;
> 
> begin
>     --  not Ada
>     do X.D12 with X.D2'Type (Left => V1, Right => Vb);
>     do X.D22 with X.D2'Type (Left => Va, Right => Vb);
>     do X.D22 with X.D2'Type (Left => Va, Right => Va);  -- no
> 
> end Demo;
> 
> The last lines are not really needed, but they show where
> there is a type lurking.

I don't understand the purpose of this example.

MI and MD are required for consistency. Practical use or not is irrelevant,
because consistency trumps everything else.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2015-12-09 14:23 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
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 [this message]
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