development

No wonder it's called "Worthless Information"

July 31, 2003 21:35:50.702

Ted Neward demonstrates an all too common misunderstanding of type systems:

The CLR is always a strongly-typed typesystem; it's built into the core of the runtime, and cannot be abridged or avoided in any way (except through some dangerous unmanaged code accessed through P/Invoke, requiring necessary CAS permissions). There is no notion of "weak typing" as in otherlanguages. But that doesn't stop the CLR (and JVM, among others) from providing the capability to interact with objects defined in this strongly-typed platform in a loosely-bound manner, through the Reflection APIs. Through Reflection, I can effectively defer all decisions about type-enforcement until runtime, gaining a certain measure of flexibility at the expense of compile-time assistance in proving program correctness.

Two things:

  • Dynamic Typiing != weak typing. For instance, C++ is statically, but weakly typed. Python and Smalltalk are dynamically, but strongly typed.
  • Flexibility at the expense of runtime correctness? You mean I've never seen a Null Pointer Exception in Java?

Sigh.

Comments

Untitled

[Dilip] August 1, 2003 8:16:31.467

Where does he say dynamic typing = weak typing? As far as I can understand he said there is nothing to stop objects in a strongly typed system like CLR to be accessed in a loosely-bound manner. Moreover he seems to point out that languages running for the CLR are distinct from weakly typed ones like Python or Ruby.

Re: Untitled

[James Robertson] August 1, 2003 9:11:21.779

Comment on Untitled by James Robertson

The point is, Python - like Smalltalk - is not weakly typed. C and C are weakly typed - it's possible (via casting) to get the system to invoke a message on an object that can't handle it, and then crash ugly. In Smalltalk (and, IIRC, in Python as well, and I believe in Ruby) - that's not the case. You will get a well understood exception that can be dealt with easily.

Untitled

[Dilip] August 1, 2003 13:17:02.429

there seems to be too much of nomenclature around that is extremely confusing. Consider: * Strong typing * Weak typing * Dynamic typing * Static typing * Strong binding * Loose binding * Loose typing Check this out to get super-confused... http://www.neward.net/ted/weblog/index.jsp?date=20030522#1053617115876

 Share Tweet This
-->