D popularity

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Mon Jan 21 15:42:46 PST 2013


On Mon, 21 Jan 2013 19:48:55 +0000
Russel Winder <russel at winder.org.uk> wrote:

> 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.
> 

I've heard that argument before, but I've yet to come across a good
explanation of how this "dynamic mindset" different from the static
one. Just that "it exists" and "it's different". Far as I can tell so
far, the "dynamic mindset" is just "Bugs? Efficiency? Meh, I don't care
as long as I'm piling on and shipping (easily broken) code".

So what is this "dynamic mindset" that makes using dynamic typing
productive and non-bug-prone? How does it work, if it's not as I
described above?


> It is interesting that Groovy, the epitome of a dynamic language is
> pushing static typing and compilation as a partner mode of working,

It doesn't sound at all like it's an epitome of dynamic language,
then. The *core* of it might be, but if it both provides *and*
encourages you to use static typing, then if you choose to do so,
you're clearly NOT doing dynamic programming - you're doing
static programming. I don't see how using a static type system can ever
be accurately called "dynamic programming".




More information about the Digitalmars-d mailing list