comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Dereferencing and style guides
Date: Fri, 04 Oct 2013 15:22:57 +0200
Date: 2013-10-04T15:22:57+02:00	[thread overview]
Message-ID: <524ec131$0$6566$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <wccli2akvow.fsf@shell01.TheWorld.com>

On 03.10.13 21:20, Robert A Duff wrote:
> Georg Bauhaus <rm.dash-bauhaus@futureapps.de> 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...

  reply	other threads:[~2013-10-04 13:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30  6:35 Dereferencing and style guides Natasha Kerensikova
2013-09-30  7:13 ` Dmitry A. Kazakov
2013-09-30 12:51 ` Robert A Duff
2013-09-30 16:49   ` Georg Bauhaus
2013-09-30 18:18     ` Jeffrey Carter
2013-10-03 19:20     ` Robert A Duff
2013-10-04 13:22       ` Georg Bauhaus [this message]
2013-10-04 13:25         ` Georg Bauhaus
2013-10-07 16:10       ` Eryndlia Mavourneen
2013-10-08  0:48         ` Robert A Duff
2013-10-10  7:35           ` Stefan.Lucks
2013-10-10 14:48             ` Adam Beneschan
2013-10-10 22:49               ` Robert A Duff
2013-10-11  8:07                 ` Bill Findlay
2013-10-11 12:52                   ` Robert A Duff
2013-10-11 13:02                     ` G.B.
2013-10-11 13:19                     ` Bill Findlay
2013-10-19  2:40                     ` Randy Brukardt
2013-10-19  2:46                     ` Randy Brukardt
2013-10-19  2:36           ` Randy Brukardt
2013-09-30 13:53 ` Eryndlia Mavourneen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox