Swift:minimizing Annotation with Type inference

Source: Internet
Author: User

Many program apes prefer dynamic languages such as Python and JavaScript, because these languages do not require program apes to declare and manage their types for each variable.

In most dynamic types of languages, variables can be of any type, while type declarations are optional or not allowed at all.

Objective-c takes a mixed approach: it requires a type declaration, but any variable that points to an instance of a Objective-c class (including any class derived from NSObject, but not the so-called primitive type, such as int,float, etc.) You can simply declare it to be of type ID, so you can point to any objective-c instance type.

Even when using a strict declaration, the Objective-c compiler cannot make any strict warranties about the type of the variable.

Swift:minimizing Annotation with Type inference

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.