help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <>
Subject: Re: String view of file
Date: Mon, 21 Nov 2022 17:42:56 +0100	[thread overview]
Message-ID: <tlg9qg$3q8j4$> (raw)
In-Reply-To: <>

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.

If access types are used, they should be hidden and encapsulated with their 
memory management. This makes it easier to get the memory management correct. 
Since this is what using Unbounded_String does for you, I think it's better to 
use it than to expend extra effort doing something similar.

Jeff Carter
"I have a very small head and I had
better learn to live with it ..."
Edsger Dijkstra

  reply	other threads:[~2022-11-21 16:42 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 [this message]
2022-11-21 17:29       ` Niklas Holsti
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