comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Legit Warnings or not
Date: Wed, 3 Aug 2011 15:35:04 -0500
Date: 2011-08-03T15:35:04-05:00	[thread overview]
Message-ID: <j1cbdr$tfe$1@munin.nbi.dk> (raw)
In-Reply-To: 1wg90w555yp7f.1lhp1szkc0cu5$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:1wg90w555yp7f.1lhp1szkc0cu5$.dlg@40tude.net...
> On Tue, 2 Aug 2011 16:30:24 -0500, Randy Brukardt wrote:
>
>> Either you are allowing changing the object to anything in the class,
>> or you are not allowing it to be changed at all. No middle ground there.
>
> When I declare
>
>   type A is array (...) of S'Class;
>
> 1. Are all elements constrained to same specific type?

Assuming the model I'm suggesting is adopted, no.

> 2. May object types change after being initialized?

Yes. These are completely unconstrained entities.

> 3. Which rules apply to view conversions, e.g. T'Class (A (10)). Could it
> be then assigned to which types, same, others?

The same rules as currently for a parameter of S'Class. I would not want to 
make any changes there, the rules are messy enough as it is.

> 4. In which relation are slices of the array and arrays of T'Class when T
> is related to S? [Classes of arrays vs. arrays of classes vs. classes of
> arrays of classes etc.]

Nothing special; there is no attempt to address the issues with inheritance 
of composition. I don't think those issues *can* be addressed in an Ada-like 
type system.

> 5. I am horrified what kind of "accessibility rules" might get invented 
> for
> passing elements of this "array" here and there.

For me, (dynamic) accessibility is a waste of time; it adds overhead, adds a 
failure hazard, and buys nothing in terms of safety. (I have to use 
'Unchecked_Access in 99% of my programs; 'Access fails for one reason or 
another.)

But that's irrelevant; no new accessibility would be needed because there is 
no new capability here. These are exactly the same as mutable discriminanted 
objects (i.e.the type has defaults for the discriminants). It would be 
erroneous to change the tag of a statically bound parameter (just like it is 
erroneous to change the discriminant in such a case) -- there is no way to 
avoid that without requiring programmers to effectively ignore all 
constraints (because they could change), which is too bogus of a model to 
contemplate.

> [The behavior of types upon composition is a very non-trivial issue.]

I would not make any change there; to the extent that it is a problem now it 
would stay that way.

>> And there is no "control over copying". These are normal "parts" of the
>> object, and they're always copied. If you don't want copying, then you 
>> need
>> to use some sort of reference (cursor or access type). (Of course, an
>> implementation can always do an "as-if" implementation, but the model is
>> always deep copying.)
>
> Which would make the compiler implementation unusable in so many cases.

If so, you would be abusing the intent of the feature. It's intended for 
composition uses only; if you need to represent dynamically changing 
connections between objects, then you clearly need references of some sort 
(cursors preferrably, access types otherwise). If, however, you are 
statically combining objects, then having to manage references explicitly is 
just busywork -- it harms readability, does nothing for performance, and the 
like. Obviously, there is a gray area between these -- but you would never 
to use direct components to represent connections, only composition. 
Otherwise you are hiding structure; I'm only interested in cases where there 
is only one object whose parts consist of previously existing objects that 
will lose their independent identity.

                            Randy.





  reply	other threads:[~2011-08-03 20:35 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 22:30 Legit Warnings or not Anh Vo
2011-07-20 23:16 ` Robert A Duff
2011-07-21 18:43   ` Anh Vo
2011-07-23  0:26   ` Randy Brukardt
2011-07-23 14:26     ` Robert A Duff
2011-07-21  2:37 ` Jeffrey Carter
2011-07-21  9:50   ` Brian Drummond
2011-07-21 14:39     ` Dmitry A. Kazakov
2011-07-23  0:36       ` Randy Brukardt
2011-07-23  9:03         ` Dmitry A. Kazakov
2011-07-23 11:07           ` Simon Wright
2011-07-23 11:21             ` Dmitry A. Kazakov
2011-07-26 21:25           ` Randy Brukardt
2011-07-27  7:45             ` Dmitry A. Kazakov
2011-07-28  0:37               ` Randy Brukardt
2011-07-28  9:22                 ` Dmitry A. Kazakov
2011-07-28 14:22                   ` Robert A Duff
2011-07-28 14:41                     ` Dmitry A. Kazakov
2011-07-28 15:10                       ` Robert A Duff
2011-07-28 17:05                         ` Dmitry A. Kazakov
2011-07-28 23:32                           ` Randy Brukardt
2011-07-28 23:48                   ` Randy Brukardt
2011-07-29  6:57                     ` Simon Wright
2011-07-29 18:56                       ` Jeffrey Carter
2011-07-30  0:13                       ` Randy Brukardt
2011-07-29  7:41                     ` Dmitry A. Kazakov
2011-07-30  0:17                       ` Randy Brukardt
2011-07-30  8:27                         ` Dmitry A. Kazakov
2011-08-01 22:12                           ` Randy Brukardt
2011-08-02 10:01                             ` Dmitry A. Kazakov
2011-08-02 21:30                               ` Randy Brukardt
2011-08-03  9:01                                 ` Dmitry A. Kazakov
2011-08-03 20:35                                   ` Randy Brukardt [this message]
2011-08-04  8:11                                     ` Dmitry A. Kazakov
2011-08-05 23:57                                       ` Randy Brukardt
2011-08-06  8:23                                         ` Dmitry A. Kazakov
2011-08-08 21:30                                           ` Randy Brukardt
2011-07-23 14:32         ` Robert A Duff
2011-07-26 21:32           ` Randy Brukardt
2011-07-21 15:28     ` Adam Beneschan
2011-07-21 15:41       ` Robert A Duff
2011-07-21 20:12         ` Adam Beneschan
2011-07-23  0:31           ` Randy Brukardt
2011-07-21 17:40     ` Jeffrey Carter
2011-07-21 21:30       ` Brian Drummond
2011-07-21 21:54         ` Adam Beneschan
2011-07-22 10:16           ` Brian Drummond
2011-07-22 14:54             ` Adam Beneschan
2011-07-23  0:46             ` Randy Brukardt
2011-07-23  0:42         ` Randy Brukardt
2011-07-23  9:20           ` Niklas Holsti
2011-08-04  5:56             ` David Thompson
2011-07-23  9:24           ` Dmitry A. Kazakov
2011-07-23 12:36           ` Brian Drummond
2011-07-21 15:13   ` Robert A Duff
2011-07-23  0:52     ` Randy Brukardt
2011-07-23 14:48       ` Robert A Duff
2011-07-21 14:17 ` anon
replies disabled

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