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.9 required=5.0 tests=BAYES_00 autolearn=ham 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!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newspeer.monmouth.com!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: private types Date: 26 Mar 2006 11:51:47 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> <1FqVf.641025$084.20945@attbi_s22> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1143391907 15014 192.74.137.71 (26 Mar 2006 16:51:47 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 26 Mar 2006 16:51:47 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:3632 Date: 2006-03-26T11:51:47-05:00 List-Id: "Jeffrey R. Carter" writes: > Access types are NOT in the section for scalar types (3.5); they are in > their own, separate section (3.10). Once you accept that access types > are not scalar types,... Sorry, but I don't "get" this argument. I accept that access types are not scalar types. Both are "elementary" types, however. I don't see any fundamental difference between access and scalar that would imply that uninit vars should be treated differently for the two. Of course, there are many fundamental differences, which imply a different set of operations (can't do arithmetic on access values, can't do 'Access and get an integer, etc). But there are also many things in commmon between scalar and access: both can be passed as parameters, both can be stored as record components, both are by-copy types. An uninit var should be considered a bug, whether it's access or integer. I see no fundamental difference, here. Defaulting to null hides this bug. >... arguing about the meaning of null changes. Access > types are an abstraction, and the concept of null is part of that > abstraction. In the abstraction, an access value either designates an > object or it doesn't; = null means the former and /= null, the > latter. Yes, but my claim is that that's a poorly designed abstraction. In most cases, null is just a tripping hazard. The programmer should have the choice -- access type without any special value, access type with a special value that doesn't designate anything, access type with _two_ special values, ... Ada 2005 comes closer, by having "not null" -- but the default is backwards (for obvious compatibility reasons). Note that when I declare a private type, I choose whether it should have "special" values, and what they mean. And I choose whether a special value is used as a default. I can choose to raise an exception if clients look at an uninit var. I can choose to prevent uninit vars statically, using (<>) discriminants. - Bob