From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9fb8e2af320d5b3e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Bus error Date: Sun, 01 Jul 2007 11:39:33 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <0367891DA5DA7E408D42A860FA002F44B0CC48@sma2901.cr.eurocopter.corp> <1l4yqvxoid4n1.1u8eo4oo8ml4m$.dlg@40tude.net> <4685280c$0$14869$9b4e6d93@newsspool4.arcor-online.net> <46865672$0$23136$9b4e6d93@newsspool1.arcor-online.net> <18um6sna5z89.1ksvtmbvj91ds$.dlg@40tude.net> <1b9ocrlv2jphe.3fmct1wz53o4$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1183304373 24970 192.74.137.71 (1 Jul 2007 15:39:33 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 1 Jul 2007 15:39:33 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:l45opttN0hc5qk7O0cFD2RLbgnc= Xref: g2news1.google.com comp.lang.ada:16373 Date: 2007-07-01T11:39:33-04:00 List-Id: "Dmitry A. Kazakov" writes: > On Sat, 30 Jun 2007 11:34:16 -0400, Robert A Duff wrote: > >> "Dmitry A. Kazakov" 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