想必很多人都搞不清楚强类型、弱类型、静态类型、动态类型这些概念,网上很多博客的说法都不太准确。
下面的图表清楚地划分了这些概念,从图上看,静态类型、动态类型大家应该明白其实是指的type sound check发生的时机。而强类型、弱类型到底是什么意思呢?其实这些词语本身概念就是模糊不清的,反正我是能避免使用就尽量避免使用。
《Programming Language:Application and Interpretation》
So what is “strong typing”? This appears to be a meaningless phrase, and people often use it in a non- sensical fashion. To some it seems to mean “The language has a type checker”. To others it means “The language is sound” (that is, the type checker and run-time system are related). To most, it seems to just mean, “A language like Pascal, C or Java, related in a way I can’t quite make precise”. If someone uses this phrase, be sure to ask them to define it for you. (For amusement, watch them squirm.)