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,a0310be41b671324 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Float -> String conversion? Date: 1997/05/24 Message-ID: #1/1 X-Deja-AN: 243586589 References: <5lbj80$k4p$1@goanna.cs.rmit.edu.au> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-05-24T00:00:00+00:00 List-Id: Dale said >> There are two ways that i know of that you can convert from a float >> to a string. >> >> Float'image - which is in x.xxxxExx format >> Ada.Float_Text_IO.Put >> >> ...but Text_IO is a rather large beast, and many people say >> that 'no one ever really uses text_io for _real_ work'. >> >> If this is the case, then how could one portably convert a float >> to a string? Michel replies I agree with the idea that Ada.text_IO is harmful : - device-dependent, - didactically obsolete, - mixing of disk keeping and user interface. - using disk files implies opening 'standard' files. To work around the problem, I systematically add to all value (number-like) types a package for string<-> value conversion (the specification mimics predefined attributes and Text_IO subprograms) : Robert notes I don't understand what Michel means in his criticisms, Text_IO is not device dependent at the abstract level, and there is nothing about disk files. And more importantly neither of these has the slightest bit of relevance to the Put to a string which is what Dale was talking about, which has nothing to do with devices or disks. Dale, it is perfectly reasonable to use Text_IO for this purpose, use Put to a string, formatting things however you like. As for "didactically obsolete", I can't even guess what that might mean. And as for "mixing of disk keeping and user interface", I do not see that Text_IO has anything to do with either, but maybe that is just a language problem (disk keeping really doesn't mean anything in English!) Perhaps the "didactically" is also a language problem. Didactically means to do with teaching, and the purpose of Text_IO has nothing to do with teaching, it is for outputting text!