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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060130 SeaMonkey/1.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: private types References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <1FqVf.641025$084.20945@attbi_s22> NNTP-Posting-Host: 12.214.35.215 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1143355069 12.214.35.215 (Sun, 26 Mar 2006 06:37:49 GMT) NNTP-Posting-Date: Sun, 26 Mar 2006 06:37:49 GMT Date: Sun, 26 Mar 2006 06:37:49 GMT Xref: g2news1.google.com comp.lang.ada:3622 Date: 2006-03-26T06:37:49+00:00 List-Id: Robert A Duff wrote: > Justin Gombos writes: >> Access types are special, and get different treatment than other >> scalars because they include in their set a representation for a null >> value. > > Yes, access types in Ada are special, because they have a special null > value. C and Pascal and so forth are similar. But it doesn't HAVE to > be that way. Some languages (SML comes to mind) do not have a special > null value provided for free -- if you want one, you declare one. > (Or, if you want two, you declare two!) I think we're missing the point. Access types are NOT scalar types in Ada. C pointers may be, since you can treat them pretty much like integers. The ARM TOC has 3.5 Scalar Types 3.5.1 Enumeration Types 3.5.2 Character Types 3.5.3 Boolean Types 3.5.4 Integer Types 3.5.5 Operations of Discrete Types 3.5.6 Real Types 3.5.7 Floating Point Types 3.5.8 Operations of Floating Point Types 3.5.9 Fixed Point Types 3.5.10 Operations of Fixed Point Types and 3.10 Access Types 3.10.1 Incomplete Type Declarations 3.10.2 Operations of Access Types 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, 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. How that is represented is an implementation detail hidden from the user. You could have something sort of equivalent to type Access_Type is private; null : constant Access_Type; private type Access_Type (Designates_Something : Boolean := False) is record case Designates_Something is when False => null; when True => Data : System.Address; -- other fields as needed end case; end record; null : constant Access_Value := (Designates_Something => False); (though I doubt any compiler actually does). Access types aren't special compared to scalar types because they're not scalar types; they're not even conceptually similar. -- Jeff Carter "I spun around, and there I was, face to face with a six-year-old kid. Well, I just threw my guns down and walked away. Little bastard shot me in the ass." Blazing Saddles 40