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.11.199 with SMTP id s7mr25886279pbb.5.1317084066344; Mon, 26 Sep 2011 17:41:06 -0700 (PDT) Path: lh7ni5632pbb.0!nntp.google.com!news1.google.com!news2.google.com!news.glorb.com!xmission!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 20:41:05 -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> <1uqthqxzri6j3.i18ifhbwmzdc.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1317084065 7627 192.74.137.71 (27 Sep 2011 00:41:05 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 27 Sep 2011 00:41:05 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:AUCqYq0rh0ZHAOpBIA6qmg/M2j8= Xref: news1.google.com comp.lang.ada:18145 Content-Type: text/plain; charset=us-ascii Date: 2011-09-26T20:41:05-04:00 List-Id: "Dmitry A. Kazakov" writes: > 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. Yes, "not null access procedure" is annoying when I really mean "procedure". >> 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! Yes. But it's not a big deal. >> 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. Mostly true. But if the opposite of "structural typing" is "by name", then it makes no sense. There's no name for that type, here. >>> 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. Not even when the access type is finalized? > I would even provide a built-in operation Free for them. Yes, good idea. > 2. References to aliased objects, shaped more like "X renames Y", fully > statically checked. OK. > 3. "Access all" for emergency cases. Yeah, we have that one now. - Bob