comp.lang.ada
 help / color / mirror / Atom feed
From: Rudisin@TL-20B.ARPA (Jerry Rudisin)
Subject: text_io problems
Date: Tue, 17-Sep-85 13:38:58 EDT	[thread overview]
Date: Tue Sep 17 13:38:58 1985
Message-ID: <8509172214.AA04519@UCB-VAX.ARPA> (raw)

Something that has always struck me as incredibly inconvenient about Ada IO
is the fact that it does not offer the convenience and simplicity of
things like C's printf or the richer IO facilities in PL/1 and FORTRAN.
Formatting a page of output, or even printing a series of variables
and descriptive information for debugging purposes is a real pain in Ada
because of the need to use numerous simple calls.

Unfortunately there is no easy way to get around this limitation.
Within limits you can synthesize a printf type mechanism by defining
a bunch of overloaded IO routines with different combinations of
argument types.  However, one quickly reaches a combinatorial
explosion in trying to build a really useful facility (i.e., to handle
arbitrary combinations of (exactly) 10 parameters of 4 different base types
requires 4 ** 10 overloaded declarations).
Likewise, you could build an IO package using "union types" synthesized
out of variant records and unchecked conversion, but this is dangerous and
inconvenient for a user.
So, we are pretty much stuck with a cumbersome IO mechanism.

I am not proposing any changes to the language to address this, since
there are good reasons for the limitation.  Though well defined in the ARM,
the IO packages are not really part of the language in the sense that they are
packages like any other, not to be implemented by special features such as
routines with variable numbers of parameters.  For a variety of good reasons,
variable number of parameters are not permitted.

This comment is simply to express my own annoyance at this unpleasant
feature of Ada IO, since the subject has been raised, and to ask Ada users
familiar with other languages if this bothers them as well.
I have had surprisingly strong negative reactions to this aspect of Ada
when I describe it to novice Ada programmers.

Jerry Rudisin
Tartan Laboratories
-------

             reply	other threads:[~1985-09-17 17:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1985-09-17 17:38 Jerry Rudisin [this message]
1985-09-23 11:30 ` text_io problems Peter da Silva
  -- strict thread matches above, loose matches on Subject: below --
1985-09-18  0:20 CHRIS
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox