Eloquently sums up my feelings about the disadvantages of dynamic typing

simendsjo simendsjo at gmail.com
Tue Oct 15 23:46:37 PDT 2013


On Tuesday, 15 October 2013 at 22:31:06 UTC, Paulo Pinto wrote:
> Am 16.10.2013 00:15, schrieb Walter Bright:
>>
>> http://www.reddit.com/r/programming/comments/1oi8wd/ruby_is_a_dying_language/ccs8yr8
>>
>>
>
> Agree.
>
> While I do like dynamic languages for prototyping and small 
> applications, I came to the conclusion they don't scale in the 
> enterprise.
>
(...)

Haven't tried Ruby, but I switched from Python to D because of 
static typing and speed back in 2007.

Why on earth should
   someVariable = 1
   # And then in some seldom-executed branch..
   somevariable = 2
give me hard to track bugs?
Even lua requires you to say "I'm creating a *new* variable now".

And a compiler that doesn't do simple optimizations?
   for x in range(0,10):
     i = x*x
     # do something with i

^ - might be painfully slow. You should of course code like a 
compiler and create i outside the loop!

And no types means I have to read the source for every method to 
see what types it actually expects.
Dynamic typing does not mean you don't have types to care about, 
it just means the types are hidden from sight and cause bugs at 
runtime. I will never again code in a dynamic language if I can 
avoid it. All the "advantages" of dynamic typing simply doesn't 
exist for anything other than small/trivial programs in my 
experience.

No.. Give me a language that catches obvious bugs at 
compile-time, makes code self-documenting and doesn't let me 
worry about performance.

Of course.. It might just be that I don't "get" dynamic typing :)


More information about the Digitalmars-d mailing list