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-Thread: a07f3367d7,c689b55786a9f2bd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!tudelft.nl!txtfeed1.tudelft.nl!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: for S'Image use Func?? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4be417b4$0$6992$9b4e6d93@newsspool4.arcor-online.net> <1qcb6z4i20dyb.1dz2hd4c0vx69.dlg@40tude.net> Date: Tue, 11 May 2010 19:54:22 +0200 Message-ID: NNTP-Posting-Date: 11 May 2010 19:54:20 CEST NNTP-Posting-Host: 0d10e0b5.newsspool2.arcor-online.net X-Trace: DXC=EYKl>CYIBX?lIh70@COgUkn_?_Y?ek]<0mGF5o32_d:GAZTc91 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:11517 Date: 2010-05-11T19:54:20+02:00 List-Id: On Tue, 11 May 2010 17:05:07 +0000 (UTC), Warren wrote: > Dmitry A. Kazakov expounded in > news:h1uzhgbbx6hd.1lg6oydcub0re$.dlg@40tude.net: > >> On Mon, 10 May 2010 18:50:02 +0000 (UTC), Warren wrote: >> >>> But you have no way to know when you've read >>> a empty line in a lexer routine that is reading >>> character by character. >> >> A lexer routine shall never do that. You either read lines and then >> parse them, or else you do stream input and the line end is to be >> determined by the lexer (i.e. by the language being parsed). > > Empty lines are significant to my parser, Then Get_Line is what you have to use. If the language is line-oriented, you read lines. If the language is character oriented, then lines do not exist. >> I meant formatted I/O. That is strictly untyped, not weakly typed. If >> you use dynamic lists of arguments, you have to be dynamically typed >> or else untyped. C chose the latter. > > As I pointed out earlier, those *printf() arguments are > checked, so it is not strictly untyped. You can lie to > it of course.. Which is precisely what being untyped is. BTW, printf is fundamentally uncheckable. Proof: char * Format = (HALT (p) ? "%d" : "%s"); printf (Format, 123); >>> I just cited >>> one common and concrete formatting instance that gets >>> used in C frequently, that you cannot do in Ada "out >>> of the box". >> >> Luckily. As others already suggested, you should use type specific >> operations like "&" for that. > > How does "&" fix the hexadecimal formatting? That is > what I am discussing. Oh, there are so many ways. E.g. 1. type Hex_Dump is new String; function "&" (Text : Hex_Dump; Value : Integer) return Hex_Dump; 2. type Formatted is private; -- Actually String function "&" (Text : String; Data : Formatted) return String; function "/" (Value : Integer; Base : Base_Number) return Formatted; "" & 2456/16 3. type Format_Int is record Value : Integer; Base : Base_Number; end record; function "&" (Text : String; Data : Format_Int) return String; "" & (2456, 16) I think you've got the idea. > I'm not complaining about that. I'm complaining that > (for example) the hex conversion is "annoying" in that > I have to "wrap it" to get my "proper" hex output. Ada > gives me the hex, but a bunch of enclosing junk with it. It is also annoying that I cannot output the number's base as subscript 16. Programming is generally annoying. I don't say that Ada's formatting is OK. Otherwise I would not write a formatting library of my own. I just don't consider formatting as an essential part of the language. Even at the standard library level it is not. >>> Yes, you >>> can mess with proportional fonts if you like, but it isn't >>> always that way. >> >> Nobody want to see fixed font output. > > Pardon me? If you give me a report of my > investment holdings with columns of numbers, > then those numbers better line in columns as > well. Where is a problem? Fixed point is a relatively new invention, which came with computers. I have some old mathematical tables, they all use proportional fonts. Numbers are aligned on either of the margins. Fractional numbers are aligned on decimal point. > Have you ever put code in a Word document? You > don't leave them proportional, do you? Gak!! I meant this only case as a legitime use of fixed fonts. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de