Analysis of dynamic and static languages, compiled and interpreted languages, strongly-typed languages and weakly typed languages

Source: Internet
Author: User

I. Dynamic languages and Static languages
1.

We often speak of moving, static language, usually refers to:

Dynamic type language dynamically Typed Language

Static type language statically Typed Language

There may also be: dynamic, static programming language dynamic\statically programming Language

2.
Dynamic Type language: The language that examines the type of data during run
Example: Ruby\python
Such languages are programmed to not assign types to variables, but to obtain data types when they are attached.
Python is a dynamic language, a variable is simply a reference to an object, and the variables A and B themselves have no type, and their values have types.

Static type language: Data type is checked during compilation
For example: C + +, java/c#

Static typing when possible, the dynamic typing when needed.

Java is a static language, but there are many dynamic features, such as reflection, Annotation, dynamic Proxy

3. About the security of dynamic and static language

A dynamic language or a static language is irrelevant to security, but:
Dynamic languages do not support many static checks
Security analysis tools cannot handle some of the behavior of dynamic languages
Therefore, dynamic languages are sometimes considered unsafe. But from the idea of design, such as:
One design philosophy of Python is to trust programmers. If there's a problem with the code, it's your problem, not the Python problem. So the code is concise.
Java, in contrast, does not trust programmers. Requires a step-by-step writing code that requires a compiler to do a static check. So the code is lengthy.

Two. Compiled and interpreted languages
1. Operation Process
compiled language: Compile first, then execute

The earliest trace to the assembly is that the compiler (Compiler) converts the source code into executable code, a process called compilation (Compile).
If there is more than one file, there is a link to the process. Link program (Linker)-Link

interpreted language: Direct interpretation of execution

For example, Basic, which is only source code, does not have an executable file. Each execution of a program to a source program, the interpreter converts the source code into binary code for execution. and is an ongoing process of explaining ongoing execution.
Advantages: No need to compile, run directly, Debug.
Disadvantage: Slow running. And there is no compile-time syntax check.

Interpreting the portability of a type language is done by the interpreter, and the porting of a compiled type language is done by the compiler.

In fact, many languages are compiled or interpreted as ambiguous, such as Java has both compiler javac, and the JVM is interpreted by the execution.

3.
One reason for the slow operation of an interpreted language is that it is equivalent to putting the compiled process into execution.
One reason for the slow operation of a dynamic type language is that the type of the variable needs to be judged during execution.

Three, strong type language and weak type language

usually A strongly typed language is one in which the type of the variable is explicit when it is defined . Once a variable is declared to be of a type, it is always treated as that type, except by forcing the type conversion.

Here strong \ Weak type language division, and dynamic \ Static language division of the difference and connection, you can further study, first come here.

In-depth discussion can be found here: https://www.zhihu.com/question/19918532, see the comments below there are some controversies, I think it may be because the modern language in the design of mutual reference, so that the boundaries of the language type becomes blurred. It is important to understand the differences in language types from different perspectives, as well as the design ideas and characteristics of each language itself.


No type: assembly
Weakly-typed, Static-type: C + +
Weak type, dynamic type check: perl/php
Strongly typed, static type checking: java/c#
Strongly typed, dynamic type checking: Python, Scheme
Static explicit type: JAVA/C
Static implicit type: Ocaml, Haskell

Analysis of dynamic and static languages, compiled and interpreted languages, strongly-typed languages and weakly typed languages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.