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 15:23:32 +0100 Organization: cbb software GmbH Message-ID: 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> <1j28s23yiy4it$.86sbf42gu6wk.dlg@40tude.net> 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:28738 Date: 2015-12-09T15:23:32+01:00 List-Id: 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