From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 23 Oct 92 20:43:05 GMT From: seas.gwu.edu!mfeldman@uunet.uu.net (Michael Feldman) Subject: Re: Uninitialized subtype variables Message-ID: <1992Oct23.204305.27291@seas.gwu.edu> List-Id: In article <1992Oct22.134607.17193@inmet.camb.inmet.com> stt@spock.camb.inmet.c om (Tucker Taft) writes: [good stuff deleted] > >It's a bag of worms, but we are still trying to do something about it ;-). >Uninitialized scalar variables are one of the few "holes" left in the >Ada safety net, and it would be nice to somehow narrow the hole a bit. >Of course, some kind of "pragma SUPPRESS" should be provided to rip >it open again on user request, but we would like the RM to specify >essentially "safe" semantics as the default, presuming it can >be done without unduly complicating the semantics nor significantly >hurting code quality. At the very least, allow some sort of programmer-specified initialization for all types, including scalar types. I know there are some tricky problems with this, but inituitively there ought to be a way to make it work (maybe restrict initializations of this kind to be static). In Ada83, the only types for which I can supply initializers are record types; wrapping a record around a scalar type just so I can initialize it is rather too kludgy for my taste. Better that I can say: SUBTYPE Little IS Integer RANGE -10..10 := -10; or even TYPE Vector IS ARRAY (Integer RANGE <>) OF Float := (OTHERS => 0.0); Even with this unconstrained type, surely the compiler can defer the initialization till object allocation time. At one point this was to be in Ada-9X but was eliminated at some stage. We've been around this loop before, and I know there are some sticky situations, but as I recall they were rather pathological, so perhaps the rules could be written to end-run them. From a teachability point of view, this uniformity would be a big winner. Comments, Tucker? Mike Feldman ------------------------------------------------------------------------ Michael B. Feldman co-chair, SIGAda Education Committee Professor, Dept. of Electrical Engineering and Computer Science School of Engineering and Applied Science The George Washington University Washington, DC 20052 USA (202) 994-5253 (voice) (202) 994-5296 (fax) mfeldman@seas.gwu.edu (Internet) "Americans wants the fruits of patience -- and they want them now." ------------------------------------------------------------------------