[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::languages

Title:Languages
Notice:Speaking In Tongues
Moderator:TLE::TOKLAS::FELDMAN
Created:Sat Jan 25 1986
Last Modified:Wed May 21 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:394
Total number of notes:2683

65.0. "Strongly Typed (?) Language" by HARDY::JOHNSON () Thu Jun 13 1985 17:32

As I was writing some notes for a class on PL/I, I realized that
I had no idea what a "strongly typed" language really was. 
This term has been thrown around so long that it seems to 
have lost all meaning.

Apparently, some of the following facts about PL/I are relavent
to its being strongly (or not so strongly) typed, while others
are totally irrelavent:

  o All variables must be declared before use.

  o The compiler provides a default declaration if the user forgets one.

  o PL/I performs automatic conversions of data upon assignment.

  o The same storage can be declared different ways by using the 
    UNION attribute.

Of the four people I've asked so far, I've had four different answers.
Only one seemed to have a solid grip on the concept. He 
said that only the third of the four points listed above was a 
valid criterion, and for that reason, Pascal was more strongly
typed than PL/I.

If this is so, the question of whether a language is strongly typed
would seem to have more of a yes/no response than one of degree.

Any comments, counterpoints, or clarifications out there?
    

MATT
T.RTitleUserPersonal
Name
DateLines
65.1REGINA::AUGERIThu Jun 13 1985 19:116
I would tend to agree that a language that does automatic type conversion
is not "strongly typed".  After all, if you are relatively free to make
assignments across types, what is the value of having types in the first
place?

	Mike
65.2BABEL::BLICKSTEINFri Jun 14 1985 11:0618
The term "strongy typing" has become ambiguous is recent years.

Aho & Ullman give the following definition:

	... Other languages (such as Pascal) have many types but
	the type of every name and expression must be calculable
	at compile time.  Such languages are said to be strongly
	typed.

Clearly, by this definition, PL/I is a strongly typed language.  However,
the most common use of the term outside the literature has to do with the
languages rigidity or flexibility at mixing types and the term is used to
describe the degree of rigidity in mixed-typed contexts.  Thus  Pascal is
said to be more strongly typed than PL/I.

Which is the right definition?  I'm not sure that can be answered.

	db
65.3SPEEDY::GLOSSOPFri Jun 14 1985 17:4030
Here are definitions I would give based on the way that I have seen the
terms used.

Untyped languages (Bliss, BCPL) - In these languages, the operations
    determine how the data is to be interpreted.  For example, if
    A and B are data objects and the interpretation is based on
    whether I perform FLOATING_ADD(A,B) or INTEGER_ADD(A,B).
                                
Weakly typed languages (C, PL/I, FORTRAN) - In these languages, the
    combination of the operator and the operand determines how the
    data is to be interpreted.  In addition, some checking is typically
    performed to make sure that the operation and operand are "type
    compatable", i.e. that you aren't doing something like trying to do
    an indirection using a floating point number.  The important point
    about "weak" typing versus strong typing is mainly whether or not
    the language allows you to use objects in a form other than their
    original form without programmer-specified conversions.  For example
    C will allow you to assign a character constant to an integer (i = 'c'),
    and full PL/I allows you to do things like use string concatenation
    on 2 floating point numbers (s = 4.5 || 2.3).  Structures of different
    sizes and/or characteristics may be assignment compatable due to implicit
    conversions.
    
Strongly typed languages (Pascal, Modula-2, Algol-60) - In these langauges,
    all but a very small number of conversions (typically integer to
    floating point) must be explicitly specified by the programmer.  Data
    structures are not considered assignment compatable unless they are
    defined to have the same "base type".  i.e. arrays cannot be assigned
    unless they have the same base type and extents, and structures often
    must be name-compatable, not just structurally compatable.