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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!spool.mu.edu!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.ada Subject: Re: Pre-condition vs. Post-condition Message-ID: <5070@goanna.cs.rmit.oz.au> Date: 26 Mar 91 10:21:36 GMT References: <20600091@inmet> <23141@as0c.sei.cmu.edu> <2918@sparko.gwu.edu> Organization: Comp Sci, RMIT, Melbourne, Australia List-Id: In article , jls@rutabaga.Rational.COM (Jim Showalter) writes: > I was one of the submitters to 9x of the proposal that all types > have default initialization. This seems so obviously right I > can't see why it wouldn't survive review. Why should records > be singled out for special treatment? It is obviously a good idea to make the language consistent with itself. I must admit, though, that I really like Dijkstra's notation, in which it is simply impossible to have an uninitialised variable, the language (and the array data structure) being designed that every "location" has to be initialised explicitly before it can come into existence. I recently spent rather more time than I wanted to helping someone fix a C program. We eventually discovered that an initialisation routine that had the job of allocating a bunch of arrays was being called BEFORE the global variables with the desired array sizes were initialised. Now C has this helpful little rule that global variables are initialised to 0 (0.0, NIL, ASCII.NUL, FALSE, or whatever the equivalent happens to be). Precisely *because* the variables were initialised to a "sensible" value the error was unexpectedly hard to detect. I would rather see features that help people detect or avoid the error of using an uninitialised variable rather than features which define the problem away. For example, if arrays with fill pointers were a standard part of the language (perhaps defined as a standard package), then we'd be close enough to Dijkstra's arrays to get some of the protection without being too far from the kind of array already present. Don't expect default initial values for types to be an unmixed blessing. -- Seen from an MVS perspective, UNIX and MS-DOS are hard to tell apart.