Re: Static vs. Dynamic typing
Re: Static vs. Dynamic typing
- Subject: Re: Static vs. Dynamic typing
- From: Eric Dahlman <email@hidden>
- Date: Wed, 2 Jul 2003 10:10:11 -0500
On Wednesday, July 2, 2003, at 03:15 AM, Rich Warren wrote:
It would be interesting to see serious research done on the relative
development costs of the entire lifecycle of projects done using
static and
dynamic typing. It may be that dynamic typed projects are still
cheaper--even over the long haul. But I am not 100% convinced.
Although it does not directly address Objective-C there was an
interesting flurry of articles about Java, C++, Lisp and a few
scripting languages which I think may be of interest. A good starting
point is
http://www.norvig.com/java-lisp.html which gives the Lisp side
but includes links to the other articles in question.
As someone who has the rare pleasure of getting paid to work in both
Common Lisp and Objective-C I think that both languages share many of
the good points that came out in those studies.
As an aside I have noticed that people are not always precise with the
definitions of strong / weak and static / dynamic typing. The message
I am replying to got it right (at least the bit I quoted did) but these
are orthogonal concepts:
Strong: Every value has a definite type.
Weak: A given value does not have a fixed type and my be interpreted
as one of many types.
For example C is weakly typed since it really is only operating on
chunks of bits. Whether that chunk is a integer, pointer, or part of a
string is not inherent in the value itself and you can change the typed
interpretation of a given set of bits at will. Another weakly typed
language is TCL where everything is a string including integers which
are parsed when needed. In contrast objects in Objective-C and C++ are
strongly typed each object has a definite type determined by its is-a
pointer or (usually) vtable pointer respectively. I will leave it up
to the language lawyers to figure out the "correct" label for the
language as a whole.
Static: The type of a value is fixed at compile time and/or fixed
lexically.
Dynamic: The type of a value is determined at runtime.
Here the classic static language is C and a good dynamic example we are
all familiar with is Objective-C. These description form a matrix that
we can mix and match:
Strong & Static: ML, Java, C++, Ada
Strong & Dynamic: Objective-C, Common Lisp
Weak & Static: C, Assembler
Weak & Dynamic: TCL
I think that there is just too much of an emotional response tied to
the terms strong & weak that makes people want to use them when they
mean static vs. dynamic. Really the strong/weak argument is a
non-starter for the most part when you think about it there is not that
much there.
Well that ended up like 10x longer than I intended ;-)
-Eric
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.