comp.lang.ada
 help / color / mirror / Atom feed
From: robert_dewar@my-dejanews.com
Subject: Re: Ada 95 LRM Error?
Date: 1999/01/29
Date: 1999-01-29T00:00:00+00:00	[thread overview]
Message-ID: <78seia$f03$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 78qsvv$pim@dfw-ixnews10.ix.netcom.com

In article <78qsvv$pim@dfw-ixnews10.ix.netcom.com>,
  Richard D Riehle <LaoXhai@ix.netcom.com> wrote:

> COBOL is not a strongly-typed language.

Well ... We need to be careful in the Ada community to
distinguish between the notion of strong typing, and the
facilities for declaring types.

COBOL is definitely strongly typed, and the typing rules
will prevent (for example) doing arithmetic on
non-arithmetic items.

What Richard means is that the typing capabilities of COBOL
are weak in the ordinary English sense of the word, but
this is not the same as weak typing in the technical sense.

C is also a strongly typed language in this technical
sense, but again, the facilities for declaring types are
poor, and for example, C chooses to make int and char the
same type, just as Ada chooses to make natural and integer
the same type.

When people say that Ada is strongly typed, they mean two
things:

1. It has a semantic notion of typing at compile time, with
static type checking.

2. It has a well developed typing system, that allows the
programmer to easily create types that take advantage of 1.

It is actually 2 that is the really important issue in Ada,
and indeed I am happy for people to call that strong
typing, but it is important to realize that saying
"language X is not strongly typed" in language wars
discussions may cause confusion of the 1. vs 2. type above,
and it is good to understand this source of confusion, so
that discussions do not get confused.


> There are, of course, data types in the form of PICTURE
> characters, but a COBOL programmer has great latitude in
> performing operations that mix alphanumeric numbers
> and ordinary alphanumeric characters.
>
>     05 Some-Number     PICTURE  S99V99 USAGE DISPLAY.
>     05 Some-String     PICTURE  9(6).
>
>  We may freely MOVE  (actually MOVE means "copy") the
>  numeric data to the string data without regard to the
>  typing.

That's a bit misleading. Such a move is *only* valid if
the sending field contains only digits (this is for
instance clear from figure 49 of the ANSI 77 standard).
A move where other than digits are moved is what Ada
programmers would call erroneous.

Still, the point that Richard is making, which is that this
is not checked at compile time, is valid, and I think it
quite appropriate that the COBOL interface of Ada not try
to enforce compile time restrictions which would not exist
in a normal COBOL environment (there are plenty of
"erroneous" COBOL programs in the world :-)

Robert Dewar

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  parent reply	other threads:[~1999-01-29  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-27  0:00 Ada 95 LRM Error? Al Christians
1999-01-27  0:00 ` Martin C. Carlisle
1999-01-28  0:00   ` J. David Bryan
1999-01-28  0:00 ` Richard D Riehle
1999-01-27  0:00   ` Al Christians
1999-01-28  0:00     ` robert_dewar
1999-01-28  0:00       ` Al Christians
1999-01-28  0:00     ` Richard D Riehle
1999-01-28  0:00       ` Interfaces.Cobol (Was LRM Error?) Al Christians
1999-01-29  0:00       ` robert_dewar [this message]
1999-01-31  0:00         ` Ada 95 LRM Error? Keith Thompson
1999-02-01  0:00           ` Types (was Ada 95 LRM Error?) Richard D Riehle
1999-02-02  0:00           ` Ada 95 LRM Error? robert_dewar
1999-01-28  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