comp.lang.ada
 help / color / mirror / Atom feed
From: seas.gwu.edu!mfeldman@uunet.uu.net  (Michael Feldman)
Subject: Re: Uninitialized subtype variables
Date: 23 Oct 92 20:43:05 GMT	[thread overview]
Message-ID: <1992Oct23.204305.27291@seas.gwu.edu> (raw)

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."
------------------------------------------------------------------------

             reply	other threads:[~1992-10-23 20:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-10-23 20:43 Michael Feldman [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-10-27  1:26 Uninitialized subtype variables Robert I. Eachus
1992-10-27  1:22 munnari.oz.au!ariel!ucsvc.ucs.unimelb.edu.au!phillip.edu.au!dale
1992-10-25 11:37 math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!seunet!enea!s
1992-10-24 18:44 Alex Blakemore
1992-10-23 16:49 cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!falis
1992-10-22 17:38 bloom-picayune.mit.edu!enterpoop.mit.edu!snorkelwacker.mit.edu!tamsun.tam
1992-10-22 13:46 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!wupost!micro-heart-of-gold.m
1992-10-21 23:47 Richard Pattis
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox