From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: String view of file
Date: Mon, 21 Nov 2022 19:29:12 +0200 [thread overview]
Message-ID: <ju1qr8Fhfo4U2@mid.individual.net> (raw)
In-Reply-To: <tlg9qg$3q8j4$2@dont-email.me>
On 2022-11-21 18:42, Jeffrey R.Carter wrote:
> On 2022-11-21 16:52, Niklas Holsti wrote:
>>
>> For the OP's benefit (Jeffrey of course knows this): an alternative to
>> Unbounded_String is to allocate the Result string on the heap, and
>> return an access to the heap string. With that method, you can still
>> read the entire string with one call of FAS_IO.Read instead of
>> Character by Character.
>
> I know it, and I deliberately reject it. Having access types in a pkg
> spec is poor design. Delegating the associated memory management and all
> its opportunities for error to the pkg client is very poor design.
I agree in general, but there are design trade-offs that depend on
issues not made clear in the original question, such as the size of the
file and the performance requirements. So I thought that the OP should
know of the heap alternative, even if it has some poorer properties too.
next prev parent reply other threads:[~2022-11-21 17:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 8:30 String view of file Jesper Quorning
2022-11-21 13:01 ` G.B.
2022-11-21 13:48 ` Jeffrey R.Carter
2022-11-21 15:52 ` Niklas Holsti
2022-11-21 16:42 ` Jeffrey R.Carter
2022-11-21 17:29 ` Niklas Holsti [this message]
2022-11-21 15:18 ` Dmitry A. Kazakov
2022-11-21 16:11 ` Marius Amado-Alves
2022-11-21 17:29 ` Qunying
2022-11-21 21:43 ` Gautier write-only address
2023-01-01 23:36 ` Jesper Quorning
2023-01-02 18:57 ` Stephen Leake
2023-01-03 16:37 ` Jeffrey R.Carter
2023-01-03 17:02 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox