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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d8aa0b11d3c79b63,start X-Google-Attributes: gid103376,public From: steve.folly@rdel.co.uk (Steve Folly) Subject: Access to strings and string subtypes? Date: 2000/03/16 Message-ID: <38d10a7b.91796987@news.rrds.co.uk>#1/1 X-Deja-AN: 598350423 X-Complaints-To: postmaster@rdel.co.uk X-Trace: rdel.co.uk 953224429 9485 172.16.115.146 (16 Mar 2000 16:33:49 GMT) Organization: RDEL NNTP-Posting-Date: 16 Mar 2000 16:33:49 GMT Newsgroups: comp.lang.ada Date: 2000-03-16T16:33:49+00:00 List-Id: Could someone explain why this code doesn't work. I know the LRM reference that prevents it, but, in laymans terms, please explain *why* :-) package Test is type Ref is access all String; subtype Name is String(1..10); type Name_Ref is access all Name; A : aliased Name; C : aliased String (1..10); D : Name_Ref := A'Access; -- OK E : Ref := A'Access; -- Does not statically match designated subtype ??? F : Ref := C'Access; -- Does not statically match designated subtype ??? G : Ref := new String'("THIS WORKS"); -- OK! end Test; I would have expected a Ref type to be able to point to any constrained string type. Why are subtypes not allowed? We have various classes defined with strings of different sizes, but would like a single function to be able to take any one of these strings and manipulate it, possibly changing it's contents. Thanks. Steve Folly.