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: 103376,22b2c05a8088bbb2 X-Google-Attributes: gid103376,public X-Google-Thread: 101deb,495b037244521cf3 X-Google-Attributes: gid101deb,public From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Subject: Re: Leading zeros with Int_IO.Put()? Or another package? Date: 1996/11/20 Message-ID: <56tjrh$4ak$1@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 197536569 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> organization: Comp Sci, RMIT, Melbourne, Australia newsgroups: comp.lang.ada,comp.lang.pl1 nntp-posting-user: ok Date: 1996-11-20T00:00:00+00:00 List-Id: rav@goanna.cs.rmit.edu.au (robin) writes: >Ken Garlington writes: > >From the Introduction section of ISO/IEC 8652:1995: > >"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. This is not clear at all. I have used a great many programming languages, and find Ada to be _dramatically_ more readable (in terms of how well I can read other people's code) than most of them. It beats C and C++ by a country mile, and I find that it beats PL/I as well. One of the reasons is that conversions are explicit. >No excuse for having everyone who wants to use such a facility >to have to write it. *BUT THEY DON'T*. It is a common rhetorical device of yours, rav, to take a true statement "someone must write X", and use the _false_ statement "everyone must write X" as a stick to beat Ada with. >It is, after all, avalable ina number of languages including COBOL >and PL/I. We are specifically talking about converting numbers to text. If you want a list of languages with such features, add Burroughs Extended Algol, and Algol 68. Also add Ada 95. Have you looked at Annex F in the Ada 95 LRM? It's on-line here, and quite a few staff members have printed copies. Have you _tried_ the Annex F stuff? We have GNAT, and the current GNAT documentation says all the annexes are supported. I _have_ tried picture editing in GNAT; it works fine, and it is no harder and no easier to write Ada pictures than COBOL or PL/I pictures. >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. Can I refute the usefulness of PL/I for this? I cannot, and would not want to. Can I refute the simplicity of PL/I for this? Well, it depends on what you you mean. As noted above, I don't find it any harder to write Ada pictures than PL/I pictures, and I welcome the level of detail in the ADA 95 LRM. I've used pictures in Burroughs Algol, COBOL, and PL/I, and the devil is in the details. Concerning the actual _use_ of pictures, if you use named pictures in PL/I, there is very little to chose. If you _don't_ use named pictures (by which I mean ones declared in a PL/I DECLARE statement or an Ada object declaration) then using "magic strings" is just as bad as using "magic numbers". >As I indicated earlier, just one short line will suffice! : >put edit (d) (P'999.V999'); I note that Ada 95 pictures offer some features missing from COBOL-85 and that they're pretty useful. I note that Ada 95 makes it pretty easy to read a picture from a file, or compute on on the fly by some other method. (In particular, from the attributes of "d" in an example like this.) I willingly concede that it is a nuisance that Ada 95 pictures apply to decimal fixed point numbers, not integers or floating point numbers. (In particular, Ada 95 pictures have no "exponent picture" support.) I also willingly concede that waiting until run time to check pictures whose strings are known at compile time is not what I would have chosen. In the case of writing out integers with pictures, I don't greatly mind having type Decimal_Integer is delta 1.0 digits 9; package Decimal_Integer_Editing is new Ada.Text_IO.Editing.Decimal_Output(Decimal_Integer); use Decimal_Integer_Editing; ONCE somewhere in a program (probably written by someone else) and then doing Put(Decimal_Integer(X), To_Picture("-999_999_999")); or whatever. -- Mixed Member Proportional---a *great* way to vote! Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.