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: Mon, 18 Jan 2021 23:48:38 -0600 Organization: JSA Research & Innovation Message-ID: References: <1cc09f04-98f2-4ef3-ac84-9a9ca5aa3fd5n@googlegroups.com> <1ea70290-a1a8-4a63-8f38-922e966084c9n@googlegroups.com> Injection-Date: Tue, 19 Jan 2021 05:48:39 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="9992"; 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; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:61170 List-Id: "Stephen Davies" wrote in message news:1ea70290-a1a8-4a63-8f38-922e966084c9n@googlegroups.com... > On Friday, 15 January 2021 at 17:35:54 UTC, Stephen Davies wrote: >> On Friday, 15 January 2021 at 11:41:24 UTC, J-P. Rosen wrote: >> > function Slide (S : String) return String is >> > (S(S'First) & S (S'First+1 .. S'Last)); >> To me, this is a fundamental enough operation that, in the absence of >> being able to specify a subtype where it happens automatically, it at >> least deserves to be an attribute. > Also, a Slide function does not work for "out" and "in out" parameters. > Admittedly, ehh.p...'s workaround does solve this, but I would prefer > a proper solution in the language, e.g. a Slide attribute that acts as a > view conversion. Thank god. Slices passed as in out parameters are the bane of the compiler-writers existence, and outside of types like String, have a very expensive implementation. On common machines like the x86, copying an arbitrary bit string from one location to another is not an easy operation to perform. (Remember, one can slice packed arrays, arrays of controlled objects, and other nasty cases. And with the sort of interface others here are proposing, you'd have to do it for various discontiguous representations, too.) This way leads to madness -- at least of compiler implementers. ;-) Randy.