I've had this happen with DEC Pascal too.
Limiting accessible record components seems useful, but in your example, what if aType changes from Circle to Rect. Does a previously set value for Radius become inaccessible? If aType returns to Circle, is the value erased or is the previous value accessible once again?
Regards David Wood
-----Original Message----- From: Eike Lange [mailto:eike.lange@uni-essen.de] Sent: Tuesday, November 19, 2002 9:11 AM To: Subject: Probs with variant records
Hi Folks!
I'm not sure wether it's a feature or a bug but I've read, that setting a case selector in variant records makes some variants unavailable from this point. The following program demonstrates, that setting a case selector allows further overwriting of unselected variants:
program Fail3;
type TGeoType = (Circle, Rect); TGeometry = record X, Y: Integer; case aType: TGeoType of Circle: (Radius: Integer); Rect: (Width, Height: Integer) end;
var Geometry: TGeometry;
begin with Geometry do begin X := 10; Y := 20; aType := Rect; Radius := 30; Width := 40; Height := 50 end end.
Version: ======== Reading specs from /usr/local/bin/../lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs gpc version 20021111, based on gcc-2.95.2 19991024 (release)
Eike
The Information contained in this E-Mail and any subsequent correspondence is private and is intended solely for the intended recipient(s). For those other than the recipient any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on such information is prohibited and may be unlawful.