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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 101deb,495b037244521cf3 X-Google-Attributes: gid101deb,public X-Google-Thread: 103376,22b2c05a8088bbb2 X-Google-Attributes: gid103376,public From: Ken Garlington Subject: Re: Leading zeros with Int_IO.Put()? Or another package? Date: 1996/11/22 Message-ID: <3295F2A9.1EF0@lmtas.lmco.com>#1/1 X-Deja-AN: 198174682 references: <327FB8A3.745B@itg-sepg.logicon.com> <55ubsh$lh0$1@goanna.cs.rmit.edu.au> <56bi13$3pa$1@goanna.cs.rmit.edu.au> <328A0DDD.94B@lmtas.lmco.com> <56rgou$r4k$1@goanna.cs.rmit.edu.au> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Tactical Aircraft Systems mime-version: 1.0 newsgroups: comp.lang.ada,comp.lang.pl1 x-mailer: Mozilla 2.02 (Macintosh; I; 68K) Date: 1996-11-22T00:00:00+00:00 List-Id: robin wrote: > Ken Garlington writes: > > >"The need for languages that promote reliability and simplify maintenance > >is well established. Hence emphasis was placed on program readability over > >ease of writing." > > Ada clearly failed in this aspect. Hmmm. So you consider the syntax put edit (n) (P'-99999999'); more readable than the Ada equivalent use Ada.Text_IO.Editing; ... package Edited_IO is new Decimal_Output (type); ... Edited_IO.Put (n, To_Picture ("-99999999")); Interesting. They look reasonably similar to me. If anything, the Ada version makes it clear from the text that this I/O is using the Picture feature of the language. However, if you believe "P" is more readable in this regard, I suppose we'll have to agree to disagree... > >Of course, once you have the zero-fill package (or whatever > >other abstraction you intend to reuse), the number of lines > >you have to write drops quite a bit. > > No excuse for having everyone who wants to use such a facility > to have to write it. 1. Why does everyone have to rewrite publicly-available code? I usually just reuse it. (Perhaps this is an Ada-unique mindset.) 2. The equivalent of your code is directly available in Ada, if desired (see above). > It is, after all, avalable ina number of languages including COBOL > and PL/I. > > The simplicity and usefulness of PL/I in producing > zero suppression/insertion of characters/general editing/ > in a variety of forms (integer, fixed-point, floating-point) and suitable > for business and science cannot be refuted. > > As I indicated earlier, just one short line will suffice! : > > put edit (d) (P'999.V999'); What I don't understand is, given the statement above, how I can restrict the use of the statement above so that "d" is always a numeric value in the range 0.000 .. 999.999. Implicit strong typing is available in a number of languages, including Ada, so there's no excuse for having everyone who wants to use such a facility to have to write it explicitly. Perhaps you could post the PL/I solution so that I could compare it to the Ada version. -- LMTAS - "Our Brand Means Quality" For more info, see http://www.lmtas.com or http://www.lmco.com