cro…@spitfire.i.gajendra.net (Dan Cross) writes:
> In article <11ei…@kst.eternal-september.org>, > Keith Thompson <Keit…@gmail.com> wrote:
[...]
>>I'm not aware that there's any widely accepted definition of >>"strongly typed". And I would argue that "strong typing" cannot >>be measured along a single continuum, with "weakly typed" languages >>at one end and "strongly typed" languages at the other. One language >>might have strong typing enforced at run time; another might have >>weak typing enforced at compile time.
> > No, these terms of art that are, as I understand it, fairly well > understood in the PL community. Generally, "strong typed" means > "no implicit conversions", and "statically typed" means "types > are known at compile time."
You may well be right about that. On the other hand, I think there are a lot of people who don't use the terms that way, and some of them participate in discussions like this one. (I'm not referring to anyone in particular.) In the particular case of "hello" + 1 being valid in C, there are two things going on. One is the implicit conversion of the array expression "hello" to a pointer expression; that's weak typing. The other is the existence of a + operator that takes pointer and integer operands; that's just a weird operator, no more weakly typed than Pythons "foo" * 3" or Perl's "foo" x 3. A digression: I'm not happy that C's array-to-pointer conversion is referred to as a "conversion". It's not like other type conversions. An ordinary type conversion is an operation (either performed implicitly or specified by a cast operator) that takes an operand of some type, and the result depends only on the *value* of the operand. It notionally happens at run time, but can sometimes be optimized to occur at compile time. The array-to-pointer conversion could more accurately be described as a compile-time *adjustment*, similar to the array-to-pointer parameter adjustment (for which the standard does use the word "adjusted"). Likewise for function-to-pointer conversions.
-- Keith Thompson (The_Other_Keith) Keit…@gmail.com void Void(void) { Void(); } /* The recursive call of the void */