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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-20 00:50:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!195.40.4.120.MISMATCH!easynet-quince!easynet.net!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!dialin-145-254-041-024.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: Fri, 20 Jun 2003 09:53:20 +0200 Organization: At home Message-ID: References: <5e9b8c34.0306181050.3c4cc664@posting.google.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-041-024.arcor-ip.net (145.254.41.24) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1056095432 24599365 145.254.41.24 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:39483 Date: 2003-06-20T09:53:20+02:00 List-Id: Russ wrote: > "Dmitry A. Kazakov" wrote in message > news:... >> That thing is called overloading. BTW, see my example below for a >> procedure, which does *not* modify any of its arguments. > > If i := i + 1 is equivalent to i + 1, then what does > > i = i + j + 1 > > mean? It depends on the set of visible procedures and functions. However from the above it is absolutely unclear what you mean. A. An expression: if i = i + j + 1 then ... Then no procedure is even considered. A call to a procedure may appear in a call-statement only. (Sorry for a tautology (:-)) B. A statement, assuming that "=" should be ":=", plus a trailing semicolon: i := i + j + 1; Then everything left of ":=" is an expression, and see A. C. If "=" is "=" and it is again a statement then things get more interesting: i = i + j + 1; The compiler should consider: C.1 i = (i + j + 1); -- "=" is a procedure C.2 (i = i) + (j + 1); -- 1st "+" is a procedure C.3 (i = i + j) + 1; -- 2nd "+" is a procedure Because of operation priorities only C.1 is considered. So "=" is definitely a procedure, if exists, otherwise it is a compile error. Everything else are functions. Technically it is no problem to parse that. Business as usuall for a compiler. > Does j get incremented by 1? Either way, I'd say readability > went out the window. Well, overloading has problems with that. Yet, it is allowed in most of languages. It is programmer's duty not to misuse overloading. Note that any additional operation reduces readability: X := X + Y; X +:= 1; This could become a puzzle for a reader. Why author adds Y using a function but when he adds 1 he uses a procedure? Is there any semantic difference, or is it just a matter of taste? Could the code be improved when both were functions or procedures? May a change of implementation of "+" or "+:=" infuence the decision. Should we inspect the implementations? Should we revise all the code? -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de