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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Thu, 30 Jul 2015 15:53:16 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <2df4698f-4c8e-457c-822d-209cb2f8ab5e@googlegroups.com> <014427b1-ff7a-4a69-82e6-0330af77ed96@googlegroups.com> <1438244829.17005.26.camel@obry.net> <0a8104af-4ebb-4d82-92e5-6ba7289272ce@googlegroups.com> <262cbf86-25a0-4802-b72e-ec6e650e1dc7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Thu, 30 Jul 2015 22:51:45 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="ee44d3db9c41f5ad88d7e8e8f0268f05"; logging-data="30870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/d364O668Nj1MwnDITUKrhNhl13kOcoyI=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: X-Mozilla-News-Host: news://freenews.netfront.net Cancel-Lock: sha1:4d3NWg3uQX+pqpUQQOVJgC/uXKE= Xref: news.eternal-september.org comp.lang.ada:27246 Date: 2015-07-30T15:53:16-07:00 List-Id: On 07/30/2015 12:54 PM, EGarrulo wrote: > > I had already explained in this discussion why I think that the "Printf" > solution is preferable: > > Thanks to its format string, "printf" lets you see > at a glance what the output will look like. On the contrary, > solutions in Ada -- that involve more than simple string > concatenation -- tend to obscure what the final result will look > like, and are cumbersome both to write and to read. > > -- > > Now, multiply this for all the times that your program needs > to print formatted text... Not to mention that the order of the > arguments is hard-coded in the valid Ada snippet, whilst you could > need a different order to support formatted output in different > languages. Your Print as described at that point did not have any support for different languages without changing the order of the arguments, either. So again you changed the problem. I can do the same thing: take your Printf with its format string of type String and numbered placeholders and show how it handles Hebrew. > If I don't repeat my arguments, it is because doing so would be redundant, not > because I am playing fancy tricks to win an argument. So... have you got an > alternative to propose, or do you agree that "Printf" is a more flexible > approach? Before you reply, I am adding that I have already proposed a > specification of Printf that takes an array of strings as the arguments to its > format string, so that formatting can be done outside, and be customized for > new types. Actually, I think that such a function should become > standard, because it would integrate well with existing functions (like > To_Picture). Printf is a bad idea since humans are bad at mentally parsing things like the format string and bad at counting things such as the position of an argument in the argument list, and doing both at once while also trying to match the placeholders in the format string with the arguments tends to be error-prone. If formatting can be done "outside", then it's reasonable for such formatting to result in the entire text to be output: Ada.Wide_Wide_Text_IO.Put_Line (Item => Internationalized (Who_Won, Language, (Surname, Image (Amount) ) ) ); -- Jeff Carter "Pray that there's intelligent life somewhere up in space, 'cause there's bugger all down here on earth." Monty Python's Meaning of Life 61