From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6d748e86b56b1269 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-27 14:32:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!mtvwca1-snh1.ops.genuity.net!chcgil2-snh1.gtei.net!news.gtei.net!wn12feed!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Reply-To: "James S. Rogers" From: "James S. Rogers" Newsgroups: comp.lang.ada References: <5ad0dd8a.0301270746.6ad4c4b0@posting.google.com> Subject: Re: Prefix to 'ACCESS must either statically match... But why? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: Date: Mon, 27 Jan 2003 22:32:15 GMT NNTP-Posting-Host: 12.86.33.178 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1043706735 12.86.33.178 (Mon, 27 Jan 2003 22:32:15 GMT) NNTP-Posting-Date: Mon, 27 Jan 2003 22:32:15 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:33467 Date: 2003-01-27T22:32:15+00:00 List-Id: If you want to use a more general access to string try using an access to an unbounded string. See the following: -- Array Access Test with Ada.Text_Io; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure Array_Access_Test is type String_Access is access all String; type Unbounded_Access is access all Unbounded_String; procedure Print ( Item : in String_Access ) is begin Ada.Text_Io.Put_Line(Item.All); end Print; procedure Print(Item : in Unbounded_Access) is begin Ada.Text_Io.Put_Line(To_String(Item.All)); end Print; Name : aliased String := "Jim Rogers"; Name2 : aliased Unbounded_String := To_Unbounded_String ("Jim Rogers"); Sa : String_Access; Ua : Unbounded_Access; begin Sa := Name'access; Print(Sa); Ua := Name2'access; Print(Ua); end Array_Access_Test; Passing around an access to an unbounded string has none of the limitations you are finding with fixed strings. You do not create a new subtype for the unbounded string type whenever you create an instance. The subtype is always constant. Jim Rogers "Wojtek Narczynski" wrote in message news:5ad0dd8a.0301270746.6ad4c4b0@posting.google.com... > Theoretically all clear, practically - major bummer. > > Looks like this used to work in some older version of GNAT: > > type String_Access is access all String; > S : aliased String (1 .. 10); > > ... > > declare > subtype S_Access is String_Access (S'Range); > SA : S_Access := S'Access; > begin > > (From this thread: > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&frame=right > &th=1de133c02ad2b2d3&seekm=m3ogiofyua.fsf%40mheaney.ni.net#link1) > > But now it doesn't with current (3.15p) GNAT nor current Aonix. Other > variants I could think of don't work either. > > At present I can't come up with any idea on how to obtain a compatible > access subtype. > > Regards, > Wojtek