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=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!aioe.org!qYcU9JfyUhY8OJVCu5UZdA.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: String view of file Date: Mon, 21 Nov 2022 16:18:48 +0100 Organization: Aioe.org NNTP Server Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="9692"; posting-host="qYcU9JfyUhY8OJVCu5UZdA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:64649 List-Id: On 2022-11-21 09:30, Jesper Quorning wrote: > Is it possible to write something like this with ADA > > ```Ada > package my_rw_file is new file > (name => "whatever" > ,mode => read_write > ,implementation => standard -- or portable or fast > ); > package as_string is new. xxx(from => my_rw_file); > > -- parse (as_string); > package data is new parse (as_string, format => markdown); -- or whatever It is difficult to guess what you want to achieve. What it looks to me is a design opposite to the customary approach: abstract code source (generic and/or tagged) / | \ / | \ string text_file stream Since string and file cannot be derived, in a tagged case some mix-in is used. The parser from simple-components has multi-line and single-line sources. A single-line source can be set on a string. Multi-line source is for files and streams. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de