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.6 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, HK_RANDOM_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ec21c3c7cdc7ff3e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!cycny01.gnilink.net!spamkiller.gnilink.net!gnilink.net!trnddc07.POSTED!20ae255c!not-for-mail Newsgroups: comp.lang.ada From: Justin Gombos Subject: Re: private types References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> User-Agent: slrn/0.9.8.1 (Linux) Message-ID: Date: Fri, 17 Mar 2006 23:36:05 GMT NNTP-Posting-Host: 129.44.77.228 X-Complaints-To: abuse@verizon.net X-Trace: trnddc07 1142638565 129.44.77.228 (Fri, 17 Mar 2006 18:36:05 EST) NNTP-Posting-Date: Fri, 17 Mar 2006 18:36:05 EST Xref: g2news1.google.com comp.lang.ada:3413 Date: 2006-03-17T23:36:05+00:00 List-Id: On 2006-03-17, Maciej Sobczak wrote: > > So you have the whole pragma as such "disservice": > > http://www.adaic.org/standards/95aarm/html/AA-H-1.html I don't have a problem with implicit initializations when the compiler can ensure a bad value (or "abnormal object", to use the language of the ARM). I was responding to Brian May's comment about compilers implicitly assigning "dummy values", which did not sound to me like values that are intelligently selected to be invalid for the type. I've heard of compilers implicitly initializing to zero, and figured that was what he might be advocating. BTW- I sometimes have a use for creating an abnormal object, and find Ada lacking in not providing such a mechanism. I'm sometimes forced to either include abnormal values in the set of values declared for a type, or to have a seperate flag. Both of these are messy. Why not have a 'invalid function added to Ada to enable simple and explicit initialization of abnormal objects? > Right. Then, why not minimize the scope of the object to the extent > when it's never even visible before being initialized with the value > that is meaningful in the given context? It's not always possible, > of course, but in many (most?) cases programmers tend to put all > variables at the beginning of some rather coarse-grained scope (for > example, beginning of the procedure or function), and later wonder > what is the "right" initial value for them. It's the misplacement of > declaration that is a primary source of problems and this is what > should be actually addressed. I agree. Declare blocks can eliminate some of these issues. I like the fact that declare blocks enable me to declare more constants than variables. But it's not a full solution. The opposite extreme of this would be to introduce a declare block at every introduction of a new object, which can obviously become detrimental to readability. It's a trade off that requires judgement - judgement that is unequal among adaists. > Single entry - single exit syndrome? :) Yes, I have that syndrome. I think I acquired it from the Ada Quality and Style Guide or a coding standard that I followed at one point. -- PM instructions: do a C4esar Ciph3r on my address; retain punctuation.