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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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.11.199 with SMTP id s7mr24126974pbb.5.1317065438573; Mon, 26 Sep 2011 12:30:38 -0700 (PDT) Path: lh7ni5495pbb.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!news.tornevall.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: subprogram must not be deeper than access type Date: Mon, 26 Sep 2011 21:30:35 +0200 Organization: cbb software GmbH Message-ID: <1uqthqxzri6j3.i18ifhbwmzdc.dlg@40tude.net> References: <818752663338654817.822041rmhost.bauhaus-maps.arcor.de@news.arcor.de> <15r7hdzgyr0fc.1djn7vwy23dfg$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: lNJLa/CbuNz6Q9PE6SiPyQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news1.google.com comp.lang.ada:18135 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-09-26T21:30:35+02:00 List-Id: On Mon, 26 Sep 2011 12:15:51 -0400, Robert A Duff wrote: > 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.) Yes, it would be much simpler to have subprogram types for downward closures. > Another flaw is that some types can be anonymous (task, protected, > array, access) and some can't. It should be all or nothing. I'd like to have anonymous types in record components. It is annoying not to be able to write: type Foo is record Nested : record end record; List : array (...) of ...; end record; Even C can this! > 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. But structural type matching is more wrong than that. >> 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? E.g. things on the stack. > 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. Yes. There should be: 1. Strictly heap access types, manually allocated/deallocated, no accessibility checks, no calls to Finalize outside Unchecked_Deallocation. I would even provide a built-in operation Free for them. 2. References to aliased objects, shaped more like "X renames Y", fully statically checked. 3. "Access all" for emergency cases. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de