D popularity

Russel Winder russel at winder.org.uk
Mon Jan 21 11:48:55 PST 2013


On Mon, 2013-01-21 at 11:22 -0800, H. S. Teoh wrote:
[…]
> Yeah, I remember when I was young and foolish, and believed for a short
> moment the hype about "dynamic typing" languages. I quickly discovered
> that dynamic typing is about the worst plague ever to befall the
> programming world as soon as you do anything more than trivial textbook
> examples. You have to be constantly vigilant of what types are being
> passed around in those variables, because they *might* just happen to be
> a string where you expected an int, or an int where you expected an
> object! So much code comes crashing down as soon as you hand it a
> variable of the wrong type -- which the language explicitly allows you
> to, and in fact, which is the language's selling point in the first
> place!

Speaking from the perspective of Groovy and Python, bollocks!

Static typing programming is different from dynamic typing programming.
Approaches and idioms from one do not transfer to the other. Phrases
such as "You have to be constantly vigilant of what types are being
passed around in those variables" is indicative of trying to program in
static typing mode when using a dynamic programming language. "Ain't
gonna work."

> So as soon as you move beyond trivial toy programs into real-world
> applications, you start feeling the need -- the desperate need -- to vet
> each and every single variable passed into your code for their type, and
> worse, the exact fields present in an object type, because so much code
> depends on variables being, uh, of specific, non-varying types? It's
> either that, or constantly checking if something is equal to NULL, or
> sorry, I mean, ===NULL (as opposed to ==NULL or =NULL or <>NULL or
> ====NULL or whatever stupid UFO operator it is nowadays that they use to
> patch a type system on top of a broken language). And you quickly find
> yourself reimplementing a type system on top of the language, which
> *should have provided one in the first place*.
> 
> This article cinched it for me:
> 
> http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages/
> 
> (Summary for the tl;dr people: dynamic languages == static languages
> straitjacketed with only a single type.)

This article and the tl;dr is so founded in complete misunderstanding of
dynamic typing and object-oriented programming, that it cannot be taken
seriously. Dynamically typed languages do have problems, but this level
of hate is so profoundly wrong there should be laws against it.

> To conclude, I have to say that so far, the number of times I've
> actually *needed* to use a Variant type in my entire career is 1 (out of
> the hundreds if not thousands of programs I've written). And that one
> time was when I was writing an interpreter for a DSL. How many
> interpreters are written in Javascript? I rest my case. :)

Using a static typing mindset requires using a statically typed
language. This is fine. Using a dynamically typed language requires a
dynamic type mindset. They are different.

There are a number of interpreters written in JavaScript.

It is interesting that Groovy, the epitome of a dynamic language is
pushing static typing and compilation as a partner mode of working, and
Scala the epitome of statically typed systems now has a dynamic mode of
working. These languages with both statically typed and dynamically
typed parts are the way forward. Programmers coming to terms with the
two modes of thinking is a professional responsibility.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130121/dbef9d92/attachment-0001.pgp>


More information about the Digitalmars-d mailing list