From: steve.folly@rdel.co.uk (Steve Folly)
Subject: Access to strings and string subtypes?
Date: 2000/03/16
Date: 2000-03-16T16:33:49+00:00 [thread overview]
Message-ID: <38d10a7b.91796987@news.rrds.co.uk> (raw)
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.
next reply other threads:[~2000-03-16 0:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-16 0:00 Steve Folly [this message]
2000-03-16 0:00 ` Access to strings and string subtypes? Ehud Lamm
2000-03-16 0:00 ` Steve Folly
2000-03-17 0:00 ` Ehud Lamm
2000-03-17 0:00 ` Larry Kilgallen
2000-03-17 0:00 ` Robert Dewar
2000-03-17 0:00 ` Robert A Duff
2000-03-18 0:00 ` Robert Dewar
2000-03-20 0:00 ` Tucker Taft
2000-03-17 0:00 ` Steve Folly
2000-03-17 0:00 ` Pascal Obry
-- strict thread matches above, loose matches on Subject: below --
2000-03-17 0:00 Christoph Grein
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox