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,4b862d91ff93feff,start X-Google-Attributes: gid103376,public From: "Marin David Condic, 561.796.8997, M/S 731-96" Subject: Text_IO for other standard types Date: 1998/01/09 Message-ID: <98010912585349@psavax.pwfl.com>#1/1 X-Deja-AN: 314398533 Sender: Ada programming language Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU X-VMS-To: SMTP%"INFO-ADA@VM1.NODAK.EDU" X-VMS-Cc: CONDIC Newsgroups: comp.lang.ada Date: 1998-01-09T00:00:00+00:00 List-Id: So we have a standard type Integer and a corresponding package Ada.Integer_Text_IO. We have a standard type Float and a corresponding package Ada.Float_Text_IO. We have a standard type Boolean but no corresponding package Ada.Boolean_Text_IO? Or for that matter, the standard type Duration and no Ada.Duration_Text_IO. Oh sure, I can make my own declarations for these things and its pretty trivial. But it seems like it would be good to have all this stuff in one place - under the parent package Ada. (I don't believe it is legal for the end user to extend the package Ada. GNAT chokes on attempts to do so...) Would it be a bad idea to require a Ada.xxx_Text_IO package for any predefined elementary type xxx? I think it would make life easier and would simplify things for a student just starting out learning the language. And a related matter: Would it be difficult to implement an attribute 'Image for composite types? (At least arrays and records - pretty hard to figure out what this would mean for tasks and protected types.) The idea being if you want to implement some debug code or error handling code in which you want to output a message like: "Found a faulty input record: xxxxx" getting an ascii image for quick&dirty error checking would be pretty handy. Handy without dramatically altering the language or imposing undue burden on the compiler. And while we're at it, would there be some food value in requiring a few extra predefined types? I'm thinking of predefined Modular types similar to predefined Integer types and possibly some convenient Decimal Fixed Point types (most commonly used for money, I suppose). My reasoning for having these and their corresponding predefined I/O instantiations is that it would make the language easier to teach. Generics and even to some extent type declarations themselves can be inaccessible to the beginning programmer or a programmer familiar only with more primitive languages. Having predefined types for modular numbers would enable one to teach or discuss modular math & build simple programs to illustrate this without having to delve into the heavier concepts of type definition or generic instantiation. It doesn't sound to me like this would be a difficult extension to Ada and the only potential problem I would anticipate would be the possibility of collisions with existing name usage. Any thoughts on this subject? Good idea? Bad idea? Hmmmm? MDC Marin David Condic, Senior Computer Engineer Voice: 561.796.8997 Pratt & Whitney GESP, M/S 731-95, P.O.B. 109600 Fax: 561.796.4669 West Palm Beach, FL, 33410-9600 Internet: CONDICMA@PWFL.COM ============================================================================= "I filled out an application that said, 'In Case Of Emergency Notify'. I wrote 'Doctor'... What's my mother going to do?" -- Steven Wright =============================================================================