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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.42.37.71 with SMTP id x7mr4738333icd.4.1406218504368; Thu, 24 Jul 2014 09:15:04 -0700 (PDT) X-Received: by 10.50.29.13 with SMTP id f13mr292648igh.15.1406218504283; Thu, 24 Jul 2014 09:15:04 -0700 (PDT) Path: border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!h18no6839941igc.0!news-out.google.com!eg1ni2igc.0!nntp.google.com!h18no6839936igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 24 Jul 2014 09:15:03 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Functions vs constants From: Adam Beneschan Injection-Date: Thu, 24 Jul 2014 16:15:04 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:187837 Date: 2014-07-24T09:15:03-07:00 List-Id: On Thursday, July 24, 2014 9:01:43 AM UTC-7, Robert A Duff wrote: > procedure P is=20 > X: constant Integer :=3D 1; >=20 > procedure Q is > X: constant Boolean :=3D True; > begin > Overloaded(X); > ... > Now, you might say the above SHOULD be illegal, and I'd agree. > But it's currently legal, and we shouldn't be breaking legal > programs. If the "X: Integer" constant is used only in the body of P, it can be moved= down below Q, just above P's "begin". But it should be noted that this wa= s not possible in Ada 83, where there was less freedom about how things in = a declarative part were ordered. So it wouldn't surprise me if there is le= gacy Ada 83 code that does something like your example, i.e. declaring the = same constant name in a scope and a nested scope, such that both would beco= me visible if constant declarations were made overloadable. -- Adam