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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,657568723e59e45b,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.66.81.98 with SMTP id z2mr8368010pax.19.1351379034402; Sat, 27 Oct 2012 16:03:54 -0700 (PDT) Path: s9ni52648pbb.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!news-hub.siol.net!news.mi.ras.ru!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Basic issue with dotted notation and tagged types Date: Mon, 22 Oct 2012 00:55:08 +0200 Organization: Ada @ Home Message-ID: NNTP-Posting-Host: mZxn9FMK8yo4BhyrIq2SaA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.02 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-10-22T00:55:08+02:00 List-Id: I can't remember if this was already discussed here, somewhere in a = rationale or an RM comment, here is something I really don't like, with = a = field (or member) of a tagged type and a function, both of the same name= ; = a very basic case: with Ada.Text_IO; procedure Test2 is package IO renames Ada.Text_IO; -- type T is tagged; -- function F (E : T'Class) return Character; type T is tagged record F : Character :=3D 'A'; end record; function F (E : T'Class) return Character is ('B'); E : T; C : Character :=3D E.F; -- The function or the field? begin IO.Put (C); end; Will this display `A` or `B`? Actually, the program compiled with GNAT = 4.6, displays `A`. It displays the same even when the two commented line= s = are commented=E2=80=91out and thus the function `F` is declared before t= he field = `F`. I can't remember if the RM have special wordings about it, but I fe= el = this does not honour the principle of least surprise. May be this should= = be disallowed, to access any one of the two, when both are together = visible from a scope? -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity