DEV Community

Discussion on: What is the difference between Statically and Dynamically Typed Languages

Collapse
 
cappe987 profile image
Casper

There also exists type inference in some statically typed languages (Haskell, for example) where you don't have to write out the types at all (like a dynamically typed language). The compiler is able to infer the types anyways.

Interpreted vs compiled is not a strict indication of the typing. You can compile dynamically typed and you can interpret statically typed. Though, dynamically typed may not benefit as much from compiling since the types are not known until runtime. And statically typed benefit more from compiling vs interpreting.

The main difference is really whether types are known at compile time or runtime.

Statically typed helps immensely when working with larger pieces of software, which is a reason it is popular among larger businesses. It is much easier to maintain. Dynamically typed get messy more easily, and not being able to know types makes it harder to navigate.

most people who learn languages like Javascript are more likely to start a business or their own thing as the entire stack is theirs and they can move from front end to back end to database in just one language.

People who can't learn a new language probably won't get very far with their business. And there are more stacks than Javascript available to make products from.

Collapse
 
miketalbot profile image
Mike Talbot ⭐

Just to point out - V8 does compile JavaScript at runtime to have static types based on usage, which can lead to highly optimal code if functions are called with constantly typed parameters, and can lead to deopts if they are frequently called with different arguments - in these cases the code does need to be interpreted.