From: Robert A Duff <bobduff@world.std.com>
Subject: Re: C vs. Ada - strings
Date: 2000/05/18
Date: 2000-05-18T00:00:00+00:00 [thread overview]
Message-ID: <wcc8zx7ua2y.fsf@world.std.com> (raw)
In-Reply-To: dale-FF1F1A.14272618052000@news.rmit.edu.au
dale <dale@cs.rmit.edu.au> writes:
> Pete wrote:
> if you write
> > Positive'Image("5"). You get back
> > " 5", with a space for an optional - sign, even though it is a positive
> > number! or even worse,
>
> (should read Positive'Imge (5))
> i've always thought of attributes such as these as rather low level
> features good for debugging, but not really of much use for fancy
> formatting. Still it can be annoying. You have to apply the trim
> function, or slice the array yourself, which is annoying.
The annoying extra blank is certainly a mistake. So is the verbose
syntax. Why can't you say X'Image instead of Integer'Image(X)?
After all, you can say "X + 1" (as opposed to something like
Integer'Add(X, 1)). It's not necessary or helpful to mention the type
every time you want to do something to an object or value.
> instantiate a generic package to handle printing
> > of
> > numbers, instead of
> > System.out.println("This is junk " + i); (where i is a numeric type).
>
> Yes, but with this simplicity you get a very real problem - the
> inability to define new distinct numeric types.
I don't agree. It's quite easy to design a language in which it is
possible to define convenient output procedures, and still have multiple
user-defined integer types. And I don't mean by making all the output
primitives built-in, either (as in Pascal) -- I/O should be done in
library packages, not as built-in primitives.
>... Which do you think
> is the bigger problem - having to choose b/w int and long for almost
> all integer work (without the ability to have unsigned ints),
> or having to instantiate (or do a type conversion) to get output?
The former. But I think it's possible to get the best of both worlds,
so I think it's a legitimate complaint to say that Text_IO is a pain in
the neck compared to Java's primitives. On the other hand, Java has its
own problems with strings. Eg, the fact that the equality comparison is
pointer comparison. And "+" is a poor choice for the concatenation
operator.
> Note that you could always include your own package of functions
> to get exactly the same behaviour as you see above in Java.
I don't see how. Not if you have lots of user-defined integer types --
you have to declare something extra for every integer type, which does
not match the convenience of the Java routines.
- Bob
next prev parent reply other threads:[~2000-05-18 0:00 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-02 0:00 C vs. Ada - strings Wes Groleau
2000-05-02 0:00 ` Larry Kilgallen
2000-05-02 0:00 ` Ted Dennison
2000-05-03 0:00 ` Pascal Obry
2000-05-03 0:00 ` Keith Thompson
2000-05-04 0:00 ` Wes Groleau
2000-05-18 0:00 ` Pete
2000-05-18 0:00 ` dale
2000-05-18 0:00 ` Robert A Duff [this message]
2000-05-19 0:00 ` dale
2000-05-21 0:00 ` Robert Dewar
2000-05-22 0:00 ` Robert A Duff
2000-05-22 0:00 ` Keith Thompson
2000-05-24 0:00 ` 'img Peter Hermann
2000-05-24 0:00 ` 'img Robert Dewar
2000-05-24 0:00 ` 'img Ted Dennison
2000-05-25 0:00 ` 'img Robert Dewar
2000-05-25 0:00 ` 'img Peter Hermann
2000-05-25 0:00 ` 'img Keith Thompson
2000-05-25 0:00 ` 'img Ted Dennison
2000-05-26 0:00 ` 'img dmitry
2000-05-26 0:00 ` 'img Brian Rogoff
2000-05-26 0:00 ` 'img Robert Dewar
2000-05-26 0:00 ` 'img Robert Dewar
2000-05-19 0:00 ` C vs. Ada - strings Geoff Bull
2000-05-19 0:00 ` mike
2000-05-21 0:00 ` Robert Dewar
2000-06-03 0:00 ` Pete
2000-06-03 0:00 ` Java vs. Ada - strings (was: C vs. Ada - strings) Ted Dennison
2000-06-04 0:00 ` Robert I. Eachus
2000-06-04 0:00 ` Pete
2000-06-04 0:00 ` Jean-Pierre Rosen
2000-06-04 0:00 ` Pete
2000-06-05 0:00 ` Jean-Pierre Rosen
2000-06-05 0:00 ` Ted Dennison
2000-06-05 0:00 ` Marin D. Condic
2000-06-05 0:00 ` David Botton
2000-06-05 0:00 ` Marin D. Condic
2000-06-06 0:00 ` Robert A Duff
2000-06-06 0:00 ` Ken Garlington
2000-06-06 0:00 ` Marin D. Condic
2000-06-03 0:00 ` C vs. Ada - strings Ken Garlington
2000-06-03 0:00 ` Ted Dennison
2000-06-04 0:00 ` Ken Garlington
2000-06-04 0:00 ` Dale Stanbrough
2000-05-03 0:00 ` Wes Groleau
2000-05-03 0:00 ` Ted Dennison
2000-05-04 0:00 ` Ole-Hjalmar Kristensen
2000-05-04 0:00 ` Gautier
2000-05-02 0:00 ` Robert A Duff
2000-05-03 0:00 ` Tarjei T. Jensen
2000-05-03 0:00 ` Charles Hixson
2000-05-04 0:00 ` Robert Dewar
2000-05-04 0:00 ` Charles Hixson
2000-05-06 0:00 ` Tarjei Tj�stheim Jensen
2000-05-03 0:00 ` Wes Groleau
2000-05-03 0:00 ` Tarjei Tj�stheim Jensen
2000-05-03 0:00 ` Ted Dennison
2000-05-04 0:00 ` Robert Dewar
2000-05-04 0:00 ` Robert A Duff
2000-05-04 0:00 ` Robert Dewar
2000-05-05 0:00 ` Florian Weimer
2000-05-05 0:00 ` Pascal Obry
2000-05-05 0:00 ` Hyman Rosen
2000-05-06 0:00 ` Tarjei Tj�stheim Jensen
2000-05-06 0:00 ` Florian Weimer
2000-05-07 0:00 ` Robert Dewar
2000-05-09 0:00 ` Florian Weimer
2000-05-04 0:00 ` Hyman Rosen
2000-05-04 0:00 ` Jon S Anthony
2000-05-04 0:00 ` Robert Dewar
2000-05-05 0:00 ` Florian Weimer
2000-05-05 0:00 ` Robert Dewar
2000-05-05 0:00 ` Ted Dennison
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox