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-Thread: 103376,8f0924b09d1aa9d2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!24.30.200.11!news-east.rr.com!news-wrt-01.southeast.rr.com!news-wrt-01.tampabay.rr.com!news-feed-01.tampabay.rr.com!news.rr.com!news-post.tampabay.rr.com!cyclone2.kc.rr.com!news2.kc.rr.com!tornado.socal.rr.com.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Why is abs an operator, not a function? References: <1161148425.954662.138180@b28g2000cwb.googlegroups.com> From: Keith Thompson Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:CXABAFGyPWhJRih2iJZTKOY4RjY= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 19 Oct 2006 04:30:54 GMT NNTP-Posting-Host: 75.80.183.54 X-Complaints-To: abuse@rr.com X-Trace: tornado.socal.rr.com 1161232254 75.80.183.54 (Wed, 18 Oct 2006 21:30:54 PDT) NNTP-Posting-Date: Wed, 18 Oct 2006 21:30:54 PDT Organization: Road Runner High Speed Online http://www.rr.com Xref: g2news2.google.com comp.lang.ada:7036 Date: 2006-10-19T04:30:54+00:00 List-Id: Robert A Duff writes: > "Jerry" writes: >> Why is abs an operator and not a function? Just wondering. > > An operator _is_ a function. So the question really is, why is the name > of the abs function an operator symbol (a reserved word) rather than an > identifier? > > In early (pre-1983) versions of Ada, Abs was not an operator -- just a > normal function with identifier Abs as its name. I think it was changed > to make implementations easier -- implementations usually special-case > the overloading resolution for operator symbols, since they are so > heavily overloaded. Maybe the fact that all predefined functions > are operators simplifies that. Not a big deal, but it does have > a certain uniformity -- e.g. "not" is an operator symbol, too, > and works the same way as "abs". And for the sake of uniformity, if Abs weren't an operator, it would probably be an attribute. (It *could* be a normal function, declared implicitly for each numeric type, as it was pre-1983, but it would be the only one.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org San Diego Supercomputer Center <*> We must do something. This is something. Therefore, we must do this.