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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1edf0dd6205794b6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-09 07:32:08 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!world!news From: Robert A Duff Subject: Re: Bug in GNAT? User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Sat, 9 Nov 2002 15:31:37 GMT Content-Type: text/plain; charset=us-ascii References: <3dccc024$0$307$bed64819@news.gradwell.net> <3dcce11d$0$307$bed64819@news.gradwell.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:30651 Date: 2002-11-09T15:31:37+00:00 List-Id: porton@ex-code.com (Victor Porton) writes: > But this compiles with an error: > > function F(A: Integer) return Integer is begin return 1; end; > Y: Integer renames F(3)+2; > > What is the difference? Look at the syntax rules. Renaming requires a "name". A function_call is a name, but that thing with "+" in the middle is an "expression", and not a name. 6.6 says operator notation is equivalent to function call notation, but that only applies to the semantics -- as this example shows, they are *not* equivalent syntactically. Y: Integer renames "+"(F(3), 2); -- OK Y: Integer renames F(3) + 2; -- illegal I happen to think this is a bug in the language design -- there should be no syntactic distinction between names and expressions. And no distinction between "constant object" and "value". By the way, the ability to rename function results did not exist in Ada 83. - Bob