From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Lower bounds of Strings Date: Thu, 7 Jan 2021 16:03:51 -0600 Organization: JSA Research & Innovation Message-ID: References: <1cc09f04-98f2-4ef3-ac84-9a9ca5aa3fd5n@googlegroups.com> Injection-Date: Thu, 7 Jan 2021 22:03:52 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="7055"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:61061 List-Id: "Dmitry A. Kazakov" wrote in message news:rt6ltg$922$1@gioia.aioe.org... ... > No, one should have interfaces for such operations as well. You're again losing sight of the ultimate goal here, which is to have a conventionally compiled language that works close to the metal for high performance. (And is compatible with embedded systems, runable from ROM, etc.) Interfaces of any kind are completely counter to that goal, *especially* in the case of arrays/vector containers. Any sort of multiple inheritance (not to mention multiple dispatch) requires searching a lookup table for the appropriate interface. That is unaccepably expensive for an operation as basic as array indexing. One could use just-in-time compilation and similar techniques to reduce those costs, but those sort of things are not usable in a ROM environment and are much more appropriate for a language like Python. If you aren't using the interface as such (that is, with some form of dispatching), then it is simply a complication with no semantic meaning. There's no problem thinking about concepts as some sort of logical interface, but it is a distinction without meaning in that case. (By that logic, Ada 202x has interfaces for Image, indexing, dereferencing, literals, and streaming that can be applied to any tagged type.) So either you are talking about a complication without value, or an extremely expensive implementation that doesn't meet the goals for a language like Ada. What's the point? BTW, you have yet to show me any useful example that you can't reasonably do with a bounded vector (assuming that vector supports any discrete index type). For almost any possible language feature, there's always some example where it works better than the alternative using the basic features of the language. But that's not the question, the question is whether it is worth it in terms of language complexity, opportunity cost (time spent implementing feature X is time not spent on features A, B, and C), and usability (too many special case features make it harder to learn and use a language). Slices fall on the wrong side of this boundary for me; the nonsense required to implement them seems reasonable at first but rapidly disappears as of the many other things that cannot be done in their presense. And they're mainly useful for strings, which are not arrays to begin with. > You cannot do that with a single type and single dispatch. Exactly my point. The implementation of multiple inheritance and multiple dispatch is simply too expensive for a language like Ada, and that's especially true in the case of basic building blocks like arrays/vectors. The language you want is not feasible to implement IMHO. A language without a feasible implementation doesn't exist practically, and there's little sense in talking about it. Randy.