Why Is Dynamic Typing So Often Associated with Interpreted Languages?

Viewed 7424

Simple question folks: I do a lot of programming (professionally and personally) in compiled languages like C++/Java and in interpreted languages like Python/Javascript. I personally find that my code is almost always more robust when I program in statically typed languages. However, almost every interpreted language I encounter uses dynamic typing (PHP, Perl, Python, etc.). I know why compiled languages use static typing (most of the time), but I can't figure out the aversion to static typing in interpreted language design.

Why the steep disconnect? Is it part of the nature of interpreted languages? OOP?

7 Answers

Dynamically typed interpreted languages give you more freedom in the way you program. It allows for meta programming to be feasible. It allows for variables to be created at run time. Allows for anonymous hashes and anonymous arrays to be created at any given time during run time without ever previously declaring anything before hand. It allows for undetermined information to be inputed into a hash without ever declaring all the keys in advance. You can have subroutines created from undetermined random input. You can feed a program code also that can be run dynamically. Interpreted languages free the chains from which limits programming in general. You are limited to what you type in the source file with statically typed languages. You can do more with less in a dynamically typed language.

Most robots being made today deal with interpreted languages more because information needs to be determined at runtime and new variables need to be made to store this information at runtime. Machine learning is based around information being interpreted. We ourselves as humans are interpreters which is why robots are being designed that way. The future really is interpreted. Of course you need statically typed languages to build interpreters so statically typed languages will never go away unless interpreters are built in assembly code in the future. Most interpreters are built upon statically typed languages these days.

Interpreted languages excel in a dynamic environment. If you can interpret new code/information at run time then why not. If your really good at dynamically programming then you can create code that can create variables and hashes without ever typing everything out. You can reduce the amount of lines drastically if your working with huge amounts of data. You can use a data dumper to print out all your information because interpreted languages usually keep track of the type of variables at runtime allowing for this to be possible. You can't do this in barebones c++. The only time c++ and c knows what's going on is at compile time. After that your on your own unless you implement something yourself.

Who wants to be tied down so much to the source file these days especially when your working in dynamic environments. All your doing is limiting your potential. Once your neck deep in dynamically interpreted code and you go back to any statically typed language you will find it harder to dumb down your code because your still thinking in a limitless mindset. Your mind needs to return back to being limited again to what's typed in the source file.

In the way of programming styles: Statically typed code produces static results. Dynamically typed code produces dynamic or static results.

If your going to be programming something that never changes behavior other than what is known then statically typed languages are great for that. If your dealing with dynamic behavior then dynamically typed languages are better suited for those cases. Everything depends on the situation mostly.

Every language has their ups and downs. Just gotta choose and pick wisely.

Related