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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!ecngs!feeder2.ecngs.de!newsfeeder.ewetel.de!eweka.nl!lightspeed.eweka.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 04 Oct 2013 15:22:57 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Dereferencing and style guides References: <5249ab97$0$6625$9b4e6d93@newsspool2.arcor-online.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <524ec131$0$6566$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 04 Oct 2013 15:22:57 CEST NNTP-Posting-Host: 5f0fa481.newsspool4.arcor-online.net X-Trace: DXC=HigoW\E0W^A02Sh8E_NfIA4IUKejVHGfl`;4?1H9@:hkX6GZ=d1M X-Complaints-To: usenet-abuse@arcor.de Xref: news.eternal-september.org comp.lang.ada:17396 Date: 2013-10-04T15:22:57+02:00 List-Id: On 03.10.13 21:20, Robert A Duff wrote: > Georg Bauhaus writes: > >> On 30.09.13 14:51, Robert A Duff wrote: >>> However, the ".all" syntax is just plain weird. "All what?" It makes >>> no sense to me. >> >> I take it you are deliberately being forgetful? ;-) >> >> All what? All [components] of the referenced object, of course. > > Still makes no sense to me. X.all does not denote "all the components > of X". It denotes the object that X designates. > Every name that denotes ANY object denotes all of it. We do get both explicit_dereference and implicit_dereference, which is where points of view are starting to differ, I think. If the object named X is a pointer, it points to another object Y, and lets me refer to/designate Y if I use X in a dereferencing context. Then, X.foo as in many languages, Java, say, is a normal way of referring to that part of Y named "foo". Ada, too, allows referring to parts of pointed-to objects by using that same notation. Then, rather than X.foo, X.all.foo is really a weird construct, somewhat like saying (*X).foo in C, not X->foo. Just telling how I have found explanations of ".all" plausible. There is implicitness in Ada, and I guess they thought there would be uses. > And what if X.all is an Integer, so it has no components. "All of whatever the access value designates", as Jeffrey Carter has put it. For example, it designates not one of the integer's attributes, but the entire thing itself. If X is an "access function", I can also refer to one of the function's components, using one of the pairs in its (Dom -> Ran). For 0-ary functions, with Dom = ∅, I can only legally say Result := X.all; reflecting the potential weirdness of 0-ary functions. I cannot write "X.all" alone if the designated function has a non-empty domain---Ada does not have function values. If X points to a singulary function, I can write a sum of two function values as X (L) + X (R) or as X.all (L) + X.all (R). How should I read this, without dragging in just means of implementation? "X (L)" selects the pair from (Dom -> Ran) that has L in Dom, just as if X were to designate the function's set of pairs, directly, and much as if X were an array, "X.all (L)", OTOH, selects all pairs from (Dom -> Ran) and then picks the one that has L in Dom. I think that this is one possible reading, > For an access-to-array, should it be X(all)? No, just X.all, as X(Whatever) calls for implicit_dereference. "()" and "." signify the different styles of referring to components of arrays/functions and records/etc, respectively. > No, sorry, I think the ".all" syntax is just plain weird. > >> In true Ada, an plain old object is the only kind of entity that >> should ever need access through an access value! > > Not sure what you mean. If the environment of Ada programs were less C-ish, if Ada had been more wide-spread, I guess, then there would not be so many access-to-subp etc. The pointers are, in many cases, just artifacts of implementation. Passing subprograms statically would instead use a mechanism that names the subprograms directly...