Registered: Jul, 2003
Re: Generics in C#, Java, and C++
Posted: Jan 26, 2004 11:38 AM
Does the dial go from weak to strong, or from static to dynamic?
'So what is strong typing? As best as we can tell, this is a meaningless phrase, and people often use it in a nonsensical fashion. To some it seems to mean The language has a type checker. To others it means The language is sound (that is, the type checker and run-time system are related). To most, it seems to just mean, A language like Pascal, C or Java, related in a way I cant quite make precise. For amusement, when someone mentions the phrase strongly typed at a cocktail party, ask them to define it, then sit back and watch them squirm. And please, dont use the term yourself unless you want to sound poorly-trained and ignorant. Use the terminology of this course instead.'
Chapter 24 Type Soundness p205
Programming Languages: Application and Interpretation
> I have personal experience of the pain of representing
> certain designs in C++, a strongly- and statically-typed
"C and C++ do not have sound type systems. That is, the type system may define certain abstractions, but the run time system does not honor and protect these." p205
> And turning the dial in the other direction, in languages
> such as Python, Ruby, or Smalltalk, I agree I was amazed
> at how /little/ pain was involved in clearly representing
> concepts in the code.
I've used Smalltalk for over 10 years and like it.
However, there are expressive statically checked languages: ML, Haskell, Nice http://nice.sourceforge.net/index.html, Scala http://scala.epfl.ch/index.html ...
> But were they 'less safe'? I for one don't think so. I
> tend to agree with Bruce Eckel's position (at
> http://mindview.net/WebLog/log-0025) that strong and
> static typing are both missteps towards unit-tested code.
> The sorts of assurances that typing can give you are
> really not that useful compared to unit-tests which check
> that a method's semantics are correct.
It seems that folk experienced with expressive statically checked languages have a different programming style - they write code to actively use the type system to find errors, to them the type checker is another tool they can use to make their program better.