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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,803df5f3f60558d5 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Uninitialized "out" parameters Date: 1996/07/23 Message-ID: #1/1 X-Deja-AN: 169772464 references: <31EEACDA.64880EEB@sage.inel.gov> <4sq614$kai@mulga.cs.mu.OZ.AU> <4stagp$3vg@mulga.cs.mu.OZ.AU> <4t1s3n$chv@goanna.cs.rmit.edu.au> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-07-23T00:00:00+00:00 List-Id: Richard said True, Ada is so designed that sound and complete compile-time detection of using uninitialised variables is impossible. But some day Ada will have a successor. And I can see no reason why that successor should not do a better job than Ada in this respect. I doubt it, you certainly do not suggest what that better job might be. The rest of your note talks about checking that is not and cannot be completely statically reliable. As for practical tools, any good Ada compiler should indeed warn of many common cases, and tools analogous to lclint are perfectly possible with Ada, and/or should be built into the Ada compiler. Dynamic bounds of arrays do not help in compile time legality checking, so I don't see what relevance they have. And yes, container types are certainly appropriate (after all see Bounded_String, which is exactly what you are talking about), but again, this has nothing to do with compile time legality requirements. Let's try to focus a specific example, the one I gave before, and you tell me how your improved approach will work at compile time to detect as illegalities all references to uninitialized elements. I have an array of 2 gigabytes in an allocate-on-demand environment. I use this as a sparse hash table, but it is critical that only pages that are actually used get referenced, so it is out of the question to initialize the table. How do I make sure that references to this array correspond to previously set elements? Even doing this at runtime is awkward, but I see no way of designing a type system or any other semantic framework to solve this at compile time as a legality issue. It is not good enough to just say "we should do better", you have to say *exactly* how you can do better, or your position is unconvincing. After all, this is an old problem that has not been solved for 38 years now (I am counting from Algol-58, it is a bit longer if you count from the first Fortran), so if you have a solution, it would be nice to present it!