Lesson five language Small Talk (2)
5.2 Data types--rules and workarounds
Manipulated in the rules, the gods are outside the rules--"Huzhen, ancient and modern medical case Press"
Keywords: data type, static type, dynamic type, duck type, strong type, weak type, type safety
Summary: Discussion of data types
! Preview
· The philosophy of the duck type is: What is not important, what is important is what can be done
• It may not seem like a bad idea to put a guy who's going to swim in a pond, but if a ship comes in with the opportunity to rumble in, it's not going to be that nice.
• Static type check similar to "suspect crime from have" the guilty push customization, dynamic type check similar to "suspect from none" of the Innocence push customization
• Keep the rules as closely as possible and make modifications if necessary
• Rules such as belts, too loose and too restrictive are not good
? Questions
• Dynamic language and dynamic type language is it the same thing?
• What are the two elements of a data type? What is the point?
• What are dynamic types and static types? What is the difference between them? What are the pros and cons?
• What is a duck type (duck typing)? What are the pros and cons of it?
• What are strong types and weak types? What is type-safe?
: Explain
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 [1], dynamic type language is not necessarily a dynamic language [2]. 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.