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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news1.google.com!news.glorb.com!newsfeed-0.progon.net!progon.net!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Bus error Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> Date: Sat, 30 Jun 2007 16:31:07 +0200 Message-ID: <18um6sna5z89.1ksvtmbvj91ds$.dlg@40tude.net> NNTP-Posting-Date: 30 Jun 2007 16:30:26 CEST NNTP-Posting-Host: 0702c0f9.newsspool1.arcor-online.net X-Trace: DXC=a0hO@9SDA;SFm0Y?OE@2^Xic==]BZ:af^4Fo<]lROoRQFl8W>\BH3YR3:H4CfN[Y7YDNcfSJ;bb[UIRnRBaCd^0NUYJ9:>2OoaEAY X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:16354 Date: 2007-06-30T16:30:26+02:00 List-Id: On Sat, 30 Jun 2007 15:14:39 +0200, Georg Bauhaus wrote: > Dmitry A. Kazakov wrote: >> On Fri, 29 Jun 2007 17:44:22 +0200, Georg Bauhaus wrote: >> >> But clearly your argument is nonsensical, literal is a syntactic element, >> of which semantics is as much object as any of any other expression. > > If the semantics of object renaming is that an object is renamed, > and a number literal is somehow not an object, I see a difference. Which one? What is in your theory a difference between: A : constant := 1; B : constant Integer := 1; C : Integer renames A; D : Positive renames B; Can you tell without much thinking which renaming is correct above? > If we can have renamings of expressions, OK, let us have let bindings; > However, what is their 'Access? Huh, but it is OK to take 'Access from a renaming! X : aliased Integer; Y : Integer renames X; Y_Ptr : access Integer := Y'Access; Note also that Ada has subroutine's implementation through renaming and, again, such implementations have 'Access. You should really fix your theory. >> It >> would be a very perverse idea to try to draw a line between literals and >> non-literals. > > What is a possible alternative? As Robert Duff have said, there should be no any difference. Especially to have user-defined literals and aggregates. >> 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. >>>> function Very_Positive return Integer is >>>> begin >>>> return -1; >>>> end Very_Positive; >>>> >>>> Oops : Positive renames Very_Positive; -- This is OK! >>> So is >>> >>> if 42 not in Boolean'pos(false) .. Boolean'pos(true) then >>> raise Constraint_Error; >>> end if; >> >> You missed the point. The renaming in my example shall *not* raise >> Constraint_Error. It is a clear language design fault. > > Oops will at some point raise Constraint error; how can a compiler > be supposed to known that some Integer function will *always* > return non-Positives? It is not about the time point a check would happen, it is about absence of any check. Constraint_Error will *never* be raised. This actually defeats the purpose of subtypes in helping the compiler to omit checks when Oops would be used in a context where a Positive is expected. It can do that for Oops : Positive := Whatever; but it cannot for renaming, because "Positive" there is a lie. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de