Strongly typed programming language、Weakly typed

in most cases,People use the programming language is implicitly convert data types to determine whether a languageWeakly typedLanguage,For example, C。

In fact,For in addition to the more classic foreign language,Most other common languages ​​Strong、Weak type could not tell - or,YesInconsistentof。So it will always be someone to argue。If we take as the basis for the concept of opening,Then the conflicts will appear:

Pascal had planned such as a strongly typed language,But on the whole gave the type of system introduces a vulnerability,So technically speaking it is weakly typed。

So in the end what is strongly typed,What is weakly typed it? ICan not answeryou,As the industry itselfNoWe carried out a complete definition。So if you use a strongly typed language or weak type of language to distinguish,is veryInaccurateof。- because you can not explain what is the strongly typed what is weak type。

in most cases,we useType safety、Memory SecurityDynamic type checkingandStatic type checkingTo define the language - so much more clearly。

In fact, under most circumstances,Our understanding of the strength of different types of,Most people will follow the concept begins to understand,But sometimes there are other ideas - this is normal,Because this definition itself is not a strict technical definition。Since the beginning so I did not get to the bottom of this problem,It led me to "weakly typed" to describe the Swift language,In fact according to our universal definition,It should be strongly typed language - because it does not implicitly convert data type。

But it is weakly typed certainly wrong with it? According to my definition of "small minority" of,It refers to the weak type when no explicit statement to write a value type,For example, in most cases,There may be dependent type inference Swift。So this empathy,I would think that the C language is a strongly typed language。

You may find it funny,But I still say I was right cheek,Because of the type defined only for the weak common understanding and no strict definition。

But again,I also describes the security of Swift is the type of language,This is correct。

Confusion

Speaking of type safety,You might see,Most people with a strong type to refer to the type of security,They said Swift is a strongly typed language when,In fact, that is to say:Swift is a type-safe language。- because in most cases,Type-safe performance and the strong performance of similar type - for example, can not be implicitly converted value type。

But here I would like to say,When we discuss a languageStatically typed languagestill isDynamically typed languagewhen,And there will be a lot of people sayStatically typed languages ​​are strongly typed language,Because its behavior is also consistent with the definition of strongly typed。

You see,If we say that a language is a strongly typed language,Then it is safe to type it? Or it is a statically typed language? Or both?

Or typical C、C Lv,It is a strongly typed language,Because it is a static language,Some people say it is not,Because it is not type safe;For example, the popular Python,It is weakly typed language,Because it is not statically typed language, right? But some people will oppose the:Python does not allow the type of implicit conversion ah it is actually strongly typed!

So we should use to distinguish between strong and weak programming language to avoid behavior,You do,How much benefit does not give the audience the experience,I am afraid only role is even more confusing for beginners。

Further reading

What is the difference between a strongly typed language and a statically typed language?

Strong and weak typing

Original article written by Gerber drop-off:R0uter's Blog » Strongly typed programming language、Weakly typed

Reproduced Please keep the source and description link:https://www.logcg.com/archives/1630.html

About the Author

R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Comments

          1. People like me do not look at perennial spam ...... I actually really be it to the pit! Ok,I have to go looking through ...... It seems I later add a piece of code work,I will write an article to be Hey。

    1. I say that so hard to accept the reality of the Python syntax,Up with good headache,But it really easy to use ah,,,And simple,Thought they would use the。 Dog, then look at the meaning or C and C Lv to the bar。

      1. Well ...... I have to report a bug,No reply to e-mail alert。In addition, I is not gotta get hold of it ...... gravatar
        Python book still eating ash,But tiobe statistics show ...... python very fierce momentum

Leave a Reply

Your email address will not be published. Required fields are marked *