From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.8 required=3.0 tests=BAYES_50,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:908:b0:6fc:c237:be0e with SMTP id v8-20020a05620a090800b006fcc237be0emr1261169qkv.213.1672616219408; Sun, 01 Jan 2023 15:36:59 -0800 (PST) X-Received: by 2002:ac8:6eca:0:b0:3a9:68ba:4c10 with SMTP id f10-20020ac86eca000000b003a968ba4c10mr1292890qtv.676.1672616219182; Sun, 01 Jan 2023 15:36:59 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 1 Jan 2023 15:36:59 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=194.255.97.108; posting-account=hMbstgoAAAAIa4kxFYtvUVUHbE1RcZzT NNTP-Posting-Host: 194.255.97.108 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <10f5dfec-32fb-4333-a9b6-2ee71c1871c0n@googlegroups.com> Subject: Re: String view of file From: Jesper Quorning Injection-Date: Sun, 01 Jan 2023 23:36:59 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:64765 List-Id: The original post was a bit of a mess, and I am not quite new to Ada. But I lack some skills regarding software construction and software engineering. What I want goes something like this: - Zero copy access to a (read-only) file. - Get lines of file one by one as a stream of lines. - Use a package instance as file representation. - Stretch goal: Multiple implementations of File Instance (Standard, Fast, Compatible ..) Refined version: ```Ada package File is new File_Instance (Filename => "whatever", Implementation => Standard); --- for Line of File.As_Line_Stream loop Parse (Line); end loop; ``` I think Dewar has written something about string view of some data. I saw some tricky tricks in the GNAT.Snobol implementation. Links to papers anyone? Sorry for the late follow-up. /Jesper