comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Instantiating private types with discriminants?
Date: Fri, 12 May 2006 09:37:20 +0200
Date: 2006-05-12T09:37:21+02:00	[thread overview]
Message-ID: <2l9uhyhkrquy.1rbhnqk1k2u52$.dlg@40tude.net> (raw)
In-Reply-To: wccody4lfh2.fsf@shell01.TheWorld.com

On 11 May 2006 11:59:37 -0400, Robert A Duff wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

>> You don't need "all" here:
>> 
>>    Iterator := Iterator.Next;
>> 
>> Ada's pointers are transparent to record member/discriminant and array
>> element (indexing) access.
> 
> Syntactically transparent, but not semantically.  If the ".all" syntax
> weren't so darn ugly, I would recommend always using an explicit
> dereference.  I believe there's an option in GNAT (a Restriction
> pragma?) that allows you to force yourself to always say ".all",
> which might not be a bad idea.

I beg to disagree. Semantic difference you are talking about is not always
the problem space's one. It is often just a language artefact. In my view,
exactly the opposite should be done, i.e. removing all traces of "all".
(:-)) A user-defined pointer (referential) type should (IMO) be considered
a subtype, that inherits all operations of the target type. If assignment
gets overridden (to have shallow copy semantics), that does not
automatically imply anything for other operations.

Also, a good design should have as a goal preventing visibility of both the
target type if its referential counterpart in client contexts. So if
references are needed then the target type should be private. That would
exclude any misunderstandings about semantics of a given operation.

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



  reply	other threads:[~2006-05-12  7:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-09 13:17 Instantiating private types with discriminants? rick H
2006-05-09 13:45 ` Georg Bauhaus
2006-05-09 14:06   ` rick H
2006-05-09 13:56 ` Ludovic Brenta
2006-05-09 14:24   ` rick H
2006-05-09 19:48     ` Ludovic Brenta
2006-05-09 14:05 ` Dmitry A. Kazakov
2006-05-09 14:48 ` rick H
2006-05-09 15:20   ` Jerry Petrey
2006-05-09 15:42     ` rick H
2006-05-09 15:53   ` Avoiding use Ada.Tags (was Re: Instantiating private types with discriminants?) Alex R. Mosteo
2006-05-09 16:01   ` Instantiating private types with discriminants? Dmitry A. Kazakov
2006-05-10  7:42     ` rick H
2006-05-10  9:09       ` Ludovic Brenta
2006-05-10 11:49         ` Georg Bauhaus
2006-05-10 13:44         ` rick H
2006-05-10 14:21           ` Ludovic Brenta
2006-05-10 15:10             ` rick H
2006-05-10 15:45               ` Ludovic Brenta
2006-05-10 14:41           ` Dmitry A. Kazakov
2006-05-10 15:34             ` rick H
2006-05-10 19:01               ` Georg Bauhaus
2006-05-10 19:05                 ` Ludovic Brenta
2006-05-10 21:52                   ` Rick H
2006-05-11  1:17                     ` Jeffrey R. Carter
2006-05-11  7:44                     ` Dmitry A. Kazakov
2006-05-11  8:27                       ` rick H
2006-05-11 10:28                         ` Dmitry A. Kazakov
2006-05-11 15:59                           ` Robert A Duff
2006-05-12  7:37                             ` Dmitry A. Kazakov [this message]
2006-05-12  9:24                               ` Georg Bauhaus
2006-05-12 12:40                                 ` Dmitry A. Kazakov
2006-05-12 18:25                                   ` Randy Brukardt
2006-05-09 19:57   ` "Use" and "=" for Tags (was: Re: Instantiating private types with discriminants?) Jeffrey R. Carter
replies disabled

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