comp.lang.ada
 help / color / mirror / Atom feed
From: "G.B." <bauhaus@futureapps.invalid>
Subject: Re: I'm facing an issue with: call to abstract procedure must be dispatching
Date: Wed, 9 Dec 2015 14:42:24 +0100
Date: 2015-12-09T14:42:24+01:00	[thread overview]
Message-ID: <n49avc$2qi$1@dont-email.me> (raw)
In-Reply-To: <1j28s23yiy4it$.86sbf42gu6wk.dlg@40tude.net>

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. Maybe that simplifies things. Example below.

> 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.
(Yeah, I guess it's not the dream of an engineer who is looking
for some kind of "just technical perfection".)

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.

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