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,826cd690cb6a7585 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!diablo1.news.osn.de!news.osn.de!diablo2.news.osn.de!news.belwue.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 01 Sep 2011 11:50:59 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Overloading parentheses and type expectations (was: The simple Image issue) References: <904e717e-da4c-46c9-bbc2-4bae8368d459@l4g2000vbv.googlegroups.com> <4e5d139f$0$6575$9b4e6d93@newsspool3.arcor-online.net> <3756bc0c-d938-4b45-baa1-b80e59d58055@a10g2000prn.googlegroups.com> <1a879va9fjuwo.1r1b6vbp45lx5.dlg@40tude.net> <4e5dd1c1$0$6638$9b4e6d93@newsspool2.arcor-online.net> <12nar9pjxb1pg.14709ohrczh9p$.dlg@40tude.net> <4e5e54ec$0$7623$9b4e6d93@newsspool1.arcor-online.net> <4e5e6010$0$7611$9b4e6d93@newsspool1.arcor-online.net> <4e5e6199$0$7611$9b4e6d93@newsspool1.arcor-online.net> <1ctkvx8kzbydt.voo17pqegid1$.dlg@40tude.net> <4e5e9c5d$0$7624$9b4e6d93@newsspool1.arcor-online.net> <85cspp5yd1u1$.krrkdtgmlj4j.dlg@40tude.net> In-Reply-To: <85cspp5yd1u1$.krrkdtgmlj4j.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4e5f5583$0$6623$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 01 Sep 2011 11:51:00 CEST NNTP-Posting-Host: 196d8417.newsspool2.arcor-online.net X-Trace: DXC=U0:85ejV8:Djn3kdmQQ On 01.09.11 09:46, Dmitry A. Kazakov wrote: > On Wed, 31 Aug 2011 22:41:01 +0200, Georg Bauhaus wrote: > >> Still SPARK, and in some more cases Ada, do require that we write >> T'() anyway: to resolve another ambiguity (of ()). > > Fix SPARK! Not. At least if this makes me an inference machine for "()"; a "disambiguator"; or a de-obfuscator of clever abbreviations, omitted names, and long lists of positional parameters. What is the use of clever detection? To show that in f(1), given function f, the 1 can only be a an array of length 1? This, to me, is obfuscation. > There is no usable languages without overloading. Since you mentioned () > [meaning aggregates], think about them used for ordering: > > (x) > > returns what? For each type and subtype of x there is some "()". They all > are overloaded. Do you wish to annotate each of them? There is evidence that overloading the meaning of () is not working with normal people, e.g. McIver & Conway (1996). They arent't aguing about advanced programmers, though. The Turing language has made () a kind of universal "pick from" operator, arrays, dereferencing, taking part-of, ..., besides the usual uses. Readers will need to disambiguate uses of "()" if they want to know what some expression actually does. Some programmers want to know what an expression does. Other programmers must know what an expression does. M & C found that Turing made it difficult to learn the differences between things all written using "()". Why would a designer want entirely different things in a language and then use the same notation for all of them? Given the evidence, I think the disadvantages outweigh the advantages. > I := Integer'(1 + 2) * 4 ? Qualification, association, and infix operators. First, infix expressions are a (dis)service offered to programmers whose wish is less to program a computer, but rather to write executable formal expressions (such as non-CS formulas) in blissful ignorance of the computer. (Even when they like HP calculators...) Infix doesn't work well unless the subject is more or less mathematical and when work can ignore TIME and SPACE. I cannot say it better than, http://c2.com/cgi/wiki?OperatorPrecedenceConsideredHarmful Then, infix is complex to understand when the model is otherwise that of simple object oriented programming (ignoring inheritance). In 3 + 5 (or x + y), which object does "+" manipulate? Or will the execution update the "+" object? Consider a := 1; a.add(2); if a /= 3 then raise Program_Error; end if; This would put me in a different mode of thinking, and of understanding. There are no operational effects (or surprises!) of association and precedence. Third, an occurrence of qualifying T'(...) frequently creates an object. When the object appears alone, as in a typical initialization expression, repeating the type's name may seem silly and redundant. Just for context, some less specific circumstances. declare X : T0'class := T3'( ... ); begin is different from declare X : T3 := ( ... ); begin and different from Integer'(1 + 2) * 4 "Qualifying" in a different way, though much like Integer'(1 + 2) is not without uses: for P in Pins range 1 .. 3 loop rather than for P in 1 .. 3 loop carries more information, and will add information that is sometimes necessary for the Ada compiler to know the literals and their types. I don't find them necessarily silly and redundant. Strict, yes. > Since the dictionary of any language is far less than the number of > entities an average program in that language describes, you simply cannot > avoid some kinds overloading. Sometimes overriding works better than overloading. At the level of overloading ASCII punctuation, I think the less, the better. Use symbols only for things heavily loaded with meaning. The art is in finding the right weight.