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: a07f3367d7,4b26cf620424a3ff X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!newsfeed-0.progon.net!progon.net!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Sat, 01 May 2010 12:46:54 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Language Revision : "/" and "div" References: <8aa58be8-a9b2-4653-8234-e5b6a70f310f@k41g2000yqb.googlegroups.com> In-Reply-To: <8aa58be8-a9b2-4653-8234-e5b6a70f310f@k41g2000yqb.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4bdc069f$0$6882$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 01 May 2010 12:46:55 CEST NNTP-Posting-Host: 1f344c0f.newsspool2.arcor-online.net X-Trace: DXC=^QM:RRgOVhf016@cHD@m;jA9EHlD;3Ycb4Fo<]lROoRa8kFW@dPCY\c7>ejVhIfAZR3GOF=e1MRHi0K9QRl X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:11270 Date: 2010-05-01T12:46:55+02:00 List-Id: On 5/1/10 8:52 AM, vincent.diemunsch@gmail.com wrote: > Hi everybody, > > I wonder why Ada uses "/" to express the integer division and not > "div". > This leads to the fact that an expression like 4/3*6 that any decent > calculator > would evaluate as 8 is in Ada evaluated as 6 !!! That is a shame :-). High school assumptions will haunt us forever. :-) Maybe von Neumann's sceptic remark about Fortran made in 1954 applies to Ada's operator notation, too. Mold it like this: The trouble originates when a programmer forgets about the important fact that the thing to be programmed is a computing apparatus. As such, it has its own mathematical structures. As such, it must be given proper attention. Formal attention. Then it will turn out to be more useful and enrich our computing potential. Surely approaching a computing apparatus with casually expressed formulas such as 4/3*6 fails on both accounts: Seen across languages, they are not well defined textual expressions of a program. Rather, they hint at mathematical ideas. The interpretation 8 as the value of 4/3*6 is only one of many. But many possible interpretations would not seem to be a good thing in the case of free-standing literals if you want to achieve clarity of expression. 8 becomes a possible interpretation only because of a m�lange of evaluation strategies from which we will have to choose. Again and again. But how should we choose when writing formal programs, e.g. in Ada? 1) In programming, mathematics, and elsewhere, / and * are massively overloaded symbols. Why incur overload resolution into expressions involving literals when instead we could add clarity by simply using typed literals and brackets? (Resolving overridings or similar would improve litte for untyped literals, I think.) Strategy: Say what you mean. 2) There is only implicit association. Write in two or three programming languages regularly and maybe you start adding brackets routinely. Strategy: Add brackets. LISP, without infix notation, is much less dangerous in this regard. With clarity of interpretation in mind, having typed fraction literals seems as interesting as ever.