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 X-Google-Attributes: gid103376,public From: "Marin David Condic, 561.796.8997, M/S 731-96" Subject: Re: Text_IO for other standard types Date: 1998/01/20 Message-ID: <98012009510954@psavax.pwfl.com>#1/1 X-Deja-AN: 317721738 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-20T00:00:00+00:00 List-Id: Robert Dewar writes: >I strongly dislike the magic cooking recipe approach. Yes, you can get >students to accept it, but in my opinion damage is done since you >compromise the critical principle that people should understand what >they are doing. > When the students in question are a) engineers and/or b) have experience with some other language (usually Fortran or Basic, in my venue) they typically won't sit still for "just use this and don't question it." Hence you look for ways of avoiding discussing generic instantiation until you've gotten them comfortable with the basics. >Fortunately, there is a perfectly comfortable way to deal with this, which >is to use the Image attribute, so people can write > > My_Type'Image (val) > >Sure, you don't get nice formatting that way, but you can leave nice >formatting for later. I've used this approach for the really introductory part of my course. You don't have to explain anything more serious than "with Text_IO/use Test_IO" and the associated Get_Line/Put_Line calls. It seems to be acceptable and you can show your garden variety engineer how to code up a little program to compute Y = M * X + B and it is only slightly more complicated than a Fortran equivalent. Maybe less so since you've got to deal with Fortran's I/O and that isn't a whole lot simpler than Get/Put with 'Image and 'Value. In any case the attributes are a big help in getting the students familiar with the basics. > >Note that the extension of Image to cover floating-point types is a nice >improvement for this style of teaching. > Yeah Verrily and Forsooth! I am eternally grateful for getting the 'Image attribute on floating-point types. I'd like to see it available for just about any type but I have no notion as to how tough it would be to implement for compound types. (This would be useful for quick&dirty data dumps when debugging or producing throwaway hacks) >This is certainly not a big deal, but I see no reason for introducing >magic cookbook formulae when it is unnecessary. > I like using the attributes to get around cookbook rituals, but I still have a problem when I eventually have to get to explaining Text_IO. The usual reaction is that Text_IO is painful. (I won't argue technical merit - that's just the standard issue response: "Why does this have to hurt so bad?") What I would *like* to do is be able to explain Text_IO without having to simultaneously explain generic instantiation. So if you had a useful set of predefined types and predefined instantiations of the generic I/O packages for all the predefined types and this was standard Ada (to avoid "this only works in my class because I gave you some code") it would be a lot easier to explain. I could approach it from the standpoint of: with/use the appropriate packages for the data types in question and you will get the following I/O procedures available... 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 ============================================================================= "A verbal contract isn't worth the paper it's written on." -- Samuel Goldwyn =============================================================================