From: mfb@mbunix.mitre.org (Michael F Brenner)
Subject: Re: Text_IO for other standard types
Date: 1998/01/18
Date: 1998-01-18T00:00:00+00:00 [thread overview]
Message-ID: <69t2fe$m51@top.mitre.org> (raw)
In-Reply-To: dewar.885058658@merv
>> (And, P.S.: Try explaining generic instantiation to a room full of
>> non-programming engineers just so you can do simple I/O exercises
>> with them and see how difficult this is!
>It's not. Just give it as a "cooking recipe". The first day, I explain that
>to get IO's on type Counter, they have to use the magic formula:
> package Counter_IO is new Integer_IO (Counter);
>and that they will later discover why (I don't even tell it's a generic
instanciation). People accept it without problems.
>> 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.
I agree with Robert that something as complicated as generic
intantiation of text_io should be done FIRST as an cook-book
example. Later, it will be fully explained and understood,
but the example is essential In The Beginning.
The FORTRAN instructor had to code your first FORMAT statement for
you and it was quite a few minutes into the course that you could understand that first FORMAT statement.
>>> ...use the Image attribute
This is usually better.
I agree that the image attribute should be used when possible,
and is preferable to using text_io in the beginning as well
as in actual applications. When it is not possible to use
the image attribute, it is often possible to program your
own IMAGE Function. This leaves your ADT packages PURE.
Still another alternative would be to program some kind of
output procedures called, perhaps, TELL, DUMP, TRACE, PUT,
or whatever you would prefer. However, this would take a
PURE ADT package and degrade it all the way down to
ELABORATE_BODY, losing the optimizations as well as the
simplicity, and the elaboration-error-less-ness of the PURE
package.
But sometimes it seems that you have to have a TELL, when
the data objects of that class are so long that returning
the full IMAGE as a string would be notoriously inefficient.
For example, when it comes time for the annual comprehensive
report, no matter how consistent it is with this scheme,
one probably should not write:
text_io.put_line (image (sort (whole_database)));
unless you have enough RAM left over, say, to store
your years in 4-digit format :)
next prev parent reply other threads:[~1998-01-18 0:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-01-15 0:00 Text_IO for other standard types Marin David Condic, 561.796.8997, M/S 731-96
1998-01-15 0:00 ` Nick Roberts
1998-01-15 0:00 ` Robert Dewar
1998-01-15 0:00 ` Robert Dewar
1998-01-16 0:00 ` Nick Roberts
1998-01-16 0:00 ` Robert Dewar
1998-01-17 0:00 ` Geert Bosch
1998-01-17 0:00 ` Robert Dewar
1998-01-17 0:00 ` Jean-Pierre Rosen
1998-01-17 0:00 ` Robert Dewar
1998-01-18 0:00 ` Michael F Brenner [this message]
-- strict thread matches above, loose matches on Subject: below --
1998-01-20 0:00 Marin David Condic, 561.796.8997, M/S 731-96
1998-01-21 0:00 ` Jean-Pierre Rosen
1998-01-19 0:00 Marin David Condic, 561.796.8997, M/S 731-96
1998-01-12 0:00 Marin David Condic, 561.796.8997, M/S 731-96
1998-01-09 0:00 Marin David Condic, 561.796.8997, M/S 731-96
1998-01-10 0:00 ` Nick Roberts
1998-01-10 0:00 ` Tarjei T. Jensen
1998-01-10 0:00 ` Robert Dewar
1998-01-11 0:00 ` Tarjei T. Jensen
1998-01-11 0:00 ` Robert Dewar
1998-01-11 0:00 ` Robert Dewar
1998-01-12 0:00 ` Tarjei T. Jensen
1998-01-11 0:00 ` Jean-Pierre Rosen
1998-01-14 0:00 ` Dale Stanbrough
1998-01-14 0:00 ` Robert Dewar
1998-01-14 0:00 ` Tarjei T. Jensen
1998-01-14 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox