Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site unc.UUCP Path: utzoo!linus!decvax!duke!mcnc!tim@unc.UUCP (Tim Maroney) From: tim@unc.UUCP Newsgroups: net.lang Subject: Re: Strong Typing and Ignorance Message-ID: <6421@unc.UUCP> Date: Fri, 16-Dec-83 11:49:55 EST Article-I.D.: unc.6421 Posted: Fri Dec 16 11:49:55 1983 Date-Received: Tue, 27-Dec-83 03:12:10 EST References: <2892@utcsrgv.UUCP>, <137@csd1.UUCP> <718@cbosgd.UUCP>, <217@kobold.UUCP> Organization: CS Dept., U. of N. Carolina at Chapel Hill Lines: 30 I was taught that the assertion "language X is strongly typed" is equivalent to the assertion "if E is a legal expression in language X, then the type of the value of E can be determined at compile time". This is the standard meaning of "strong typing" -- if someone knows of a well-defined contender for the phrase, by all means post it to the net, but until that time I will assume that this is the only valid meaning. Contrary to the assertions of some recent articles, Pascal is not strongly typed. There are two exceptions. The first concerns variant records, which have a type which must be determined at run time by examination of the tag field. The second involves integer range types; it is legal to assign a normal integer variable to an integer range variable, but it cannot be determined at compile time whether the integer variable is of the integer range type or the integer type: if the latter, the assignment is illegal. C is not strongly typed, but probably not for the reasons you'd expect (argument mismatch and pointer typing escapes do not make the expression type indeterminate at compile time, they just complicate the typing semantics). The "?:" operator, which is a distributed conditional, can have differently typed alternative values. For instance, in the expression "i>0 ? 1 : 4.2", the type of the value of the expression cannot be determined until the value of i is known -- it might be int, or double. I don't know of any other exceptions to strong typing in C. I hope this definition will help to counteract some of the wildly-inaccurate articles on the subject that have appeared lately, and satisfy the curiosity of those who wanted to know. -- Tim Maroney, University of North Carolina at Chapel Hill duke!unc!tim (USENET), tim.unc@csnet-relay (ARPA)