From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Lower bounds of Strings
Date: Sat, 9 Jan 2021 11:53:50 +0100 [thread overview]
Message-ID: <rtc1vu$1cfj$1@gioia.aioe.org> (raw)
In-Reply-To: rtb3ov$r85$1@franka.jacob-sparre.dk
On 2021-01-09 03:18, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:rtaeok$l8b$1@gioia.aioe.org...
>> On 2021-01-08 18:23, Shark8 wrote:
>>> On Thursday, January 7, 2021 at 3:03:54 PM UTC-7, Randy Brukardt wrote:
>>
>>>> Any sort of multiple inheritance (not to mention multiple dispatch)
>>>> requires
>>>> searching a lookup table for the appropriate interface.
>>> Ah.
>>> It appears you're confusing the Ada concept underlying keyword INTERFACE
>>> with the general/abstract notion.
>>> It appears to me that Dmitry is referring to the latter, not the
>>> Ada-construct of INTERFACE, which requires a tagged type.
>>>
>>> I think what he's getting at is something that I considered/proposed here
>>> on C.L.A some years ago, adding the concept of an "ABSTRACT INTERFACE" to
>>> Ada. (IIRC, the proposal I had in mind was to be able to model the
>>> notional meta type-hierarchy; eg: Number ? Universal_Integer ?
>>> System.Integer.)
>>
>> Right, though I do not think that tags can inflict any cost. The situation
>> is same as with array bounds. You do keep bounds when the array is
>> statically constrained. Tag is just another constraint like bounds. It
>> must be handled just same way, removed when statically known. No penalty,
>> unless classes are actually used. I do not know why people always bring
>> dispatch into discussions about static cases.
>
> The possibility of dynamic dispatch (in some code that doesn't exist yet,
> but *could*) is what is so expensive and is virtually impossible to remove
> after the fact (that is, in an optimizer).
The representation without the tag must be mandatory.
> If you wanted to include a
> declaration that you *never* were going to use any dynamic dispatch,
This declaration is already in the language. Only A'Class dispatches.
Again, it is like with bounds, only array (... range <>) of ... has
dynamic bounds. To enforce dispatch one would have to convert to A'Class
first, that will add the tag to the array's dope vector.
> then
> you could talk try to ignore the possibility. But without some sort of
> dispatch, a defined interface buys you nothing other than complication. It
> doesn't simplify the description and would substantially complicate the
> implementation. What's the point??
Of course it will simplify everything. E.g. our beloved generics. Compare
generic
type I is (<>);
type E is private;
type A is array (I range <>) of E;
with
generic
type A is new Root_Array_Type with private;
or
package Ada.Containers.Vectors is
...
type Vector is tagged private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
-- hundreds of operation declarations
with
type Vector is new array (Index_Type) of Element_Type with private;
-- nothing else to declare
Everything in Ada could be formalized in interfaces:
type Index is new Discrete_Type; -- Same as <>
type Discrete_Type is abstract new Ordered_Type and Copyable_Type;
and so on.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2021-01-09 10:53 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 11:04 Lower bounds of Strings Stephen Davies
2021-01-05 11:57 ` Dmitry A. Kazakov
2021-01-05 12:32 ` Jeffrey R. Carter
2021-01-05 13:40 ` Dmitry A. Kazakov
2021-01-05 14:31 ` Stephen Davies
2021-01-05 17:24 ` Stephen Davies
2021-01-05 18:28 ` Jeffrey R. Carter
2021-01-05 21:02 ` Stephen Davies
2021-01-07 10:38 ` Stephen Davies
2021-01-07 21:39 ` Randy Brukardt
2021-01-07 22:38 ` Stephen Davies
2021-01-05 12:24 ` Luke A. Guest
2021-01-05 12:49 ` Simon Wright
2021-01-05 12:51 ` Jeffrey R. Carter
2021-01-06 3:08 ` Randy Brukardt
2021-01-06 9:13 ` Dmitry A. Kazakov
2021-01-07 0:17 ` Randy Brukardt
2021-01-07 9:57 ` Dmitry A. Kazakov
2021-01-07 22:03 ` Randy Brukardt
2021-01-08 9:04 ` Dmitry A. Kazakov
2021-01-08 17:23 ` Shark8
2021-01-08 20:19 ` Dmitry A. Kazakov
2021-01-09 2:18 ` Randy Brukardt
2021-01-09 10:53 ` Dmitry A. Kazakov [this message]
2021-01-12 8:19 ` Randy Brukardt
2021-01-12 9:37 ` Dmitry A. Kazakov
2021-01-09 2:31 ` Randy Brukardt
2021-01-09 14:52 ` Why UTF-8 (was Re: Lower bounds of Strings) Jeffrey R. Carter
2021-01-09 18:08 ` Dmitry A. Kazakov
2021-01-12 7:58 ` Randy Brukardt
2021-01-11 21:35 ` Lower bounds of Strings Shark8
2021-01-12 8:12 ` Randy Brukardt
2021-01-12 20:51 ` Shark8
2021-01-12 22:56 ` Randy Brukardt
2021-01-13 12:00 ` Dmitry A. Kazakov
2021-01-13 13:27 ` AdaMagica
2021-01-13 13:53 ` Dmitry A. Kazakov
2021-01-13 14:08 ` Jeffrey R. Carter
2021-01-14 11:38 ` AdaMagica
2021-01-14 12:27 ` Dmitry A. Kazakov
2021-01-14 13:31 ` AdaMagica
2021-01-14 14:02 ` Jeffrey R. Carter
2021-01-14 14:34 ` Dmitry A. Kazakov
2021-01-14 15:28 ` Shark8
2021-01-14 15:41 ` Dmitry A. Kazakov
2021-01-19 21:02 ` G.B.
2021-01-19 22:27 ` Dmitry A. Kazakov
2021-01-20 20:10 ` G.B.
2021-01-20 20:25 ` Dmitry A. Kazakov
2021-01-15 10:24 ` Stephen Davies
2021-01-15 11:41 ` J-P. Rosen
2021-01-15 17:35 ` Stephen Davies
2021-01-15 19:36 ` Egil H H
2021-01-16 12:57 ` Stephen Davies
2021-01-17 14:10 ` Stephen Davies
2021-01-19 5:48 ` Randy Brukardt
2021-01-19 6:13 ` Gautier write-only address
2021-01-15 11:48 ` Jeffrey R. Carter
2021-01-15 13:34 ` Dmitry A. Kazakov
2021-01-15 13:56 ` Stephen Davies
2021-01-15 15:12 ` Jeffrey R. Carter
2021-01-15 17:22 ` Stephen Davies
2021-01-15 21:10 ` Jeffrey R. Carter
2021-01-15 14:00 ` Stephen Davies
2021-01-16 9:30 ` G.B.
2021-01-16 13:13 ` Stephen Davies
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox