Mon, 29 Oct 2001 11:13:10 -0800
I don't think that your example is adequate for the new feature you
X.Ptr.all := Y.Ptr.all;
is a very dangerous statement, because X.Ptr may point to a too short
Your example is about unbounded strings that are manually finalized.
I would write them as:
package SV is
type Vstr is limited private;
procedure Assign (To : in out Vstr; From : Vstr);
function Image (Source : Vstr) return String;
type String access is access all String;
Null_String_Access : constant String_Access := new String'("");
type Vstr is record
Ptr : String_Access := Null_String_Access;
Len : Natural := 0;
Unbounded_Strings are relatively slow in Ada, because they must be
implemented as controlled objects.
If the spec above is not adequate for your example, please tell us.
-- Vincent Celier