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: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: Uninitialized "out" parameters Date: 1996/07/24 Message-ID: <4t5c1r$g4o@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 170531317 references: <31EEACDA.64880EEB@sage.inel.gov> <4stagp$3vg@mulga.cs.mu.OZ.AU> <4t2gb4$a10@mulga.cs.mu.OZ.AU> organization: Comp Sci, University of Melbourne newsgroups: comp.lang.ada Date: 1996-07-24T00:00:00+00:00 List-Id: bobduff@world.std.com (Robert A Duff) writes: >Fergus Henderson wrote: >>But, even without seeing your example, I'm pretty confident that a >>statically decidable system could handle those sorts of thing. > >In general? I skept. Well, the justification is the following theorem, which you agree with: >>In fact, for any given set of examples, there is _guaranteed_ to be >>_some_ statically decidable system which handles those examples! > >True, but the compiler has to know about those examples, or at least >that sort of example. Right. I didn't say that such a system would necessary be useful: >>Whether such a system could also be useful, orthogonal, practical, etc. >>is of course another question; we'd have to see the examples in >>question to be able to judge. So what I'm saying is that it is possible in principle. I think it remains to be seen whether it would be of net benefit in practice. But I think it's certainly something worth exploring. >I still prefer run-time checks in this case. For scalars, static checks should work fine. (One potential difficulty is that for global variables you would need to do global analysis; that would make implementation more difficult in a standard separate compilation environment, but shouldn't pose any fundamental problems. I suppose tasking might also complicate things; I haven't thought about how tasking would interact with this sort of static checking.) Static checks should probably also work fine for records. (Some sort of extended mode system would help for record parameters, so that one could specify that this field has mode `in', and that field has mode `out', rather than having to give a single mode to the whole record.) For arrays, it should be possible to statically verify common patterns of array initialization. For complicated patterns of array initialization, it would be possible to use run-time checks, but run-time checks don't seem to have much advantage over simply requiring the user to pre-initialize the whole array. -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.