The colon and his students (serial 15)--Data type

Source: Internet
Author: User

Data type

According to the 劬, the law is the solid, the wind of the desolate country also--"Xun Yue's-shen"

When the classroom calms down, the colon again says: "Before talking about dynamic languages, it's best to clarify the difference between it and the dynamic type language." ”

Exclamation ya way: "They are not the same thing?" Always thought that dynamic language is the abbreviation of dynamic type language. ”

"In the name of a relative, there is no kinship." Similar names, coupled with dynamic language is the vast majority of the dynamic type of language, causing confusion is inevitable, but there is no inevitable link-dynamic language is not necessarily dynamic type language, dynamic type language is not necessarily a dynamic language. A colon-porridge tongue almost stumbled over the garlic, and the minds of the people were stirred up.

Jianshibumiao, the colon instead of circuitous tactics: "We might as well talk about some of the data type is how to understand?" ”

The comma casually says: "Data type is not the kind of data?" ”

The crowd laughed and said, almost as if he hadn't said anything.

The colon says: "The data type contains two elements: one is a set of allowed values, and one is an operation that allows participation." For example, the int type defines both a set of integers between −231 and 231−1 in Java, and an operation that can be performed on integers on that set. The question now is: what is the point of the data type? ”

Period Answer: "To limit the data type of a variable means to limit the scope of the variable and the operation involved, which guarantees the security of the code to some extent." ”

The colon cross-examine: "Still have?" ”

After a few thoughts, said: "User-defined data types, such as the structure in C and Java classes or interfaces, give the data logical connotation, improve the abstraction of the code." ”

Incisive "Colon-chan," the data type both for the physical meaning of the machine, but also for the logical meaning of people. The former is used for the underlying memory allocation and numerical operations, and the latter is used to express high-level logic concepts. Since types are so important, type checking is essential. The dynamic type language (dynamically Typing Language) is the language in which the type check occurs during the runtime (Run-time). ”

That static type language (static Typing Language) is naturally the language of the type check occurring during compilation (Compile-time). "The quotation marks are connected to the passage.

Colon response: "The general argument is this, but I would prefer the ' compile period ' four words to ' before running ', otherwise it is easy to misunderstand the static type language must be a compiled language (Compiled Language). ”

The question mark asks, "Is it possible to say that a static type language requires a variable declaration, whereas a dynamic type language is not required?" ”

"That's only half right," he said. "Colon comment," The dynamic type language does not require an explicit variable declaration (Explicit declaration), and some static type languages are sometimes not required. A typical functional language, such as ML, Haskell, in which the compiler can infer type inference by context. ”

Exclamation mark regrets: "Dynamic type language do not have to declare variables, or even a variable in different places can represent different types, more convenient and easy ah!" ”

The colon nods slightly: "Dynamic type language does have a concise and quick advantage, and naturally has generic (generic) features, and the code is more flexible." For example, a dynamic type has a form called a duck type (Duck Typing). ”

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.