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,73175d2d01a1b1dd X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.38.134 with SMTP id g6mr23113209pbk.6.1317053752535; Mon, 26 Sep 2011 09:15:52 -0700 (PDT) Path: lh7ni5404pbb.0!nntp.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-out.readnews.com!transit3.readnews.com!panix!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: subprogram must not be deeper than access type Date: Mon, 26 Sep 2011 12:15:51 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <818752663338654817.822041rmhost.bauhaus-maps.arcor.de@news.arcor.de> <15r7hdzgyr0fc.1djn7vwy23dfg$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1317053752 7615 192.74.137.71 (26 Sep 2011 16:15:52 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 26 Sep 2011 16:15:52 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:e46KBBbC+EQphZ0aD89Mdlb3LJU= Xref: news1.google.com comp.lang.ada:18131 Content-Type: text/plain; charset=us-ascii Date: 2011-09-26T12:15:51-04:00 List-Id: "Dmitry A. Kazakov" writes: > On Mon, 26 Sep 2011 09:43:07 -0400, Robert A Duff wrote: > >> Natasha Kerensikova writes: >> >>> Having read the Rationale 2005, I understand now that naming an access >>> type is far from being equivalent to text replacement. >> >> Yeah. That's a language design flaw. > > What is the flaw, naming or having it anonymous? In my opinion, if anonymous types are allowed, they should behave exactly like named types. In the case of access types, I mean "exactly like a named type declared immediately after the designated [sub?]type". (There's an obscure issue, in the case where the designated subtype is more nested than the designated type, and depends on nested data. I'm not sure how to solve that; perhaps just forbid it.) The flaw I was referring to was that Ada doesn't have that equivalence. Making an access type anonymous invokes all sorts of magical semantics, which is confusing. If such magical semantics are desirable, they should be invoked by some other syntax. (And by the way, I don't think run-time accessibility checks are desirable. That's another design flaw.) Another flaw is that some types can be anonymous (task, protected, array, access) and some can't. It should be all or nothing. And it's just weird that if you say "X, Y : array...;" "X := Y;" and "if X = Y ..." are illegal. Textual replacement is a wrong way to define semantics. > I think that the problem is that access types to automatically collected > objects and access types to the objects allocated and freed dynamically > should be different, if the former could not be eliminated at all. Not sure what you mean by "automatically collected". Local to a procedure? Or are you talking about garbage collection? What about library-package-body variables? What about components of variables? Ada 83 required all access values to point to heap-allocated objects. Ada 95 added "access all", which allows pointing at any aliased object. That's sort of similar to the distinction you're making, I think. - Bob