comp.lang.ada
 help / color / mirror / Atom feed
* Why can't Ada use dot notation on private types?
@ 2017-02-05 14:17 Lucretia
  2017-02-05 15:31 ` Dmitry A. Kazakov
  2017-02-06 19:40 ` Randy Brukardt
  0 siblings, 2 replies; 7+ messages in thread
From: Lucretia @ 2017-02-05 14:17 UTC (permalink / raw)


Hi,

A lot of people dislike the fact that you cannot use dot notation on a tagged type if it's private. Is there a reason for this? Surely the compiler knows it's tagged when it looks it up?

Luke.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why can't Ada use dot notation on private types?
  2017-02-05 14:17 Why can't Ada use dot notation on private types? Lucretia
@ 2017-02-05 15:31 ` Dmitry A. Kazakov
  2017-02-06 19:44   ` Randy Brukardt
  2017-02-06 19:40 ` Randy Brukardt
  1 sibling, 1 reply; 7+ messages in thread
From: Dmitry A. Kazakov @ 2017-02-05 15:31 UTC (permalink / raw)


On 2017-02-05 15:17, Lucretia wrote:

> A lot of people dislike the fact that you cannot use dot notation on
> a  tagged type if it's private. Is there a reason for this? Surely the
> compiler knows it's tagged when it looks it up?

I don't know why it is tied to certain types.

Surely it is a syntactic property of an argument of a subprogram. It 
must be user-defined.

There is nothing here specific for tagged types, except that for a 
primitive operation all its instances could share the property if the 
argument is controlling, which again, is merely a convenience rule.

P.S. if Ada had record type interface, member operations would be a part 
of the interface. No magic needed.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why can't Ada use dot notation on private types?
  2017-02-05 14:17 Why can't Ada use dot notation on private types? Lucretia
  2017-02-05 15:31 ` Dmitry A. Kazakov
@ 2017-02-06 19:40 ` Randy Brukardt
  1 sibling, 0 replies; 7+ messages in thread
From: Randy Brukardt @ 2017-02-06 19:40 UTC (permalink / raw)


"Lucretia" <laguest9000@googlemail.com> wrote in message 
news:d1956163-4a96-4e39-97d5-0a516e9a954c@googlegroups.com...
> Hi,
>
> A lot of people dislike the fact that you cannot use dot notation on a 
> tagged type if it's private.
> Is there a reason for this? Surely the compiler knows it's tagged when it 
> looks it up?

That would be privacy breaking, of course: the legality of the source would 
depend upon the private details.

But of course it is legal if you have a tagged private type. (Once done, of 
course, the fact that the type is tagged is visible.) Completing an untagged 
private type with a tagged type causes various semantic issues, so I'd 
recommend against that anyway.

                            Randy.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why can't Ada use dot notation on private types?
  2017-02-05 15:31 ` Dmitry A. Kazakov
@ 2017-02-06 19:44   ` Randy Brukardt
  2017-02-06 20:27     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Brukardt @ 2017-02-06 19:44 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:o77gh4$6vf$1@gioia.aioe.org...
> On 2017-02-05 15:17, Lucretia wrote:
>
>> A lot of people dislike the fact that you cannot use dot notation on
>> a  tagged type if it's private. Is there a reason for this? Surely the
>> compiler knows it's tagged when it looks it up?
>
> I don't know why it is tied to certain types.

That was the original idea. But we ran into semantic problems with 
elementary types (and private types completed with elementary types), so we 
ended up restricting it to tagged only. (The usual reason applied here: it's 
better to get a limited version of a feature right -- it can be expanded 
later if necessary -- that to get a general version of a feature wrong --  
because then we're stuck with the mistakes forever.)

The problems mainly come from the possibility of implicit .all and 'Access. 
I personally think we could have done without the later, but the former is 
traditional Ada semantics which would be weird to not support in this prefix 
form.

                                                 Randy.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why can't Ada use dot notation on private types?
  2017-02-06 19:44   ` Randy Brukardt
@ 2017-02-06 20:27     ` Dmitry A. Kazakov
  2017-02-08 23:26       ` Randy Brukardt
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry A. Kazakov @ 2017-02-06 20:27 UTC (permalink / raw)


On 2017-02-06 20:44, Randy Brukardt wrote:

> The problems mainly come from the possibility of implicit .all and 'Access.

Perfect, why is this a problem? It is just what is needed. I want to 
override "all", so let me do this.

P.S. Ampersand notation must be definable just like dot notation is.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why can't Ada use dot notation on private types?
  2017-02-06 20:27     ` Dmitry A. Kazakov
@ 2017-02-08 23:26       ` Randy Brukardt
  2017-02-09  8:47         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 7+ messages in thread
From: Randy Brukardt @ 2017-02-08 23:26 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:o7am71$13o1$1@gioia.aioe.org...
> On 2017-02-06 20:44, Randy Brukardt wrote:
>
>> The problems mainly come from the possibility of implicit .all and 
>> 'Access.
>
> Perfect, why is this a problem? It is just what is needed. I want to 
> override "all", so let me do this.

When elementary types are included in prefix notation, there are potentially 
an infinite number of implicit .all or 'Access combinations. A compiler 
would have trouble figuring them out (aand it could get *very* expensive), 
and a reader would be even more confused.

                                  Randy.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why can't Ada use dot notation on private types?
  2017-02-08 23:26       ` Randy Brukardt
@ 2017-02-09  8:47         ` Dmitry A. Kazakov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry A. Kazakov @ 2017-02-09  8:47 UTC (permalink / raw)


On 09/02/2017 00:26, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:o7am71$13o1$1@gioia.aioe.org...
>> On 2017-02-06 20:44, Randy Brukardt wrote:
>>
>>> The problems mainly come from the possibility of implicit .all and
>>> 'Access.
>>
>> Perfect, why is this a problem? It is just what is needed. I want to
>> override "all", so let me do this.
>
> When elementary types are included in prefix notation, there are potentially
> an infinite number of implicit .all or 'Access combinations. A compiler
> would have trouble figuring them out (aand it could get *very* expensive),
> and a reader would be even more confused.

".all" and "'Access" have an argument and a result. It is a classic MD 
case. Upon overriding it must be clear that this happens for a given 
type of the argument (e.g. object type) and a given type of the result 
(e.g. access type). The compiler can select an implementation in a usual 
manner and then look if that one has been overridden in the given context.

Actual problems are with tagged types, because full MD is not supported. 
But that is nothing new. User-defined assignment is also a MD operation 
and Ada's 95 controlled-types kludge does not work right for it either.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-02-09  8:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-05 14:17 Why can't Ada use dot notation on private types? Lucretia
2017-02-05 15:31 ` Dmitry A. Kazakov
2017-02-06 19:44   ` Randy Brukardt
2017-02-06 20:27     ` Dmitry A. Kazakov
2017-02-08 23:26       ` Randy Brukardt
2017-02-09  8:47         ` Dmitry A. Kazakov
2017-02-06 19:40 ` Randy Brukardt

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