comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Bus error
Date: Sun, 01 Jul 2007 11:39:33 -0400
Date: 2007-07-01T11:39:33-04:00	[thread overview]
Message-ID: <wccabugf80a.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1b9ocrlv2jphe.3fmct1wz53o4$.dlg@40tude.net

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

> On Sat, 30 Jun 2007 11:34:16 -0400, Robert A Duff wrote:
>
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>> 
>>> On Sat, 30 Jun 2007 15:14:39 +0200, Georg Bauhaus wrote:
>>>
>>>> Dmitry A. Kazakov wrote:
>>>>> Note also that Ada's renaming has conceptually little to do
>>>>> with objects. Consider:
>>>>> 
>>>>>    X : T;
>>>>>    X : T renames X; -- Illegal
>>>>> 
>>>>> though the "object" is obviously same. Same object, same name, what was
>>>>> wrong?
>>>> 
>>>> A programmer construing strange assumptions about the possibility of
>>>> duplicate names in a declarative part of an Ada program, I'd say.
>>>
>>> Where do you see duplicated names?  Is bare name an object? Observe that X
>>> referred to exactly same object, if the theory were correct. But apparently
>>> the theory is wrong, and in fact X : T renames X; produces something else.
>> 
>> I must say, I'm mystified as to what the above example is supposed
>> illustrate.  You can't have two declarations with the same name
>> (unless they are both overloadable).  The fact that they are both
>> names for the same object is irrelevant to THAT rule.
>
> Declarations of what?

Well, the RM doesn't seem to care:

8 {homograph} Two declarations are homographs if they have the same
defining name, and, if both are overloadable, their profiles are type
conformant. {type conformance [partial]} [An inner declaration hides any
outer homograph from direct visibility.]

9/1 {8652/0025} [Two homographs are not generally allowed immediately
within the same declarative region unless one overrides the other (see
Legality Rules below).]...

>... That is the question. Allegedly, as the name of the
> thing let suggest, "rename" does not declare anything [new].

A renaming declaration is syntactically a declaration,
and it declares a name.  It does not declare a new entity.

>... Does "use"
> declare something?

No.  And it's not a declaration.

>... Or is name an object?

No.  But:

5 {Declaration} [Glossary Entry]A declaration is a language construct
that associates a name with (a view of) an entity. ...

7 {Definition} [Glossary Entry]{view} All declarations contain a
definition for a view of an entity. A view consists of an identification
of the entity (the entity of the view), plus view-specific
characteristics that affect the use of the entity through that view
(such as mode of access to an object, formal parameter names and
defaults for a subprogram, or visibility to components of a type). In
most cases, a declaration also contains the definition for the entity
itself (a renaming_declaration is an example of a declaration that does
not define a new entity, but instead defines a view of an existing
entity (see 8.5)).

> If I designed rename, I would certainly allow X renames X; similarly to
> "use" or "with" A, A;

OK, I think I see what you're getting at.  You would then say that
referring to X is legal (not ambiguous) because both of those
declarations of the name X refer to the same entity.  Right?

To make this work, you need to distinguish static and dynamic.

    X : Integer renames Func(...).all.Component(Func2(...));
    X : Integer renames Func(...).all.Component(Func2(...));

    X := X + 1; -- legal?

I don't think you want a run-time check that the two
names X denote the same entity!

FWIW, I would simply delete the no-duplicate-homographs rule.
And weaken the overload resolution rules.

- Bob



  reply	other threads:[~2007-07-01 15:39 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0367891DA5DA7E408D42A860FA002F44B0CC48@sma2901.cr.eurocopter.corp>
2007-06-29  9:35 ` AW: Bus error Duncan Sands
2007-06-29 12:55   ` Dmitry A. Kazakov
2007-06-29 15:37     ` Markus E Leypold
2007-06-29 15:44     ` Georg Bauhaus
2007-06-29 20:07       ` Dmitry A. Kazakov
2007-06-30  1:37         ` Robert A Duff
2007-06-30  8:44           ` Dmitry A. Kazakov
2007-06-30 11:52             ` Georg Bauhaus
2007-06-30 13:16               ` Georg Bauhaus
2007-06-30 14:31               ` Dmitry A. Kazakov
2007-06-30 18:07                 ` Georg Bauhaus
2007-06-30 19:31                   ` Robert A Duff
2007-07-01  9:07                   ` Dmitry A. Kazakov
2007-06-30 15:40               ` Robert A Duff
2007-06-30 17:54                 ` Georg Bauhaus
2007-07-02  8:01           ` Jean-Pierre Rosen
2007-07-02 12:00             ` Dmitry A. Kazakov
2007-07-02 12:30               ` Jean-Pierre Rosen
2007-07-02 14:22             ` Robert A Duff
2007-06-30 13:14         ` Georg Bauhaus
2007-06-30 14:31           ` Dmitry A. Kazakov
2007-06-30 15:34             ` Robert A Duff
2007-07-01  8:34               ` Dmitry A. Kazakov
2007-07-01 15:39                 ` Robert A Duff [this message]
2007-07-01 19:41                   ` Dmitry A. Kazakov
2007-06-30 15:29           ` Robert A Duff
2007-06-30 17:41             ` Georg Bauhaus
2007-06-30 13:31         ` Markus E Leypold
2007-07-02  0:16           ` Robert A Duff
2007-06-29  9:23 AW: " Grein, Christoph (Fa. ESG)
2007-06-29 10:17 ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
2007-06-27 14:23 Maciej Sobczak
2007-06-27 15:45 ` Georg Bauhaus
2007-06-27 17:19   ` Maciej Sobczak
2007-06-28  1:58     ` Robert A Duff
2007-06-28 20:06       ` Maciej Sobczak
2007-06-28 21:19         ` Robert A Duff
2007-06-29  8:05           ` Maciej Sobczak
2007-06-29  9:42             ` Georg Bauhaus
2007-06-29 16:59               ` Adam Beneschan
2007-06-30 12:33                 ` Georg Bauhaus
2007-06-30  2:02             ` Robert A Duff
2007-06-29  8:04         ` Dmitry A. Kazakov
2007-06-27 20:02 ` Anh Vo
2007-06-27 20:48   ` Maciej Sobczak
2007-06-28  2:01     ` Robert A Duff
1990-08-27 23:48 BUS ERROR J o s e D u a r t e ! ! !
1990-08-16 14:52 saharbaugh%roo.dnet
1990-08-13 21:11 J o s e D u a r t e !!!
1990-08-10 12:32 bus error saharbaugh%roo.dnet
1990-08-09 14:50 saharbaugh%roo.dnet
1990-08-10 21:38 ` Chuck Peterson
replies disabled

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