Swift and OC are compiled languages, explanatory languages, run-time languages

Source: Internet
Author: User

The first thing to make clear is that what is a compiled and interpreted language

Compiled language, is in its execution process needs to be compiled into machine code to the computer recognition, its execution efficiency will be relatively high this is obvious, common such as: C, C + +

The interpreted language, instead of compiling the process, is simply translated by the corresponding translator (virtual machine) at execution time. This makes it a good cross-platform, because it can be compiled directly from the compiler to the desired language on the platform, but there is one problem: every time it runs, each line of code is interpreted as a line-by-row interpretation of the translation. Common examples: Python, JS, PHP

Thus, both OC and Swift are required to compile before executing the code function, so they are all compiled languages.

And then one of the differences between OC and Swift is that Swift is a dynamic type language, which means that he does the data type check when the code executes, and that the children's shoes that use swift should be cleared, The type declarations of variables in Swift are all using the var keyword and do not specify a specific data structure type, which is derived from a type, that is, weakly typed language, which is very well understood, the type is weak is not mandatory. The corresponding OC variable in the declaration of the time to specify its type, so it is relatively dynamic type language opposite the static type language, is strongly typed language

Finally, it is the runtime language, as mentioned above: compiled language is to be compiled-run, run-time language is when the program is running to call the method of the object, and determine its data type. Not at compile time.

Reference website http://www.th7.cn/Program/IOS/

OC is a run-time language that determines the type of an object only when the program is running, and invokes methods corresponding to the object of the class. The runtime mechanism allows us to dynamically modify all the properties and methods of a class, object, and even private methods, as well as private properties, while the program is running.

Swift and OC are compiled languages, explanatory languages, run-time 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.